isFlatEmpty: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Killzone Kid (talk | contribs) (complete rewrite with examples. old notes moved to talk) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | Checks given position against given filter params. Filter includes checks for: | ||
* If there are any objects closer than given distance from given position (in 2D) | |||
* If the area around position is flat enough to match given gradient | |||
* If the given position is over water or land | |||
* If the given position is over shore line | |||
The gradient seems to correlate with general hill steepness: 0.1 (10%) ~6<sup>o</sup>, 0.5 (50%) ~27<sup>o</sup>, 1.0 (100%) ~45<sup>o</sup>, etc.There are also some oddities about this command that need to be noted: | |||
* Object accounted for proximity check seem to be static objects. Nearby vehicles and units do not seem to affect the output | |||
* Given position will be magically transferred into given position + [[getTerrainHeightASL]] value | |||
* The second element must be -1 (<nowiki><=</nowiki> 0 really) at all times, otherwise command becomes unusable | |||
* The command might be a bit heavy on computations so avoid frequent and large area checks | |||
|= Description | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| position '''isFlatEmpty''' [ | | position '''isFlatEmpty''' [minDistance, -1, maxGradient, maxGradientRadius, overWaterLand, shoreLine, ignoreObject] |= Syntax | ||
|p1= position: [[Array]] - | |p1= position: [[Array]] - position in format [[PositionAGL]]|= PARAMETER1 | ||
|p2= [ | |p2= [minDistance, -1, maxGradient, maxGradientRadius, overWaterLand, shoreLine, ignoreObject]: [[Array]]|= PARAMETER2 | ||
|p3= |= PARAMETER3 | |p3= minDistance (Optional): [[Number]] - Objects within 50m cannot be closer than minDistance. -1 to ignore proximity check. Default: -1 |= PARAMETER3 | ||
| [[ | |p4= -1 (Optional): [[Number]] - Position check mode (DON'T CHANGE). Default -1 |= PARAMETER4 | ||
|p5= maxGradient (Optional): [[Number]] - Maximum terrain steepness allowed. -1 to ignore. Default: -1 |= PARAMETER5 | |||
|p6= maxGradientRadius (Optional): [[Number]] - How far to extend gradient check. Default: 1 |= PARAMETER6 | |||
|p7= overWaterLand (Optional): [[Number]] - 0: position cannot be on water; 2: position cannot be on land. -1 to ignore. Default: 0 |= PARAMETER6 | |||
|p8= shoreLine (Optional): [[Boolean]] - [[true]]: position is over shoreline (< ~25 m from water). [[false]] to ignore. Default: [[false]] |= PARAMETER6 | |||
|p9= ignoreObject (Optional): [[Object]] - Object to ignore in proximity checks. [[objNull]] to ignore. Default: [[objNull]] |= PARAMETER6 | |||
| [[Array]] - Empty array [] if check failed or [[PositionASL]] if succeded. Resulting position will be original [[PositionAGL]] + [[getTerrainHeightASL]] |= RETURNVALUE | |||
|x1=Check if player position is over land:<code>_overLand = !([[position]] [[player]] [[isFlatEmpty]] [-1, -1, -1, 1, 0, [[false]]] [[isEqualTo]] []);</code> |= EXAMPLE1 | |||
|x2=Check if player position is over shore line:<code>_overShore = !([[position]] [[player]] [[isFlatEmpty]] [-1, -1, -1, 1, 0, [[true]]] [[isEqualTo]] []);</code> |= EXAMPLE2 | |||
|x3=Check if player position is over water:<code>_overWater = !([[position]] [[player]] [[isFlatEmpty]] [-1, -1, -1, 1, 2, [[false]]] [[isEqualTo]] []);</code> |= EXAMPLE3 | |||
|x4=Check if no object is closer than 5m to player position:<code>_isEmpty = !([[position]] [[player]] [[isFlatEmpty]] [5, -1, -1, 1, 1, [[false]], [[player]]] [[isEqualTo]] []);</code> |= EXAMPLE4 | |||
|x5=Check if area 10m around player position is relatively flat:<code>_isFlat = !([[position]] [[player]] [[isFlatEmpty]] [-1, 0.3, 10, 1, 1] [[isEqualTo]] []);</code> |= EXAMPLE5 | |||
|x6=Check if area 15m around player position is very flat and empty:<code>_isFlatEmpty = !([[position]] [[player]] [[isFlatEmpty]] [15, -1, 0.1, 15, 1, [[false]], [[player]]] [[isEqualTo]] []);</code> |= EXAMPLE6 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 41: | Line 58: | ||
<h3 style='display:none'>Notes</h3> | <h3 style='display:none'>Notes</h3> | ||
<dl class='command_description'> | <dl class='command_description'> | ||
</dl> | </dl> | ||
<h3 style='display:none'>Bottom Section</h3> | <h3 style='display:none'>Bottom Section</h3> | ||
Line 60: | Line 66: | ||
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]] | ||
Revision as of 00:47, 16 March 2016
Description
- Description:
- Checks given position against given filter params. Filter includes checks for:
- If there are any objects closer than given distance from given position (in 2D)
- If the area around position is flat enough to match given gradient
- If the given position is over water or land
- If the given position is over shore line
- Object accounted for proximity check seem to be static objects. Nearby vehicles and units do not seem to affect the output
- Given position will be magically transferred into given position + getTerrainHeightASL value
- The second element must be -1 (<= 0 really) at all times, otherwise command becomes unusable
- The command might be a bit heavy on computations so avoid frequent and large area checks
- Groups:
- Uncategorised
Syntax
- Syntax:
- position isFlatEmpty [minDistance, -1, maxGradient, maxGradientRadius, overWaterLand, shoreLine, ignoreObject]
- Parameters:
- position: Array - position in format PositionAGL
- [minDistance, -1, maxGradient, maxGradientRadius, overWaterLand, shoreLine, ignoreObject]: Array
- minDistance (Optional): Number - Objects within 50m cannot be closer than minDistance. -1 to ignore proximity check. Default: -1
- -1 (Optional): Number - Position check mode (DON'T CHANGE). Default -1
- maxGradient (Optional): Number - Maximum terrain steepness allowed. -1 to ignore. Default: -1
- maxGradientRadius (Optional): Number - How far to extend gradient check. Default: 1
- overWaterLand (Optional): Number - 0: position cannot be on water; 2: position cannot be on land. -1 to ignore. Default: 0
- shoreLine (Optional): Boolean - true: position is over shoreline (< ~25 m from water). false to ignore. Default: false
- ignoreObject (Optional): Object - Object to ignore in proximity checks. objNull to ignore. Default: objNull
- Return Value:
- Array - Empty array [] if check failed or PositionASL if succeded. Resulting position will be original PositionAGL + getTerrainHeightASL
Examples
- Example 1:
- Check if player position is over land:
_overLand = !(position player isFlatEmpty [-1, -1, -1, 1, 0, false] isEqualTo []);
- Example 2:
- Check if player position is over shore line:
_overShore = !(position player isFlatEmpty [-1, -1, -1, 1, 0, true] isEqualTo []);
- Example 3:
- Check if player position is over water:
_overWater = !(position player isFlatEmpty [-1, -1, -1, 1, 2, false] isEqualTo []);
- Example 4:
- Check if no object is closer than 5m to player position:
_isEmpty = !(position player isFlatEmpty [5, -1, -1, 1, 1, false, player] isEqualTo []);
- Example 5:
- Check if area 10m around player position is relatively flat:
_isFlat = !(position player isFlatEmpty [-1, 0.3, 10, 1, 1] isEqualTo []);
- Example 6:
- Check if area 15m around player position is very flat and empty:
_isFlatEmpty = !(position player isFlatEmpty [15, -1, 0.1, 15, 1, false, player] isEqualTo []);
Additional Information
- See also:
- selectBestPlacesfindEmptyPosition
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