BIS fnc randomPos: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\|seealso= ([^ ]+)(\]\]|\}\}), *(\[\[|\{\{)" to "|seealso= $1$2 $3") |
Lou Montana (talk | contribs) m (Text replacement - "<code>\[\[private\]\] (_?[a-zA-Z0-9_]+) = \[([^\[]*)\] \[\[(call|spawn)\]\] \[\[(BI(N|S)_fnc_[a-zA-Z0-9_]+)\]\];?<\/code>" to "<sqf>private $1 = [$2] $3 $4;</sqf>") |
||
Line 29: | Line 29: | ||
|r1= [[Array]] - position candidate in format [x,y,z] or [0,0] if position cannot be found | |r1= [[Array]] - position candidate in format [x,y,z] or [0,0] if position cannot be found | ||
|x1= < | |x1= <sqf>private _randomPosMapNoWater = [] call BIS_fnc_randomPos;</sqf> | ||
|x2= <code>[[private]] _randomPosMapNoWater = [<nowiki/>[[nil]], ["water"]] [[call]] [[BIS_fnc_randomPos]];</code> | |x2= <code>[[private]] _randomPosMapNoWater = [<nowiki/>[[nil]], ["water"]] [[call]] [[BIS_fnc_randomPos]];</code> |
Revision as of 13:35, 1 July 2022
Description
- Description:
- Selects random position according to given params within given area
- Execution:
- call
- Groups:
- Map and Markers
Syntax
- Syntax:
- [whitelist, blacklist, code] call BIS_fnc_randomPos
- Parameters:
- whitelist: Array - whitelisted areas. If not given, whole map is used. Areas can be:
- blacklist: Array - (Optional, default []) blacklisted areas. If not given, water is blacklisted. Areas can be:
- code: Code - (Optional, default
{ true }
) 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:
- Example 2:
private _randomPosMapNoWater = [nil, ["water"]] call BIS_fnc_randomPos;
- Example 3:
private _randomPosMapNoLand = [nil, ["ground"]] call BIS_fnc_randomPos;
- Example 4:
private _randomPosMap = [nil, []] call BIS_fnc_randomPos;
- Example 5:
private _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