Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Squirtman

Are triggers created in editor local or global?

Recommended Posts

As the title states I was wondering if the triggers created in the editor are local or global. Also is there a way to make the trigger be the opposite of it's default within the editor.

I know you can specify whether you want a trigger to be local or global when using createTrigger.

 

Thanks in advance for your assitance.

Share this post


Link to post
Share on other sites

Triggers in editor are global. To make a trigger local you'd have to create one. Eg:

Place a gamelogic and in the init field:

_trg = createTrigger ["EmptyDetector", getPos this, false];
_trg setTriggerActivation ........ // and so on

 

Share this post


Link to post
Share on other sites

I'll also add that while "global" triggers are indeed created on each machine their states can vary from client to client. Example: trigger with condition "player in thisList" will only activate when THE player enters.

 

Think of a global trigger as lots of network copies rather than a single entity. 

Share this post


Link to post
Share on other sites

Triggers are not really global, just as mrcurry explained. They are local to each client and the server. That means, if one client fulfills the condition of a trigger, the code will be executed locally on the client. The triggers on the other clients will still wait for their condition to return true. If the commands in the on Act.-field have global effect, they can pretty much mess up your whole mission - think of 5 clients who fulfill the same condition at the same time -> the trigger will execute the global command five times.

The makeGlobal parameter in createTrigger only creates copies of the trigger on all clients and the server.

You can however nowadays set triggers to be server only in the editor - this way they are local to the server only and the code, if the condition is fulfilled, will only be executed locally on the server.

If you ask if a trigger can "be the opposite of it's default within the editor.", do you mean the condition of the trigger or it's locality?

Share this post


Link to post
Share on other sites

Then, you can script for some project like: "marking the position of a player triggering a "radio Alpha" ".

Share this post


Link to post
Share on other sites

Thank you for your answers people. it's is much appreciated and helps a lot .

 

On 5/14/2017 at 5:47 PM, belbo said:

You can however nowadays set triggers to be server only in the editor - this way they are local to the server only and the code, if the condition is fulfilled, will only be executed locally on the server.

If you ask if a trigger can "be the opposite of it's default within the editor.", do you mean the condition of the trigger or it's locality?

 

I was referring to locality however all the information provided has answered my questions.

Share this post


Link to post
Share on other sites

They aren't global, but they are local to everyone. :)

PS, I'm not helping, am I?

  • Haha 1

Share this post


Link to post
Share on other sites

×