Jump to content

[Solved] remoteExec script duplication on dedicated server

Recommended Posts

Hello there kind people of the BI forums!

I need some help with remote execution of a script that is leading to duplication on a dedicated server. I've probably been trying to solve this for a few days now and I've finally hit a wall.


I have a script, that just gets a character called fan1 to say a voice line using say3D, and some text to appear in sideChat. I have the script - called fan2.sqf set up as follows:


systemChat "fan2 executed correctly"; // just a debug thing I will remove to check that the script has been firing correctly

fan1 say3D ["mjrkean", 50, 1, true, 0]; // say3D from position of fan1 with ogg and relevant lip file
fan1chat sideChat "Hey! Major Kean is just downstairs and to the left - he's expecting you."; // show sideChat from HQ entity with the variable name fan1chat

The sound files and everything work fine, and I want this to be executed when a player walks into a trigger, and as such I have a simple trigger in the editor that is set to:

Any Player

Not Repeatable

Not Server only
Condition: this

On Activation: ["fan2.sqf"] remoteExec ["execVM", -2, true];

My thinking was that, both say3D and sideChat have local effects if I am correct, so by executing this on all clients (excluding the server as it's not necessary(?)) with remoteExec targeted with -2, it should work. However, I am running into an issue where both the say3D and sideChat are seemingly duplicated in a locally hosted multiplayer server, and on my dedicated server. Am I missing something obvious here?


Appreciate any help 😄

Share this post

Link to post
Share on other sites

So, I found a solution (of course it would come a few hours after deciding to post on the forums🙄) and figured it was worth updating this just in case anyone else has similar issues:

I had to set the triggers that were waiting for player activation to "server only" with a remoteExec target of 0.


I assume there is something I dont know about triggers propogating their activations across multiple clients if this setting isn't ticked. I get the feeling that this fix essentially forces the server to be the machine to evaluate the conditions and then run the remoteExec, rather than the activating player who would then get both runs of the script as the "activating machine". Or not, I'm still not entirely sure about triggers and locality in this circumstance...


Hope this helps someone somewhere at some point!

Share this post

Link to post
Share on other sites

Without server only ticked on, the trigger will fire on each machine when any player enters the area. Note that it will fire whenever *any* player enters the area, not just *the* player that is controlled by you. So this should work the same way if you kept server only switched off and got rid of remoteExec.

  • Like 1

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