Jump to content
Saltoperator

Am I triggering music for all players correctly?

Recommended Posts

In the Trigger:Effects section of a trigger I have placed down, I have chosen a track to be played once the trigger is activated with Activation set to Any player.

 

By my understanding, as long as Server only isn't ticked, the music should play for everyone. Or, do I need to use remoteExec?

 

 

Share this post


Link to post
Share on other sites
Posted (edited)

Hi, yes you're doing it correctly. As trigger placed in the editor is created on each client and then checks condition locally, activation any player will activate the trigger everywhere and the music selected in trigger effects starts playing. RemoteExec is not needed in this case. RemoteExec is used with commands that have local effect effects_local.gif and you know that condition can be activated only on one machine (like for an example, when you tick server only), but you want to run the command everywhere, or on specific machine. For more information about multiplayer scripting check this page: https://community.bistudio.com/wiki/Multiplayer_Scripting 
Also, welcome on the forum ! 🙂

 

Worth to mention. Simple trigger like this might trigger again for JIP players, when they join after trigger has been activated, because for them trigger has not been activated yet. Music will then trigger only for them and other JIP players that joined later. If that is an issue then server only trigger and remote executing the music might be a solution. Also can be fixed by adding a variable to the condition, but then the trigger will be checking for nothing (for JIP players). I had to quickly check how the trigger behaves in that situation, so i noticed that behaviour.

Edited by soldierXXXX
  • Like 1

Share this post


Link to post
Share on other sites

@soldierXXXX Thanks for your warm welcome, and detailed response.

 

I suppose a simple:

deleteVehicle this;

... at the end of the On Activation field in the trigger itself won't suffice here? The trigger will still be respawned locally for the JIP player?

Share this post


Link to post
Share on other sites

Well, deleteVehicle is a global effect effects_global.gif so that means every change that is run with these commands (like setDamage) will be automatically broadcast across all machines, including JIP clients. When client connects to the server, his machine asks the server for all object states, all publicVariabled variables and possibly other stuff and the server sends the latest informations of the object that is known so you can see it properly in the game. So when you connect to the server after the command is run, for you the object will also be deleted.
I believe to properly target the trigger you should use thisTrigger as this refers to the condition of the trigger.

deleteVehicle thisTrigger;

This will be probably the most efficient way to handle that 🙂.

  • 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

×