Jump to content
Sign in to follow this  
Doolittle

Trigger executed where?

Recommended Posts

If I had a trigger that damaged anyone who entered it, wouldn't it only be necessary to have it running on the server... and not on the clients??

If everyone (server and client) is "running" the trigger, won't everyone "damage" anything entering that zone? So it would be best to check for isServer in the trigger line, right?

Share this post


Link to post
Share on other sites

Requirements: A gamelogic named "Server"

on condition: this AND Server

But for the purpose you stated, wont do, because it would only run on server and not affect the clients... wich is what you dont want to do. So.. go ahead and try it, but i dont think thats the way to go.

Other possible solution is by setting on condition field: this AND Payer

"Player" is always local. The trigger would run on clients and not on server

Share this post


Link to post
Share on other sites
If I had a trigger that damaged anyone who entered it, wouldn't it only be necessary to have it running on the server... and not on the clients??

If everyone (server and client) is "running" the trigger, won't everyone "damage" anything entering that zone? So it would be best to check for isServer in the trigger line, right?

It depends. The setDammage command has global effects so yes, it only needs to be used once from anywhere. If you're using a setDammage and a fixed value (and not adding to the unit's current damage) then it wouldn't matter who's running it. Otherwise (if you are using getDammage), yes, technically it is best to use isServer so the trigger only activates on the server. However, it's very likely that even then it wouldn't have any noticible effect if everyone executes it. I suggest you test both conditions with other clients in MP just for confirmation.

Share this post


Link to post
Share on other sites

Doolittle, the best way to acheive what you want is to first understand that a trigger exists on each client machine (including server). So if you have 5 players and 1 ded server you have 6 triggers. The reason triggers seem to have "global" effect even though they are not truly "global" is because the conditions are usually true on all machines.

So if player A enters zone.. then all 6 triggers fire at once because "Anyone" has entered the zone. Thus, you get 6x the "setdamage" effect on Player A.

On the other hand, if you you could somehow set the condition to "Player is present" than any player that walks into the zone will only have his trigger fire because the condition is true only on his machine. Thus, you only get one effect. However, since you cannot directly do that, the method above is easiest (limit to one trigger via "IsServer" command).

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
Sign in to follow this  

×