Staredit Network

Staredit Network -> UMS Assistance -> Trigger order
Report, edit, etc...Posted by in_a_biskit on 2005-03-26 at 07:23:41
I understand that for any one player, triggers are read from top to bottom (as they appear in staredit), but their actions can overlap if a wait action or a transmission occurs. But I still have a few questions.

If a players triggers are distributed between, say, Player 1, Force 1, and All Players, are the triggers read in the order that you made them? Are they read from Player 1's list, then from Force 1, then from All Players? (I think the former is true as long as you don't move the triggers up and down)

If there are 2 players with trigger lists, are both lists read at the same time? Or are all of Player 1's triggers read first, before Player 2's triggers?
So if I have a system for all players that randomises a switch, then checks the state of that switch, must every player get the same result? If the triggers are read one player at a time, then they could get different results. If they're read at the same time, then all of them will see the switch at the same time and therefore will get the same result.

Maybe different players' triggers are read in the order that they are made (or moved into).
Report, edit, etc...Posted by Mini Moose 2707 on 2005-03-26 at 11:01:47
Triggers are executed in the order of Players, All Players, Forces. They go in terms of numbers. If you're doing a random switch, and want all players to get the same result, have ONE player run the randomization. If you want them all to get different results, have each of them run it.

» Moved to Assistance
Report, edit, etc...Posted by chuiu on 2005-03-26 at 11:24:14
If you really want to see which trigger runs first open the map up in SCMD2-->TridEdit.
Report, edit, etc...Posted by (U)Bolt_Head on 2005-03-26 at 13:54:29
QUOTE(Mini Moose 2707 @ Mar 26 2005, 10:01 AM)
Triggers are executed in the order of Players, All Players, Forces. They go in terms of numbers. If you're doing a random switch, and want all players to get the same result, have ONE player run the randomization. If you want them all to get different results, have each of them run it.
[right][snapback]172979[/snapback][/right]


Mini Moose i'll say the same thing that i said to Trigger Master yesterday.
Triggers are not exicuted from Player 1 - Force 4.
There only exicuted Players 1-8. All Players And Force 1-4 are not players, and they do not run triggers.



If a trigger is owned by a group (A force or All Players), It will react the EXACT same way that trigger would if it was copied to each of the players in that group.

This is my favorite saying, because it is so true and applies to everything. When you have a trigger owned by a group you don’t just have one trigger, you have a trigger for each player in that group this means those triggers will fire for each player in that group and with that players triggers.

For a simple answer to your questions here they are. Regarding group owned triggers triggers are executed in the order that they are created. (however moving triggers up and down can change this order). Here is a easy way to find determine this.
-Create A trigger for player 1 that displays text LINE ONE
-Create A trigger for All Players that displays text LINE TWO
-Create A trigger for player 1 that displays text LINE THREE
If you run this in star craft you will see Line 1 2 3 in order. But you can also alter this order many times without even realizing it. Try this Move Line 1 trigger below line 3 then move 3 below 1. Results in 213 because now lines 1 and 3 are after 2 in trigger order.
Groups almost have a form of invisible trigger order (this is why I hate them). But you can still figure it out. To change it the way you want or see the way it will fire change the ownership of line 2 to Player 1 (or all the players that apply). You will then see trigger 2 between triggers 1 and 3 (assuming you didn’t do the test I listed). You can then move it to the place you want and move the trigger back to the same force. The triggers will look the exact same but they will fire in a different order now.

Second Question. Group owned triggers are fired with all the other players triggers. So if you have a crap load of triggers for player 1 and player 2. And you have one trigger owned by force 1 (p1 and 2) then it will fire like this. Player 1s triggers (force trigger will be in the proper ‘hidden’ order. Followed by Player 2s trigger with the force trigger in most likely the same place.
Trigger order is read player 1 2 3 4 5 6 7 8. Group triggers are woven in there with the rest.

Third Question about randomize: It really depends. I could do it both ways but most likely you would get a different result for each player. If you had the following each player would get there own random answer.
Trigger
Players:
¤ All Players
Conditions:
¤ Always
Actions:
¤ Randomize Switch 1

Trigger
Players:All Players
Conditions:
¤ Switch 1 is set
Actions:
¤ Actions

All the triggers would fire completely for player one then they would all fire for player 2 and so on.

Anyway to make a set of triggers to give all players the same random result (but appear to not do that is difficult) But here is how it could be done.
Trigger
Players:
¤ All Players
Conditions:
¤ Switch Randomization is Clear
Actions:
¤ Randomize Switch 1
¤ Set Switch Randomization.

Trigger
Players:All Players
Conditions:
¤ Switch 1 is set
¤ Switch Randomization is Set
Actions:
¤ Actions (not clearing Switch Randomization)

Now since switches are global this would cause a ‘bug’ that most people would be confused about. When the randomization trigger runs for player 1 it would randomize the switch AND set the randomization switch. It would be followed directly by player 1 receiving a result. BUT since the randomization switch isn’t reset in the actions then player 2’s First trigger will not fire because the conditions are no longer true so Player 2 would continue to get the same results as player 1 and so on for all the players.

This isn’t necessarily a trigger order problem because the randomize trigger is checked before the other players check to see what the random state is. This is a problem with the map creator not realizing that a group owned trigger is multiple triggers that fire at different times. Some times you will see bound maps have a error similar to this. Ever play a bound map and a level gets restarted after someone else trys to catch up from way behind? This happens because the creator unknowingly set up the end of level trigger to run independently for each player.

Its really hard to explain and I’ve spent TONS of time trying to get people to understand how group owned triggers work and still many of them fail to understand.
Report, edit, etc...Posted by in_a_biskit on 2005-03-26 at 21:56:33
Thanks Bolt, that was very well explained. thumbup.gif biggrin.gif

BoltEdit: Removed spam notice, because I deleted the spam.
Report, edit, etc...Posted by sckor on 2005-03-26 at 23:10:01
So you have a randomize switch for player 4.
YOu have both clear and set effects for all players.

So player 1,2,3,4 (depending whether the randomize switch is below or above Player 4's switch effects) would have the cleared effects.
And 5678 would have the effects of the randomized switches?
Report, edit, etc...Posted by (U)Bolt_Head on 2005-03-27 at 02:45:13
sckor: That doesn't make any since, it looks like you read my post but compleatly missunderstood it and started making incorrect assumptions.

I'm not even saying anything about proper randomization technique anyways, just using it as an example of a way things can happen.
Report, edit, etc...Posted by in_a_biskit on 2005-03-27 at 08:36:29
What sckor is asking is this:

Trigger
Players:
¤ player 4
Conditions:
¤ always
Actions:
¤ randomise switch 1

Trigger
Players:
¤ all players
Conditions:
¤ switch 1 is cleared
¤ custom score for current player is at most 0
Actions:
¤ Action 1
¤ add 1 to custom score for current player

Trigger
Players:
¤ all players
Conditions:
¤ switch 1 is set
¤ custom score for current player is at most 0
Actions:
¤ Action 2
¤ add 1 to custom score for current player


This set of triggers, since they are read through players 1-8 one at a time, will result in:
  • Players 1-3 will always receive action 1, because their triggers are read before the randomisation occurs.
  • Players 4-8 can recieve either action 1 or action 2 randomly, but in any one game they will all get the same action.

And I think that's right, given what you've said about trigger order between players.



Another question: If you have a wait action/transmission, it will run the other triggers (this is the basis of hypertriggers). Do you know where it begins reading from? Does it start from the next trigger down on the list, or does it go back to the top again?
Report, edit, etc...Posted by (U)Bolt_Head on 2005-03-27 at 14:50:20
It will start reading from the very next trigger. It will compleat the list though player 8 then start up at Player 1 again with no pause and go all the way up to the previous trigger.
Next Page (1)