• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Noobish variable related problem

Status
Not open for further replies.
Level 3
Joined
Oct 6, 2007
Messages
43
Well, I'm making a tower defense map where i got 15 lives for every player, but when I am trying to create a trigger that player loses when his lives hit zero, I can't find anything to make like "Variable reaches 0" option there, expect one. But it allowed only Real type variables.
 
Level 18
Joined
Nov 1, 2006
Messages
1,612
Why don't you just do

Event - A Unit Dies (or whatever the event is that causes 1 Life to be taken away)

Conditions - Your conditions for the Unit that when it dies will subtract one Life from the Player.

Actions - If Owner of (Triggering Unit) = Player 1(Red) then Set LivesRed = LivesRed - 1
Else - If Owner of (Trigger Unit) = Player 2(Blue) then Set LivesBlue = LivesBlue - 1 (etc...etc...)
If LivesRed = 0 then defeat Player 1(Red) Else -
If LivesBlue = 0 then defeat Player 2(Blue) Else -
etc.
 
Here is a trigger

Try this:

  • Events
    • Unit - A unit enters (rengion were, when the unit gets there, the player loses a live(for player 1 - one region, for player 2 anader region, or for all players one region))
  • Conditions
    • (Owner of (Triggering unit)) Equal to (player who controls the creeps)
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Lives Equal to 0
      • Then - Actions
        • Game - Defeat (player who lost a live) whit the massage: Type samethink
      • Else - Actions
        • Set Lives = (Lives - 1)
I can make the trigger take more lives for bosses.
If you have any questions comment.
 
Level 18
Joined
Nov 1, 2006
Messages
1,612
Dark, your trigger will not work, for it subtracts the life after it checks to see if Lives = 0. Here is the correct version;

  • Events
    • Unit - A Unit Dies
  • Conditions
    • Your specific conditions go here (Like Owner of Triggering Unit, etc.)
  • Actions
    • Set Lives = (Lives) - (1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Lives Equal to 0
      • Then - Actions
        • Game - Defeat (Owner of Triggering Unit) with the message: You Lose!
      • Else - Actions
 
Status
Not open for further replies.
Top