Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: [SOLVED] Current Players
[SOLVED] Current Players
This topic is locked. You can no longer write replies here.
Oct 3 2012, 2:06 pm
By: FlameViper  

Oct 3 2012, 2:06 pm FlameViper Post #1

Having the players separated is good and all, but how do I make them work for multiple players, instead of just 1 ? Should I use Forces?
Does it matter how many conditions for specific players I put? Like the player which has 4 conditions will get the trigger applied only to him, instead of the other players who have fewer than 4.
Also how do I show the same text to specific players? Should I just create separate triggers for each, instead of trying to cram it all into one trigger?

Got any extra info on how they work?


Oct 3 2012, 2:19 pm Moose Post #2

When you give a player ownership of a trigger, that player will check all of the conditions individually and, if they are true, execute the actions individually. When you use "Current Player" in a trigger, it refers to the player who is checking and running the trigger. Players run the triggers in sequential order (1, 2, 3, ...) each time triggers are checked. Forces are a way of organizing, but do not change the order. (so if Player 1 is in Force 3, he will run Force 3's triggers with his own)

So, if you have a condition like "Player 4 accumulates at least 50 Ore" and the condition is true, but the trigger is owned by Players 1, 2, 3, and 4, Player 1 will run the trigger first and execute the actions. (and if it involves displaying text, he will be the only one to see it)

To have shared text messages, you would want to have the player running the trigger that causes text to appear for all have the action "Set Deaths" and set a death counter (of some unit that doesn't die in the map) set to some number for all players who are supposed to see the text. Then have a trigger for each player that should see the text have a "Deaths" condition based on that unit and number of deaths that displays the text and uses "Set Deaths" again to set the number of deaths to 0.

IE what you are doing (since the conditions of the trigger may no longer be true after the original trigger is run) is replacing the display text action with another action that tells each player to run a display text trigger.

Oct 3 2012, 6:02 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

Moose explained the basic concepts pretty well but I'll give some additional info.

First of all never make Current Player a trigger owner. In ScmDraft it is possible to give triggers to Current Player, but StarCraft would ignore the trigger because it doesn't make sense (in sc logic).
The only valid trigger owners are Player 1 through 8. You can give All Players or a force triggers but what that does (during runtime, when the map is played) is creating copies of the trigger for every player belonging to that group.
So you have 1 trigger owned by All Players and when the game starts there's human players 1-4 and a computer player 8. That means the 1 trigger will exist 5 times, one for each player, which is the same result as if you had ticked player 1 through 8 individually (or in that case because 3 players are missing, ticking P1-4 and P8 would've yielded the same result)

A word on the 3 trigger parts: Owner, conditions, and actions:

Owner just says who is going to run the trigger. A trigger may have multiple owners, but then the trigger will be executed multiple times. Keep that in mind when dealing with events that should create only 1 response.

Conditions will be checked from top to bottom until one returns false. Only if all conditions returned true the triggers will be executed. When the trigger is owned by another player that other player will wait with his trigger execution until all of the preceding player's triggers have been processed and then he'll check the conditions again. So when an action from P1's copy of the trigger invalidates the conditions P2 can't run the trigger even though they depend on the same conditions.

Once a trigger starts executing its actions it will execute all actions in sequence, even if one actions makes one or more of the conditions false.

To understand how it works for displaying text I shall make an example:

First an example that might be intuitive, but won't work:
  • Force 1
  • Conditions
  • Force 1 brings at least 1 [Hero] to 'Inn'
  • Actions
  • Move all [Hero] of Force 1 to 'Inside'
  • Display Text for Current Player "Hello Folks! ..."

  • It will move the group inside the Inn, but only the first player of the force will be shown the text because a display text actions is only working for the Current Player (the player who is currently running the trigger).
    Assuming Force 1 consists of P1, P2, P3 and P4, Player 1 will execute the trigger, because as Moose pointed out he's the one who gets to run their triggers first. In StarCraft there is no such thing as running a trigger at the same time. It's all processed in sequence.
    So P1 will teleport the group inside and receive their text. When it's P2's turn to execute their trigger there will no longer be a unit at the outskirts of the 'Inn' so he won't run the trigger and thus receives no text.

    To rectify the issue the standard technique is to seperate global actions (move all units) and current player actions (display text) and link them with a death counter:
  • Force 1
  • Conditions
  • Force 1 brings at least 1 [Hero] to 'Inn'
  • Actions
  • Move all [Hero] of Force 1 to 'Inside'
  • Set Deaths of Cantina to 1 for Force 1

  • Trigger
  • Force 1
  • Conditions
  • Current Player has suffered exactly 1 death of Cantina
  • Actions
  • Set deaths of Cantina for Current Player to 0
  • Display text for Current Player "Hello Folks! ..."

  • Not how I'm using Force 1 in the global trigger and Current Player in the current player trigger. Basically you have to keep in mind that when you're using Current Player you're only affecting 1 player of a group of players.
    Technically you wouldn't need Forces or Current Player, but it by using them you don't have to write 8 individual triggers when you want it to be the same for every player.

    Oct 3 2012, 6:33 pm Vrael Post #4

    Also, the information in this article you may find very useful:


      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [06:15 am]
    O)FaRTy1billion[MM] -- :wob:
    [06:03 am]
    Vrael -- :wob:
    [04:36 am]
    lil-Inferno -- :wob:
    [03:52 am]
    Apos -- :apos: :apos: :apos:
    [02:37 am]
    MTiger156 -- :wob: :spam1: :wob: :spam1: :wob: :spam1: :wob: :spam1: :wob: :spam1: :wob: :spam1: :wob: :spam1: :wob:
    [01:21 am]
    KrayZee -- :wtfawesome:
    [01:10 am]
    lil-Inferno -- :wob:
    [08:46 pm]
    MTiger156 -- :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t: :uberw00t:
    [08:30 pm]
    Vrael -- :cheers: :wob: :lock: :yahoo: :wob: :lock: :yahoo:
    [08:10 pm]
    NudeRaider -- :wob: :cheers: :yahoo: dance party!
    Please log in to shout.

    Members Online: Roy