• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Chance lost

Status
Not open for further replies.
Level 5
Joined
Jul 25, 2008
Messages
155
Hey, I am making a hero defense, and I want to give each team 60 chances, if their chances reach 0, they get defeated. My triggeres for the chances looks like this:

  • initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Quest - Create a Optional quest titled Credits with the description Fried.Chicken made ..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Game - Display to (All players) the text: The first wave will...
      • Player - Add 100 to Player 1 (Red) Current gold
      • Player - Add 100 to Player 2 (Blue) Current gold
      • Player - Add 100 to Player 3 (Teal) Current gold
      • Player - Add 100 to Player 4 (Purple) Current gold
      • Player - Add 100 to Player 6 (Orange) Current gold
      • Player - Add 100 to Player 7 (Green) Current gold
      • Player - Add 100 to Player 8 (Pink) Current gold
      • Player - Add 100 to Player 9 (Gray) Current gold
      • Player - Add 100 to Player 10 (Light Blue) Current gold
      • Player - Add 100 to Player 11 (Dark Green) Current gold
      • Set Chance[100] = 100
      • Set Chancy[100] = 100
  • Team 1
    • Events
      • Unit - A unit enters End Loc <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) controller) Equal to (Player 6 (Orange) controller)
        • Then - Actions
          • Set Chance[1] = (Chance[1] - 1)
          • Game - Display to (All players) the text: Team 1 has lost one...
        • Else - Actions
and the trigger above looks the same for chancy
Now I was wondering how to make team 1/2 get defeated when their chances reach zero, could anyone give me some hint?
 
Last edited:
Level 4
Joined
Jul 24, 2008
Messages
108
Dont use an array, Chance[100] is totally different then Chance[1]
Set Chance = 100
then Set Chance = Chance - 1
 
Level 4
Joined
Jul 24, 2008
Messages
108
Dont even bother with the array, get rid of it and just use a single variable. What you are doing is sorta like this

Set Chance = 100

then if your other trigger doing

Set lol = lol - 1

and then wondering why it doesn't work. This was a bit exagerated but its the same thing. Arrays can be a bit misleading like that because the names are close and just off by a number. For what you are using the variable for, you don't need arrays.
But to answer your question, if both variables use the [1] suffix, yes it will work, but again there is no point in the array.
 
Level 5
Joined
Jul 25, 2008
Messages
155
Like this then:
  • initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Quest - Create a Optional quest titled Credits with the description Fried.Chicken made ..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Game - Display to (All players) the text: The first wave will...
      • Player - Add 100 to Player 1 (Red) Current gold
      • Player - Add 100 to Player 2 (Blue) Current gold
      • Player - Add 100 to Player 3 (Teal) Current gold
      • Player - Add 100 to Player 4 (Purple) Current gold
      • Player - Add 100 to Player 6 (Orange) Current gold
      • Player - Add 100 to Player 7 (Green) Current gold
      • Player - Add 100 to Player 8 (Pink) Current gold
      • Player - Add 100 to Player 9 (Gray) Current gold
      • Player - Add 100 to Player 10 (Light Blue) Current gold
      • Player - Add 100 to Player 11 (Dark Green) Current gold
      • Set Chance = 100
      • Set Chancy = 100
  • Team 1
    • Events
      • Unit - A unit enters End Loc <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) controller) Equal to (Player 6 (Orange) controller)
        • Then - Actions
          • Set Chance = (Chance - 1)
          • Game - Display to (All players) the text: Team 1 has lost one...
        • Else - Actions
Now how do I do so when the chance/chancy reaches 0 the team 1/2 loses?
I tried to do this: Game - Value of Real Variable but I can't add in any variables, because it can't find any of that type
I use my chance/chancy as integers with 0 array
 
Level 4
Joined
Jul 24, 2008
Messages
108
there are a few ways. In addition to loosing a life, in the second trigger In the Then actions, create another if then else, saying if Chance = 0 end game in defeat.

You can also create a periodic timer that checks the value of Chance and if its 0 loose.

Or you can change Chance into a real and you can use the event saying that if a real variable gets to 0, end game in defeat
 
Level 5
Joined
Jul 25, 2008
Messages
155
  • chance
    • Events
      • Game - Chance becomes Equal to 0.00
    • Conditions
    • Actions
      • Game - Defeat Player 1 (Red) with the message: You have lost!
      • Game - Defeat Player 2 (Blue) with the message: You have lost!
      • Game - Defeat Player 3 (Teal) with the message: You have lost!
      • Game - Defeat Player 4 (Purple) with the message: You have lost!
      • Game - Defeat Player 5 (Yellow) with the message: You have lost!
      • Game - Victory Player 7 (Green) (Show dialogs, Show scores)
      • Game - Victory Player 8 (Pink) (Show dialogs, Show scores)
      • Game - Victory Player 9 (Gray) (Show dialogs, Show scores)
      • Game - Victory Player 10 (Light Blue) (Show dialogs, Show scores)
      • Game - Victory Player 11 (Dark Green) (Show dialogs, Show scores)
like this then ^^ i did the last thing you said, since i didnt understand the other ones
 
Status
Not open for further replies.
Top