Home   Help Search Login Register  

Author Topic: Spawn Unit Via Trigger With UPS Init Line  (Read 2216 times)

0 Members and 1 Guest are viewing this topic.

Offline Semedar

  • Members
  • *
    • Semedars Official Website
Spawn Unit Via Trigger With UPS Init Line
« on: 09 Aug 2011, 21:29:55 »
I'm trying to spawn a unit via a trigger in my mission with with UPS in its Init field:

Code: [Select]
nul = this execVM "UPS_Woods_Spawn.sqf";

USP_Woods_Spawn.sqf

Code: [Select]
"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..  ???

I also tried:

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

kylania from the BIS forums told me to do the following:

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

Called via:

Code: [Select]
_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:

Code: [Select]
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";

But I already 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)? When they spawn, they spawn next to each other and just stand there, they don't patrol.

BIS Forum Thread: http://forums.bistudio.com/showthread.php?t=123393