
We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
Well, for starters it's just how triggers work in starcraft. They have 3 parts: Player, Condition and Action.
The player among others determines in what order the triggers are executed. First all triggers of P1 are executed then all of P2, etc.
In the example you chose, the trigger owner does not matter as long it's only one and active. However there's different examples where it's important.
I don't know the reasons why Blizzard did it the way they did, but there's some things about it that make sense:
For some systems it's useful when they scale up with the number of players that are currently playing.
For example in a defense map:
Force 1
(the human players)C: Countdown timer = 0 (
arbitrary condition)A: Create x units for P8
(computer enemy)This trigger automatically spawns more units if more players are on the map, because for every active player in Force 1 Starcraft creates a copy of this trigger and runs it individually.
Non-present players cannot own triggers / StarCraft doesn't create copies for them.
Be aware that this behavior can also quickly lead to bugs:
(warning, buggy trigger following, don't copy)Force 1
(the human players)C: Always
(arbitrary condition)A: Create 1 Hero Unit for P1
A: Create 1 Hero Unit for P2
A: Create 1 Hero Unit for P3
Now let's assume 2 players are playing this map, this trigger creates 2 units for P1, P2
AND P3 even thought he isn't even playing. These units belong to P3, but nobody controls them, not even a computer. We call this phenomenon ghost players. The other bad side effect is that the more players play, the more units get created per player, because every player has his own copy and creates units for all 3 players.
Here's how to setup this trigger correctly:Force 1
(the human players)C: Always
(arbitrary condition)A: Create 1 Hero Unit for Current Player
The first thing you notice is that this trigger is considerably shorter. It also uses the "Current Player" you mentioned. That's where the Current Player / Ownership part of a trigger shines. It simplifies mapping and helps organizing.
Now on to what exactly happens:
Again Starcraft creates a copy of this trigger for every active player of Force 1. The same time it replaces Current Player with the specific player number of the player that owns the copy. The triggers will look like this:
P1
C: Always
(arbitrary condition)A: Create 1 Hero Unit for P1
(... for all active players of the force. you don't see that in the editor, but that's what sc does with the trigger during runtime)Now you should be able to answer your own question. Current Player is always the player who is currently running (his copy of) the trigger.
And no, Current Player is never replaced with another player that might have a true condition if they were standing there. Makes sense because for that StarCraft would have to cross check every condition with all other players, thus making specific triggers impossible. No, triggers only do what they are told.
And as a sidenote, if you want to check for units of P12 (Neutral) = leaver, then you have to choose one of P1-8 as owner of the trigger because only P1-8, Forces and All Players can execute/own triggers. Forget all other trigger owners like Foes, Unknown, Current Player, etc. those will just be ignored.
And in the condition check for [any unit] of Neutral.
Last but not least a specific answer to your other example. (You could already figure it from what I said before, but some people learn better from examples.)
player: current player -who is the current player refering to?
conditions: current player gets five marines
action: current player gains 50 mins -who does the action work for?
player: is
invalid. The trigger would be ignored, you have to set one of P1-8, Force or All Players.
action: this action works for every active player who's owning the trigger (player tab).
Hope that helps. If there's still questions left, don't hesitate to reply.
P.S. Sorry for lenghty post, but I wanted to make sure I cover everything in an understandable manner with examples.
Post has been edited 1 time(s), last time on Apr 24 2009, 12:14 am by NudeRaider.