Global Message
Aug 2 2009, 12:31 pm
By: ImaGiNe.  

Aug 2 2009, 12:31 pm ImaGiNe. Post #1



Okay! I am having a problem having a text message displayed for five players saying that one or the other has died. My trigger is as follows:

Code
Trigger("Player 1","Player 2","Player 3","Player 4","Player 5"){
Conditions:
    Score("Player 1", Custom, Exactly, 1);
    Deaths("Player 1", "Left Upper Level Door", Exactly, 2);

Actions:
    Display Text Message(Always Display, "\x013\x008RED \x016has been killed!");
    Set Deaths("Player 1", "Left Upper Level Door", Set To, 0);
    Preserve Trigger();

Now whenever the player dies, he is given 1 custom score and has deaths set for LULD to 2. However when the conditions are met, only Player 1 can see his own death message. The other players simply do not see it. The same can be said for the rest of the other players. I even have a copy of the triggers in Force 1 (All human players are in it).

The map is running three sets of hyper triggers and nothing else that I know of would interrupt this message being displayed. If anyone can suggest a better way to display player death alerts globally, please suggest! Thanks in advance!



None.

Aug 2 2009, 1:06 pm JaFF Post #2



When dealing with problems like this it is often helpful to 'dry run' the triggers - imagine what will happen when the conditions are met (you may use pen and paper if you wish). Triggers set to a group of players are just copied amoung the specified players; in your case, the shown trigger will be owned by P1-5. Triggers run from P1 to P8, so when P1 dies, this trigger runs for him and sets the deaths of "Left Upper Level Door" back to 0. This trigger does not run for any other player because the cinditions are not met.

You need some variable/condition that will stay in the 'Player N has died' state for atleast one full trigger cycle to allow the message to be seen by everyone.

One possibility is to make a trigger for Force 1 that will set the deaths of some unit for the player that died to 2. Each trigger cycle subtract one from this death counter. When it hits 1, display the message. This will display the message one trigger cycle after a player has died, because if, say, P3 dies, you have to wait one tirgger cycle and then display the message. Otherwise it will be displayed only to P4 and P5 (the players whose triggers run after the triggers or P3).

Here is an example of such a method:

You have a trigger for Force 1 that detects the death conditions and sets the deaths of "Cantina" to 2 for the dead player.
Code
Trigger("Force 1"){
Conditions:
    Score("Current Player", Custom, Exactly, 1);
    Deaths("Current Player", "Left Upper Level Door", Exactly, 2);

Actions:
    Comment("");
    Preserve Trigger();
    Set Deaths("Current Player", "Cantina", Set To, 2);
}

//-----------------------------------------------------------------//


Then, for one of the computer players (P8 in this example), you make the following trigger that subtracts the "Cantina" death counter:
Code
Trigger("Player 8"){
Conditions:
    Always();

Actions:
    Comment("");
    Preserve Trigger();
    Set Deaths("Force 1", "Cantina", Subtract, 1);
}

//-----------------------------------------------------------------//


And finally, you have the set of these five triggers for Force 1 that display the death of other palyers:
Code
Trigger("Force 1"){
Conditions:
    Deaths("Player 1", "Cantina", Exactly, 1);
    Deaths("Current Player", "Cantina", Exactly, 0);

Actions:
    Comment("");
    Preserve Trigger();
    Display Text Message(Always Display, "P1 has died.");
}

//-----------------------------------------------------------------//

Trigger("Force 1"){
Conditions:
    Deaths("Player 2", "Cantina", Exactly, 1);
    Deaths("Current Player", "Cantina", Exactly, 0);

Actions:
    Comment("");
    Preserve Trigger();
    Display Text Message(Always Display, "P2 has died.");
}

//-----------------------------------------------------------------//

Trigger("Force 1"){
Conditions:
    Deaths("Player 3", "Cantina", Exactly, 1);
    Deaths("Current Player", "Cantina", Exactly, 0);

Actions:
    Comment("");
    Preserve Trigger();
    Display Text Message(Always Display, "P3 has died.");
}

//-----------------------------------------------------------------//

Trigger("Force 1"){
Conditions:
    Deaths("Player 4", "Cantina", Exactly, 1);
    Deaths("Current Player", "Cantina", Exactly, 0);

Actions:
    Comment("");
    Preserve Trigger();
    Display Text Message(Always Display, "P4 has died.");
}

//-----------------------------------------------------------------//

Trigger("Force 1"){
Conditions:
    Deaths("Player 5", "Cantina", Exactly, 1);
    Deaths("Current Player", "Cantina", Exactly, 0);

Actions:
    Comment("");
    Preserve Trigger();
    Display Text Message(Always Display, "P5 has died.");
}

//-----------------------------------------------------------------//


Note that it will not display the death message to the dead player himself because of the "Deaths("Current Player", "Cantina", Exactly, 0);" condition. If you want the player to see his own death message just like everyone else, remove that condition.

Post has been edited 4 time(s), last time on Aug 2 2009, 1:25 pm by JaFF.



None.

Aug 2 2009, 1:56 pm ImaGiNe. Post #3



I appreciate the reply Jaff. I tried using P6 with unused units as the variable before but I never took into consideration that two trigger cycles would be needed to display the message. I will go ahead and try out your suggestion and let you know if it does well!

Thanks again!

EDIT -

Works like a charm Jaff! I guess when I used a single death counter for P6, the trigger cycled over too quickly. Your trigger method worked like a charm.

Post has been edited 1 time(s), last time on Aug 2 2009, 4:35 pm by ImaGiNe..



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:20 pm]
anoeth47 -- Sweet
[07:48 pm]
NudeRaider -- https://staredit.net/381642/ really makes you appreciate (again) how good sc music is.
[2026-4-18. : 3:57 am]
NudeRaider -- https://staredit.net/381600/ You have 5 minutes, then you can only edit your posts.
[2026-4-17. : 4:05 pm]
NudeRaider -- DarkenedFantasies
DarkenedFantasies shouted: you eat lots of beans
:lol:
[2026-4-17. : 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
Please log in to shout.


Members Online: anoeth47, Rawflesh0615