Jump to content
Ulfgaar

Help - .SQF script seemingly executes several times.

Recommended Posts

In my groups standard training map (Malden 2035), I’m trying to add some "automated" events, if they are triggered. To enable this, I’m using repeatable trigger, and .sqf files.
One trigger will activate simulation of, enable dmg to and set the AA ammo count to 100%, for each time its triggered - and the opposite after the time runs out. This works flawlessly.

However, the other which will initiate air combat, with AI aircraft spawning and taking off from the given airport (north-western one, on the small island), seem to be triggering "double" every time, making the AI spawn inside each other and explode.

 

The Trigger parameters:

Type: None
Activation: Blufor
Activation Type: Present
Repeatable: Yes

Condition:
this

On Activation:
_handle = execVM "AirCombat1.sqf";

On Deactivation:
(Blank)

The SQF file looks like this:

_veh1 = createVehicle ["rhssaf_airforce_o_l_18_101", getmarkerpos "JetSpawn1", [], 0, "NONE"];  
createVehicleCrew _veh1;  
_Veh1 setPos [677.568,12285.216,0]; 
_Veh1 SetDir 90;  
_Veh1 domove (getmarkerpos "SND1"); 
_veh1 Flyinheight 1500;
Sleep 15;
_veh2 = createVehicle ["rhssaf_airforce_o_l_18_101", getmarkerpos "JetSpawn2", [], 0, "NONE"];  
createVehicleCrew _veh2;  
_Veh2 setPos [620.538,12285.126,0]; 
_Veh2 SetDir 90;  
_Veh2 domove (getmarkerpos "SND1"); 
_veh2 Flyinheight 1500;
Sleep 600;
_Veh1 domove (getmarkerpos "JetSpawn1");
_Veh2 domove (getmarkerpos "JetSpawn1");
Sleep 150;
{deleteVehicle _x;}forEach crew _Veh1; deleteVehicle _Veh1;
{deleteVehicle _x;}forEach crew _Veh2; deleteVehicle _Veh2;

 

When I preview this on multiplayer in the editor, it works perfectly - but as said, once I play this on the dedicated server, it’s like it fires the .sqf file twice in a row, making the first two jets spawn inside each other with like half a second apart, and then the second jet do the same - twice, with just half a second apart. This ofc results in a spectacular firework, and 4 dead jets - even though the script should technically just spawn 2. 

So, I need some help in figuring this out. I’m no advanced script-head - I for the most part find what i need, alter and combine and it for the most part works. But here I think I need more knowledgeable help.

As always, it will be much appreciated!

Regards,
Ulfgaar

 

Share this post


Link to post
Share on other sites

Tick the server only box in the triggers attributes.

Currently when the trigger activates each machine connected to the game will run the script.

Dedicated Server + one player = 2 scripts = 4 planes

 

51 minutes ago, Ulfgaar said:

When I preview this on multiplayer in the editor, it works perfectly

One host = 1 script = 2 planes

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

×