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?



None.

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:
Trigger
Players
  • 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:
    Trigger
    Players
  • 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
    Players
  • 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: http://www.staredit.net/starcraft/Triggers



    None.

    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [07:15 am]
    IlyaSnopchenko -- Or was it a switch :)
    [06:59 am]
    IlyaSnopchenko -- But I need to do more work on the system to make it look better (hard to explain without showing the map and explaining precisely what i added them for)
    [06:57 am]
    IlyaSnopchenko -- I've added set death hypertriggers
    [2019-8-25. : 4:02 am]
    Pr0nogo -- single frame hypers with a simple line of code without using EUDs imo
    [2019-8-24. : 11:01 pm]
    Suicidal Insanity -- They never go to bed on time
    [2019-8-24. : 9:49 pm]
    NudeRaider -- But why would you even want to do that? Hypers have almost no downsides.
    [2019-8-24. : 9:49 pm]
    NudeRaider -- IlyaSnopchenko
    IlyaSnopchenko shouted: A stupid question: can I run hypertriggers for just one phase in the map, not all of it (I know I can... just wanting to know if there are any caveats)
    you can, but you'd need to run switched hypers. Classic hypers can't be stopped afaik.
    [2019-8-24. : 4:42 pm]
    TF- -- It should be fine
    [2019-8-24. : 3:41 pm]
    IlyaSnopchenko -- Is that a yea or nay? :)))
    [2019-8-24. : 3:36 pm]
    TF- -- 🤙🏾
    Please log in to shout.


    Members Online: Roy, BeatMeistro