BIS fnc randomPos: Difference between revisions
Jump to navigation
Jump to search
m (see also) |
m (template:command argument fix) |
||
Line 9: | Line 9: | ||
|1.00|= | |1.00|= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Selects random position according to given params within given area |= | | Selects random position according to given params within given area |DESCRIPTION= | ||
| [whitelist, blacklist, code] call '''BIS_fnc_randomPos''' |= | | [whitelist, blacklist, code] call '''BIS_fnc_randomPos''' |SYNTAX= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|p1= [whitelist, blacklist, code]: [[Array]]|= | |p1= [whitelist, blacklist, code]: [[Array]]|PARAMETER1= | ||
|p2=whitelist (Optional): [[Array]] - whitelisted areas. If not given, whole map is used. Areas could be: | |p2=whitelist (Optional): [[Array]] - whitelisted areas. If not given, whole map is used. Areas could be: | ||
* [[Object]] - trigger | * [[Object]] - trigger | ||
* [[String]] - marker | * [[String]] - marker | ||
* [[Array]] - in format [center, radius] or [center, [a, b, angle, rect]] | * [[Array]] - in format [center, radius] or [center, [a, b, angle, rect]] | ||
* [[Location]] - location. |= | * [[Location]] - location. |PARAMETER2= | ||
|p3=blacklist (Optional): [[Array]] - blacklisted areas. If not given, water is blacklisted. Areas could be: | |p3=blacklist (Optional): [[Array]] - blacklisted areas. If not given, water is blacklisted. Areas could be: | ||
* [[Object]] - trigger | * [[Object]] - trigger | ||
* [[String]] - marker name or special tags names: "water" - exclude water, "ground" - exclude land | * [[String]] - marker name or special tags names: "water" - exclude water, "ground" - exclude land | ||
* [[Array]] - in format [center, radius] or [center, [a, b, angle, rect]] | * [[Array]] - in format [center, radius] or [center, [a, b, angle, rect]] | ||
* [[Location]] - location. |= | * [[Location]] - location. |PARAMETER3= | ||
|p4= code (Optional): [[Code]] - custom condition which should return true for current position candidate passed in [[_this]] variable to be accepted. If not specified all candidates are accepted|= | |p4= code (Optional): [[Code]] - custom condition which should return true for current position candidate passed in [[_this]] variable to be accepted. If not specified all candidates are accepted|PARAMETER4= | ||
|[[Array]] - position candidate in format [x,y,z] or [0,0] if position cannot be found |= | |[[Array]] - position candidate in format [x,y,z] or [0,0] if position cannot be found |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_randomPosMapNoWater = [] [[call]] [[BIS_fnc_randomPos]];</code> |= | |x1= <code>_randomPosMapNoWater = [] [[call]] [[BIS_fnc_randomPos]];</code> |SYNTAX= | ||
|x2= <code>_randomPosMapNoWater = <nowiki>[</nowiki>[[nil]], ["water"]] [[call]] [[BIS_fnc_randomPos]];</code> |= | |x2= <code>_randomPosMapNoWater = <nowiki>[</nowiki>[[nil]], ["water"]] [[call]] [[BIS_fnc_randomPos]];</code> |SYNTAX= | ||
|x3= <code>_randomPosMapNoLand = <nowiki>[</nowiki>[[nil]], ["ground"]] [[call]] [[BIS_fnc_randomPos]];</code> |= | |x3= <code>_randomPosMapNoLand = <nowiki>[</nowiki>[[nil]], ["ground"]] [[call]] [[BIS_fnc_randomPos]];</code> |SYNTAX= | ||
|x4= <code>_randomPosMap = <nowiki>[</nowiki>[[nil]], []] [[call]] [[BIS_fnc_randomPos]];</code> |= | |x4= <code>_randomPosMap = <nowiki>[</nowiki>[[nil]], []] [[call]] [[BIS_fnc_randomPos]];</code> |SYNTAX= | ||
|x5= <code>_randomPosAroundPlayer = <nowiki>[[[</nowiki>[[position]] [[player]], 50]],[]] [[call]] [[BIS_fnc_randomPos]];</code> |= | |x5= <code>_randomPosAroundPlayer = <nowiki>[[[</nowiki>[[position]] [[player]], 50]],[]] [[call]] [[BIS_fnc_randomPos]];</code> |SYNTAX= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[BIS_fnc_randomPosTrigger]], [[BIS_fnc_getArea]], [[BIS_fnc_findSafePos]]|= | | [[BIS_fnc_randomPosTrigger]], [[BIS_fnc_getArea]], [[BIS_fnc_findSafePos]]|SEEALSO= | ||
}} | }} |
Revision as of 14:32, 7 April 2019
Description
- Description:
- Selects random position according to given params within given area
- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [whitelist, blacklist, code] call BIS_fnc_randomPos
- Parameters:
- [whitelist, blacklist, code]: Array
- whitelist (Optional): Array - whitelisted areas. If not given, whole map is used. Areas could be:
- blacklist (Optional): Array - blacklisted areas. If not given, water is blacklisted. Areas could be:
- code (Optional): Code - custom condition which should return true for current position candidate passed in _this variable to be accepted. If not specified all candidates are accepted
- Return Value:
- Array - position candidate in format [x,y,z] or [0,0] if position cannot be found
Examples
- Example 1:
_randomPosMapNoWater = [] call BIS_fnc_randomPos;
- Example 2:
_randomPosMapNoWater = [nil, ["water"]] call BIS_fnc_randomPos;
- Example 3:
_randomPosMapNoLand = [nil, ["ground"]] call BIS_fnc_randomPos;
- Example 4:
_randomPosMap = [nil, []] call BIS_fnc_randomPos;
- Example 5:
_randomPosAroundPlayer = [[[position player, 50]],[]] call BIS_fnc_randomPos;
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