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

We live in a society.

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.
    [06:51 pm]
    Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
    [06:50 pm]
    NudeRaider -- Vrael
    Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
    sounds like moisture control is often a pressing concern in your city
    [06:50 pm]
    Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
    [06:49 pm]
    Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
    [06:48 pm]
    Vrael -- On this Topic, I could definitely use some Introductions.
    [06:48 pm]
    Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
    [06:47 pm]
    Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
    [06:45 pm]
    NudeRaider -- Vrael
    Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
    beats me, but I'd make sure to pick the epitome of excellence and nothing less.
    [06:41 pm]
    Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
    [06:38 pm]
    Vrael -- I need a go-to solution and someone who understands that Carpets are more than just decorative elements in my home.
    Please log in to shout.


    Members Online: Roy, Vrael, NudeRaider