Jump to content
Sign in to follow this  
infiltrator_2k

Creating Random Enemy AI Spawn Points

Recommended Posts

I've been digging around how to create random enemy spawn points but without much success. Basically I'm trying to find out the most simplest and effective way of adding random spawn points for AI units instead of them predictably spawning on one particular marker. Can someone please tell me what line of code will I have to add to get this MBT to spawn at multiple random markers?

_tankcrew = [];
_tankframe = [];


if (isServer) then {



_tankcrew = creategroup EAST; 
_tankframe = [getMarkerPos "SpawnA", 180, "O_MBT_02_cannon_F", _tankcrew] call BIS_fnc_spawnVehicle;


_wp1 = _tankcrew addWaypoint [(getmarkerpos "WP1"), 0];
_wp1 setWaypointType "SAD";
_wp1 setWaypointSpeed "FULL";
_wp1 setWaypointBehaviour "COMBAT";



};

Cheers

Ian

Share this post


Link to post
Share on other sites

if spawnA is a marker you can use it as a center point and spawn the vehicle somewhere around that point by doing for example this:

_pos = getMarkerPos "SpawnA";

_RandomPos = [_pos, 0, 200, 30, 0, 5, 0] call BIS_fnc_findSafePos;

_tankframe = [_RandomPos, 180, "O_MBT_02_cannon_F", _tankcrew] call BIS_fnc_spawnVehicle;

check this out : http://tactical.nekromantix.com/wiki/doku.php?id=arma2:scripting:bis_fnc_findsafepos

Share this post


Link to post
Share on other sites
if spawnA is a marker you can use it as a center point and spawn the vehicle somewhere around that point by doing for example this:

_pos = getMarkerPos "SpawnA";

_RandomPos = [_pos, 0, 200, 30, 0, 5, 0] call BIS_fnc_findSafePos;

_tankframe = [_RandomPos, 180, "O_MBT_02_cannon_F", _tankcrew] call BIS_fnc_spawnVehicle;

check this out : http://tactical.nekromantix.com/wiki/doku.php?id=arma2:scripting:bis_fnc_findsafepos

That's awesome cheers ;)

Share this post


Link to post
Share on other sites

Additional info; You can also use BIS_fnc_relPos, then there is no way it will ever use the map's center as the default position if it can't find a sufficient gradient. Though, obviously this doesn't take "bad" areas into account like safe pos.

_position = [getMarkerPos "marker", random 150, random 360 ] call BIS_fnc_relPos;

Edited by Iceman77

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×