Jump to content
Rebitaay

Triggers firing twice in one activation, only in multiplayer

Recommended Posts

Hi all,

 

Currently working on my second mission, and the multiplayer aspects of things are giving me a headache. I've crushed many bugs, but one that I can't seem to figure out is that many of my triggers are firing twice for one activation. This only happens in multiplayer with another player connected. For example: I have a trigger that detects when there are no OPFOR left, then spawns more. Occasionally, this ends up spawning 2x enemies or even 3x, rarely. Another example is I have a script that detects when there is no plane in a hangar and spawns a new plane, and it occasionally spawns two at once and everything goes to shit. 

 

I can upload the mission file if necessary. Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites

This sounds like a locality issue. Make sure that unit spawning is limited to the server-side only.

Limit script execution in MP using (eg) these commands, pretty self-explanatory:

Killzone_Kid has given a great explanatory sketch on how these work and what they mean:

if (isDedicated) then {
	//run on dedicated server only
};

if (isServer) then {
	//run on dedicated server or player host
};

if (hasInterface) then {
	//run on all player clients incl. player host
};

if (!isDedicated) then {
	//run on all player clients incl. player host and headless clients
};

if (!isServer) then {
	//run on all player clients incl. headless clients but not player host
};

if (!hasInterface) then {
	//run on headless clients and dedicated server
};

if (!hasInterface && !isDedicated) then {
	//run on headless clients only
};

 

Found some more resources:

 

Edited by Mokka
Added a few more references
  • Like 2

Share this post


Link to post
Share on other sites

@Mokka Great info, I'll give some of these a try and report back once I've tested it with a buddy. Thanks!

Share this post


Link to post
Share on other sites

In case you were wondering, you can join "yourself" twice. See below post for reference:

 

Share this post


Link to post
Share on other sites

Oh, wait. That's you, isn't it.........

  • Like 2

Share this post


Link to post
Share on other sites
1 minute ago, Mokka said:

Oh, wait. That's you, isn't it.........

Haha! I'm going to set that up eventually.

Share this post


Link to post
Share on other sites

are you placing the trigger in the editor or is it scripted? 

Share this post


Link to post
Share on other sites

You just have to run on server only (as far as you spawn units/vehicles and you don't have any headless client). So check that in a trigger edited or add if (isServer) then { your trigger here } in a script.

Share this post


Link to post
Share on other sites

@Mokka

Forgot to report back, whoops! Just wanted you to know that you're a beautiful bastard. The info you gave me made everything magically work.

Share this post


Link to post
Share on other sites

Don't thank me, thank the wonderful guys (and maybe gals) that keep the BIKI and surrounding resources alive and healthy.

I am just showing you the way, those people made it :)

  • Like 1

Share this post


Link to post
Share on other sites

The core information in this thread is that triggers are propagated through the network and fire on any connected machine. Therefore u have to handle it with things like isServer or isDedicated or hasInterface.

sent from mobile using Tapatalk

Share this post


Link to post
Share on other sites

Additionally there should be an additional option in triggers that limit execution on server side only

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

×