Jump to content
Sign in to follow this  
semedar

Spawn Unit Via Trigger With UPS Init Line

Recommended Posts

I'm trying to spawn a unit via a trigger in my mission with:

nul = this execVM "UPS_Woods_Spawn.sqf"; 

USP_Woods_Spawn.sqf

"Ins_Soldier_1" createUnit [getMarkerPos "UPS_Woods", "nul=[this,""UPS_Woods"",""random"",""nofollow"",""min:"",40,""max:"",50,""delete:"",300] execVM ""ups.sqf"";"]

I've put double quotes on there since I was reading up on trying to figure it out and someone suggested using double quotes.. :confused:

I also tried:

"Ins_Soldier_1" createUnit [getMarkerPos "UPS_Woods", "nul=[this,"UPS_Woods","random","nofollow","min:",40,"max:",50,"delete:",300] execVM "ups.sqf";"]

Share this post


Link to post
Share on other sites

This is for groups, but this demo mission shows basically the same thing.

Called via:

_nul = ["spawnMarkerName", "patrolMarkerName"] execVM "spawnGroup.sqf";

There's options for type of group, side and skill, but since you're doing a unit you'd leave those out.

script:

if (!isServer) exitWith {};

_spawnPoint = _this select 0;
_patrolArea = _this select 1;
_units = if (count _this > 2) then {_this select 2} else {["RU_Soldier_SL", "RU_Soldier", "RU_Soldier_GL", "RU_Soldier_AR", "RU_Soldier", "RU_Soldier_GL", "RU_Soldier_AR", "RU_Soldier", "RU_Soldier_AT", "RU_Soldier", "RU_Soldier_GL", "RU_Soldier_AR"]};
_side = if (count _this > 3) then {_this select 3} else {EAST};
_skill = if (count _this > 4) then {_this select 4} else {[0.1, 0.5]};

_pos = getMarkerPos _spawnPoint;

_grp = [_pos, _side, _units, [], [], _skill] call BIS_fnc_spawnGroup;

sleep 3;

{
_x setskill ["aimingAccuracy",0.15];
_x setskill ["spotDistance",0.75];
_x setskill ["spotTime",0.85];
_x setskill ["courage",0.65];
_x setskill ["commanding",0.85];
_x setskill ["aimingShake",0.15];
_x setskill ["aimingSpeed",0.55];
} foreach units _grp;

[_grp,_patrolArea] execVM "scripts\upsmon.sqf";

Share this post


Link to post
Share on other sites

Alright tried that and when they spawn, they all spawn next to each other.. How can I set them to spawn at a random position and have a min/max number of clones spawn and get deleted after 300 seconds (5 minutes)?

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  

×