Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: simple question, but not for me
simple question, but not for me
Apr 23 2009, 10:51 pm
By: Rezolve  

Apr 23 2009, 10:51 pm Rezolve Post #1



how does whole player thing work? (when you first create a new trigger) it asks you to select a player the trigger should execute for. I don't get how that even matters. For eg. if i set it as:
player: player six
conditions: player one gets five marines
action: player two gains 50 mins

i just don't see the point of setting players..

ok, my ssecond and last question, how is current player used?
for eg.
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?

and

player: player six
conditions: current player gets five marines -same question here, does current player mean player six, or any player to have that condition met?
action: player two gains 50 mins

ok thx you guys



None.

Apr 23 2009, 11:36 pm samsizzle Post #2



Current player is the player that you selected when you first go to make a trigger.



None.

Apr 23 2009, 11:53 pm NudeRaider Post #3

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.)
Quote
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.




Apr 24 2009, 1:31 am Rezolve Post #4



Wow man thanks so much, that really really helpful. wasn't lengthy at all. Regarding the order the triggers are executed thing, is the delay between players signifigant?



None.

Apr 24 2009, 1:38 am Falkoner Post #5



There is no visible delay, the real difference is the order, they don't run at the same time, one runs first, then the other, but it's done so fast that to the player it might as well be instantaneous.



None.

Apr 24 2009, 2:44 am NudeRaider Post #6

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

To add to what Falk said:
StarCraft is divided into frames. Every frame is about 42ms real-time. In the time between these frames StarCraft does all the necessary calculations for the next frame. So after a frame where the triggers are checked (every 2nd frame with hyper triggers, every 32nd frame on normal trigger checking speed) StarCraft processes all triggers in their given order. This takes real time, but no game time is passing.

Normally the calculations are done before the next scheduled frame (42ms have passed) but when you got thousands of triggers then the cpu might not be done in time and the game starts to lag. This is commonly known as trigger lag. However this does NOT disturb the correct functioning of the map/triggers. StarCraft will simply wait with drawing the next frame until all calculations are done.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:57 am]
NudeRaider -- https://staredit.net/381600/ You have 5 minutes, then you can only edit your posts.
[04:05 pm]
NudeRaider -- DarkenedFantasies
DarkenedFantasies shouted: you eat lots of beans
:lol:
[11:30 am]
NudeRaider -- I would like 3000 minerals, please
[2026-4-16. : 7:32 pm]
Zoan -- I got $2000 bonus. I would like 2000 minerals, please
[2026-4-16. : 4:15 am]
DarkenedFantasies -- you eat lots of beans
[2026-4-16. : 3:46 am]
IskatuMesk -- how do i get gas
[2026-4-15. : 11:43 pm]
Moose -- you don't
[2026-4-15. : 10:06 pm]
Zoan -- how do i get minerals
[2026-4-14. : 11:45 pm]
ClansAreForGays -- Anyone wanna played Skewed StarCraft?
[2026-4-14. : 12:07 am]
Vrael -- NudeRaider
NudeRaider shouted: Vrael ranting still is though
you're a gentleman and a scholar, thank you
Please log in to shout.


Members Online: anoeth47