Jump to content

Recommended Posts

Hello everyone, 

 

I wrote this script  last week and I'm having big problems with it. 

 

Everything run correctly in single player but when I try to play it in mp with my clan it's a mess... The server spawn thousands of enemies instead of 3 waves... 

 

Seems like the trigger is activated by EVERY player in spite of just once. 

 

Thanks for your time.

 

*The trigger is not set repeatable.

 

**I have tried  "activated by anyplayer" and "activated just by the owner".

 

for "_i" from 3 to 0 step -1 do {

hint "Trigger activado";

sleep 360;

_ammo = getArtilleryAmmo [mortar1] select 0; 
_tgt = getMarkerPos "target11"; 
mortar1 doArtilleryFire[_tgt,_ammo,15];

_ammo = getArtilleryAmmo [mortar2] select 0; 
_tgt = getMarkerPos "target12"; 
mortar2 doArtilleryFire[_tgt,_ammo,15];

_ammo = getArtilleryAmmo [mortar3] select 0; 
_tgt = getMarkerPos "target13"; 
mortar3 doArtilleryFire[_tgt,_ammo,15];

sleep 40;

playSound "ura";

_tgp1 = [getPos ens1, east, (configfile >> "CfgGroups" >> "East" >> "LIB_RKKA" >> "Infantry" >> "LIB_SOV_infantry_squad")] call BIS_fnc_spawnGroup;   
_tgp1 deleteGroupWhenEmpty true;    
_wp2 = _tgp1 addWaypoint [position twp2 , 0];    
_wp2 setWayPointType "SAD";  
  
_tgp2 = [getPos ens2, east, (configfile >> "CfgGroups" >> "East" >> "LIB_RKKA" >> "Infantry" >> "LIB_SOV_infantry_squad")] call BIS_fnc_spawnGroup;   
_tgp2 deleteGroupWhenEmpty true;    
_wp2 = _tgp2 addWaypoint [position twp2 , 0];    

  
_tgp3 = [getPos ens3, east, (configfile >> "CfgGroups" >> "East" >> "LIB_RKKA" >> "Infantry" >> "LIB_SOV_infantry_squad")] call BIS_fnc_spawnGroup;   
_tgp3 deleteGroupWhenEmpty true;   
_wp2 = _tgp3 addWaypoint [position twp2 , 0]; 

sleep 30;

_ammo = getArtilleryAmmo [gun1] select 0; 
_tgt = getMarkerPos "target1"; 
gun1 doArtilleryFire[_tgt,_ammo,5];

_ammo = getArtilleryAmmo [gun4] select 0; 
_tgt = getMarkerPos "target2"; 
gun4 doArtilleryFire[_tgt,_ammo,5];

_ammo = getArtilleryAmmo [gun3] select 0; 
_tgt = getMarkerPos "target3"; 
gun3 doArtilleryFire[_tgt,_ammo,5];

_tgp1 = [getPos ens1, east, (configfile >> "CfgGroups" >> "East" >> "LIB_RKKA" >> "Infantry" >> "LIB_SOV_infantry_squad")] call BIS_fnc_spawnGroup;   
_tgp1 deleteGroupWhenEmpty true;    
_wp2 = _tgp1 addWaypoint [position twp2 , 0];    
_wp2 setWayPointType "SAD";  
  
_tgp2 = [getPos ens2, east, (configfile >> "CfgGroups" >> "East" >> "LIB_RKKA" >> "Infantry" >> "LIB_SOV_infantry_squad")] call BIS_fnc_spawnGroup;   
_tgp2 deleteGroupWhenEmpty true;    
_wp2 = _tgp2 addWaypoint [position twp2 , 0];    

  
_tgp3 = [getPos ens3, east, (configfile >> "CfgGroups" >> "East" >> "LIB_RKKA" >> "Infantry" >> "LIB_SOV_infantry_squad")] call BIS_fnc_spawnGroup;   
_tgp3 deleteGroupWhenEmpty true;   
_wp2 = _tgp3 addWaypoint [position twp2 , 0]; 

}

Share this post


Link to post
Share on other sites

1 - You should run this script, on server only, so server only trigger.

2 - Spawn your script : [] spawn { your script here};     (as far as there is no variable to pass, if I'm right). Triggers are unscheduled, so sleep can't work if not scheduled scope. Spawn will do the trick.

 

Share this post


Link to post
Share on other sites
On 4/29/2023 at 11:02 AM, Caparso123 said:

Pls, help me 😞

I'm not very good on scripting for servers. BUT I think if you use:  if (!isServer) exitWith {}; at the beginning of your script should keep it on server and not fire on all clients. Hopefully someone with better knowledge of servers corrects me if I am wrong or confirms if I am write.

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

×