• 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.

Why is this Trigger not working?

Status
Not open for further replies.
Level 7
Joined
Jul 20, 2009
Messages
295
  • Level Up
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Unit-type of (Leveling Hero)) Not equal to Backpack
    • Actions
      • Unit - Set life of (Leveling Hero) to 100.00%
      • Set Upgrade_Level_Hero[1] = 0
      • Set Upgrade_Level_Hero[2] = 0
      • Set Upgrade_Level_PlayersNumber[1] = 0
      • Set Upgrade_Level_PlayersNumber[2] = 0
      • Game - Display to (All players) the text: (Upgrade[1]: + (String(Upgrade_Level[1])))
      • Game - Display to (All players) the text: (Upgrade[2]: + (String(Upgrade_Level[2])))
      • For each (Integer NOW) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(NOW)) is an ally of Player 1 (Red)) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player(NOW)) controller) Not equal to Computer
                  • ((Player(NOW)) slot status) Equal to Is playing
                • Then - Actions
                  • Set Upgrade_Level_Hero[1] = (Upgrade_Level_Hero[1] + (Hero level of Hero[(Player number of (Player(NOW)))]))
                  • Set Upgrade_Level_PlayersNumber[1] = (Upgrade_Level_PlayersNumber[1] + 1)
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player(NOW)) controller) Not equal to Computer
                  • ((Player(NOW)) slot status) Equal to Is playing
                • Then - Actions
                  • Set Upgrade_Level_Hero[2] = (Upgrade_Level_Hero[2] + (Hero level of Hero[(Player number of (Player(NOW)))]))
                  • Set Upgrade_Level_PlayersNumber[2] = (Upgrade_Level_PlayersNumber[2] + 1)
                • Else - Actions
      • Set Upgrade_Level[1] = ((Upgrade_Level_Hero[1] / Upgrade_Level_PlayersNumber[1]) / 5)
      • Set Upgrade_Level[2] = ((Upgrade_Level_Hero[2] / Upgrade_Level_PlayersNumber[2]) / 5)
      • Game - Display to (All players) the text: (Upgrade[1]: + (String(Upgrade_Level[1])))
      • Player - Set the current research level of DMG Increase to Upgrade_Level[1] for Player 12 (Brown)
      • Player - Set the current research level of DEF Increase to Upgrade_Level[1] for Player 12 (Brown)
      • Player - Set the current research level of HP Increase (Captain) to Upgrade_Level[1] for Player 12 (Brown)
      • Player - Set the current research level of HP Increase (Pikeman) to Upgrade_Level[1] for Player 12 (Brown)
      • Player - Set the current research level of HP Increase (Bowman) to Upgrade_Level[1] for Player 12 (Brown)
      • Game - Display to (All players) the text: (Upgrade[2]: + (String(Upgrade_Level[2])))
The last 2 Game Messages do not show nor does the Researches increase in level for some weird reason...

In other words, anything below:
  • Set Upgrade_Level[1] = ((Upgrade_Level_Hero[1] / Upgrade_Level_PlayersNumber[1]) / 5)
  • Set Upgrade_Level[2] = ((Upgrade_Level_Hero[2] / Upgrade_Level_PlayersNumber[2]) / 5)
Do not work, please help.
 
Level 7
Joined
Jul 20, 2009
Messages
295
Try displaying Upgrade_Level_Hero[1] and Upgrade_Level_PlayersNumber[1] before setting the upgrade levels. It could be a division by zero, which terminates the trigger.

I have put the Game Messages to see where is the problem and why is the researches arn't increasing in lvl when my hero lvls up, anything below those 2 triggers would not work whatso ever. After this thing works, I'm gonna remove all the Game Messages.

Edit: I didn't understand what you meant? :p
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Game - Display to (All players) the text: (Upgrade_Level_Hero[1])
  • Game - Display to (All players) the text: (Upgrade_Level_Hero[2])
  • Game - Display to (All players) the text: (Upgrade_Level_PlayersNumber[1])
  • Game - Display to (All players) the text: (Upgrade_Level_PlayersNumber[2])
  • Set Upgrade_Level[1] = ((Upgrade_Level_Hero[1] / Upgrade_Level_PlayersNumber[1]) / 5)
  • Set Upgrade_Level[2] = ((Upgrade_Level_Hero[2] / Upgrade_Level_PlayersNumber[2]) / 5)
  • Game - Display to (All players) the text: (Upgrade[1]: + (String(Upgrade_Level[1])))
  • Player - Set the current research level of DMG Increase to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of DEF Increase to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of HP Increase (Captain) to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of HP Increase (Pikeman) to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of HP Increase (Bowman) to Upgrade_Level[1] for Player 12 (Brown)
  • Game - Display to (All players) the text: (Upgrade[2]: + (String(Upgrade_Level[2])))
Let me know what those first four text messages display.
 
Level 7
Joined
Jul 20, 2009
Messages
295
  • Game - Display to (All players) the text: (Upgrade_Level_Hero[1])
  • Game - Display to (All players) the text: (Upgrade_Level_Hero[2])
  • Game - Display to (All players) the text: (Upgrade_Level_PlayersNumber[1])
  • Game - Display to (All players) the text: (Upgrade_Level_PlayersNumber[2])
  • Set Upgrade_Level[1] = ((Upgrade_Level_Hero[1] / Upgrade_Level_PlayersNumber[1]) / 5)
  • Set Upgrade_Level[2] = ((Upgrade_Level_Hero[2] / Upgrade_Level_PlayersNumber[2]) / 5)
  • Game - Display to (All players) the text: (Upgrade[1]: + (String(Upgrade_Level[1])))
  • Player - Set the current research level of DMG Increase to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of DEF Increase to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of HP Increase (Captain) to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of HP Increase (Pikeman) to Upgrade_Level[1] for Player 12 (Brown)
  • Player - Set the current research level of HP Increase (Bowman) to Upgrade_Level[1] for Player 12 (Brown)
  • Game - Display to (All players) the text: (Upgrade[2]: + (String(Upgrade_Level[2])))
Let me know what those first four text messages display.

I think I know what they will display, since I am the only player and there is none in Team 2, Upgrade_Level_Hero[2] will be 0 and Upgrade_Level_PlayerNumber[2] will also be 0, so what you're saying is... If 0 divide or times by 0 will make trigger terminate? If so, how can I fix this problem? Let's say I'm soloing the game and there is no one in Team 2. (I'm in Team 1 [Players 1-5])
 
Status
Not open for further replies.
Top