• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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,240
  • 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