Jump to content
Sign in to follow this  
thedubl

Triggers!

Recommended Posts

Here is my issue. My trigger does not fire for spawned objects. When I place 4 units on the map and name them mort1,mort2,mort3,mort4 the trigger(2D in editor) condition of {alive _x} count [mort1,mort2,mort3,mort4] == 0 works fine when all are killed. Trigger fires all is well. Now I am trying to make the mission have play ability. So, I putting together multiple spawn locations to be selected randomly. Nothing special. I set the name using setVehicleVarName. However, when the spawn units are killed the trigger ingnores them. I am assuming I am doing something wrong with setting the name. Any idea?

 

dubl

 

taskspawner sqf

hint "Task Spawner called";

sleep 3;

//array position pool
_arrPos = [[1821.16,5763.11]] call BIS_fnc_selectRandom;


//select the pos from the array
_pos = _arrpos;

sleep 1;

//creates team
_grp = createGroup east;

_s1 = createVehicle ["O_Soldier_LAT_F", _pos , [], 0, "NONE"];
_s1 setVehicleVarName "mort1"; mort1 = _s1;

_s2 = createVehicle ["O_Soldier_LAT_F", _pos , [], 0, "NONE"];
_s2 setVehicleVarName "mort2"; mort2 = _s2;

_s3 = createVehicle ["O_Soldier_LAT_F", _pos , [], 0, "NONE"];
_s3 setVehicleVarName "mort3"; mort3 = _s3;

_s4 = createVehicle ["O_Soldier_LAT_F", _pos , [], 0, "NONE"];
_s4 setVehicleVarName "mort4"; mort4 = _s4;

Share this post


Link to post
Share on other sites

OH MY GOD! I should have waited 5 more minutes before posting! After, reading a bit more on the wiki. Set identity is what I should be using. Hopefully it helps someone else save some time!

 

example:

 

_s1 setIdentity "mort1";

 

Travis

Share this post


Link to post
Share on other sites

Ugh, well I did not realize my original unit was still sync. If I spawn a  unit do I have to use triggerAttachVehicle ?

 

Oh, the mission was loading before the guys were spawned because I had a sleep in the script. So the trigger was thinking the condition was true. I am certainly learning a lot about triggers.

Share this post


Link to post
Share on other sites

if you conditioning  count of  units, when some of them could be already killed the best way is to count units of group.

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  

×