Jump to content

Recommended Posts

Hey guys,

 

I am looking for some help and explanation on a trigger issue that I cannot seem to find a workaround for. It is most probably me being stupid and forgetting something obvious, but I will be glad if someone explained to me what I am doing wrong.

 

I am trying to have a trigger add three hold actions (repair, rearm, reafuel) to a specific vehicle once it enters the trigger area.

 

It is currently set up like this:

 

Activation: Anybody
Activation Type: Present
Repeatable: Yes

Condition:

h1 in thisList;

On Activation:

 [       
  h1,       
  "Repair",       
  "holdAction_repair_ca.paa",       
  "holdAction_repair_ca.paa",       
  "_this distance _target < 8",       
  "_caller distance _target < 8",       
  {player playMoveNow "AinvPknlMstpSnonWnonDnon_medic3"},      
  {},       
  {h1 setDamage 0; hint "Vehicle repaired";},       
  {player switchMove ""},       
  [],       
  10,       
  0,       
  false,       
  false       
 ] remoteExec ["BIS_fnc_holdActionAdd", 0, h1];    
     
 [       
  h1,       
  "Rearm",       
  "holdAction_rearm_ca.paa",       
  "holdAction_rearm_ca.paa",       
  "_this distance _target < 8",       
  "_caller distance _target < 8",       
  {player playMoveNow "AinvPknlMstpSnonWnonDnon_medic3"},      
  {},       
  {h1 setVehicleAmmo 1; hint "Vehicle rearmed";},       
  {player switchMove ""},       
  [],       
  10,       
  0,       
  false,       
  false       
 ] remoteExec ["BIS_fnc_holdActionAdd", 0, h1];    
     
 [       
  h1,       
  "Refuel",       
  "holdAction_refuel_ca.paa",       
  "holdAction_refuel_ca.paa",       
  "_this distance _target < 8",       
  "_caller distance _target < 8",       
  {player playMoveNow "AinvPknlMstpSnonWnonDnon_medic3"},      
  {},       
  {h1 setFuel 1; hint "Vehicle refueled";},       
  {player switchMove ""},       
  [],       
  10,       
  0,       
  false,       
  false       
 ] remoteExec ["BIS_fnc_holdActionAdd", 0, h1];

On Deactivation:

removeAllActions h1;

 

So it's pretty straightforward. The problem is, the action that gets added to the helo is added the amount of times that there are players on the server. That is, if I test it in my local MP I see them added once each (correct). If I launch the mission on a server, I see all three actions doubled (one for me and one for the server it seems), and when I entered with four other players the actions were added a total of six times each.

 

I may be forgetting something obvious, but I just want the action to be added to the vehicle once per type (one repair, one refuel, one rearm). Otherwise once you approach the vehicle it just spewes a crap tonne of actions listed in the scroll menu.

 

Thanks in advance for your help!

Share this post


Link to post
Share on other sites

@Dj Rolnik, trigger statements are local, i.e. they are executed by each client. At the same time you use remoteExec. It means that if the trigger condition is true, the code placed in "On activation" field is executed by each client. This leads to duplicating actions.

To solve the problem either make your trigger server only, or don't use remoteExec.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Schatten said:

@Dj Rolnik, trigger statements are local, i.e. they are executed by each client. At the same time you use remoteExec. It means that if the trigger condition is true, the code placed in "On activation" field is executed by each client. This leads to duplicating actions.

To solve the problem either make your trigger server only, or don't use remoteExec.

 

Ah yes, I guess I see now. I will probably remove the remoteExec but will mess around with it a little bit more and see how it goes.

Thanks man!

Share this post


Link to post
Share on other sites

You have another problem. What/who is h1? the player itself, a vehicle, a unit?

Share this post


Link to post
Share on other sites
7 hours ago, pierremgi said:

You have another problem. What/who is h1? the player itself, a vehicle, a unit?

 

The "h1" is just a variable name of the helo that is to land inside the trigger.

Share this post


Link to post
Share on other sites

Okay, confirmed that the removal of the remoteExec solved the problem. That was my bad. Thanks for the help!

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

×