selectBestPlaces: Difference between revisions
Jump to navigation
Jump to search
m (more white space) |
m (added example) |
||
Line 21: | Line 21: | ||
|x1= <code> | |x1= <code>myPlaces = selectBestPlaces [position player, 50, "meadow + 2*hills", 1, 5]</code>|= EXAMPLE1 | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[findEmptyPosition]], [[isFlatEmpty]] |= SEEALSO | | [[Ambient Parameters]], [[findEmptyPosition]], [[isFlatEmpty]] |= SEEALSO | ||
| |= MPBEHAVIOUR | | |= MPBEHAVIOUR |
Revision as of 23:52, 17 September 2013
Description
- Description:
- Find the places with the maximum value of _expression in the given area. Places can be on water.
- Groups:
- Uncategorised
Syntax
- Syntax:
- selectBestPlaces [_position, _radius, _expression, _precision, _sourcesCount]
- Parameters:
- [_position, _radius, _expression, _precision, _sourcesCount]: Array -
- Return Value:
- Array - Format is [[position: Position2D, expressionResult: Number], ...]
Examples
- Example 1:
myPlaces = selectBestPlaces [position player, 50, "meadow + 2*hills", 1, 5]
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Rübe
- see http://forums.bistudio.com/showthread.php?t=93897 for some more information (though neither official, nor complete). The most important information is the list of useable keywords for the expression which is: forest, trees, meadow, hills, houses, sea, night, rain, windy and deadBody. The keyword will be replaced by the actual value at the given sample position and thus the expression gets evaluated. For example the following expression (which returns high values in forest) "forest + trees - meadow - houses - (10 * sea)" might be transformed to 0 + 0.1 - 0.7 - 0 - (10 * 0) which is - with it's result of -0.6 - not in the forest, though there are some tree(s) around. You get the idea.
Also note that you may aswell check such an expression value at a single position by passing a low radius and a sourceCount of 1, which is often just as usefull as retrieving multiple (and already sorted) positions.
Also do not underestimate the keywords night, rain or windy, for if you couple them with the other keywords, you can easily get a highly dynamic system at a very low cost. (this, btw., is how animals "choose" where and when to spawn)