• 🏆 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!

[Trigger] 5x

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
333
Hey,
I'm trying to increase this trigger five times, but the problem is that it does not calculate correctly! sometimes it works! but mostly not!

  • King Upgrades
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Attack
          • (Unit-type of (Sold unit)) Equal to Upgrade King Hit Points
          • (Unit-type of (Sold unit)) Equal to Upgrade King Regeneration
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Selling unit)) is an ally of Player 23 (Emerald).) Equal to True
        • Then - Actions
          • Set VariableSet Player_King = Player 23 (Emerald)
          • Set VariableSet Unit_King = West King 0448 <gen>
        • Else - Actions
          • Set VariableSet Player_King = Player 24 (Peanut)
          • Set VariableSet Unit_King = East King 0447 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Attack
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current research level of King Attack Damage for Player_King) Less than (Max research level of King Attack Damage for Player_King)
            • Then - Actions
              • Player Group - Pick every player in (All allies of Player_King.) and do (Actions)
                • Loop - Actions
                  • Player - Set the current research level of King Attack Damage to ((Current research level of King Attack Damage for (Picked player)) + 1) for (Picked player)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of [Upgrade] King Attack Damage for Unit_King) Equal to 0
                • Then - Actions
                  • Unit - Add [Upgrade] King Attack Damage to Unit_King
                • Else - Actions
                  • Unit - Set level of [Upgrade] King Attack Damage for Unit_King to ((Level of [Upgrade] King Attack Damage for Unit_King) + 1)
              • Game - Display to (All allies of Player_King.) for 10.00 seconds the text: (((Strings_PlayersColor[(Player number of (Owner of (Selling unit)))] + (Name of (Owner of (Selling unit)))) + |r upgraded your team King's attack to level |cffffcc00) + ((String((Current research level of King Attack Damage for Player_King))) + |r))
              • Set VariableSet Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] = (Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] + 1)
              • -------- --------
              • -------- Income --------
              • Set VariableSet Integers_Income[(Player number of (Owner of (Selling unit)))] = (Integers_Income[(Player number of (Owner of (Selling unit)))] + 3)
            • Else - Actions
              • Player - Make Upgrade King Attack Unavailable for training/construction by (Owner of (Selling unit))
              • Player - Add 80 to (Owner of (Selling unit)).Current lumber
              • Player - Add -80 to (Owner of (Selling unit)).Total lumber gathered
              • Game - Display to (Player group((Owner of (Selling unit)))) for 10.00 seconds the text: This upgrade is alr...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Hit Points
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current research level of King Hit Point for Player_King) Less than (Max research level of King Hit Point for Player_King)
            • Then - Actions
              • Player Group - Pick every player in (All allies of Player_King.) and do (Actions)
                • Loop - Actions
                  • Player - Set the current research level of King Hit Point to ((Current research level of King Hit Point for (Picked player)) + 1) for (Picked player)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of King Hit Points [Upgrade] for Unit_King) Equal to 0
                • Then - Actions
                  • Unit - Add [Upgrade] King Hit Points to Unit_King
                  • Unit - Set level of [Upgrade] King Hit Points for Unit_King to ((Current research level of King Hit Point for (Owner of Unit_King)) + 1)
                  • Unit - Remove [Upgrade] King Hit Points from Unit_King
                • Else - Actions
              • Game - Display to (All allies of Player_King.) for 10.00 seconds the text: (((Strings_PlayersColor[(Player number of (Owner of (Selling unit)))] + (Name of (Owner of (Selling unit)))) + |r upgraded your team King's hit points to level |cffffcc00) + ((String((Current research level of King Hit Point for Player_King))) + |r))
              • Set VariableSet Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] = (Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] + 1)
              • -------- --------
              • -------- Income --------
              • Set VariableSet Integers_Income[(Player number of (Owner of (Selling unit)))] = (Integers_Income[(Player number of (Owner of (Selling unit)))] + 3)
            • Else - Actions
              • Player - Make Upgrade King Hit Points Unavailable for training/construction by (Owner of (Selling unit))
              • Player - Add 80 to (Owner of (Selling unit)).Current lumber
              • Player - Add -80 to (Owner of (Selling unit)).Total lumber gathered
              • Game - Display to (Player group((Owner of (Selling unit)))) for 10.00 seconds the text: This upgrade is alr...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Regeneration
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current research level of King Regeneration for Player_King) Less than (Max research level of King Regeneration for Player_King)
            • Then - Actions
              • Player Group - Pick every player in (All allies of Player_King.) and do (Actions)
                • Loop - Actions
                  • Player - Set the current research level of King Regeneration to ((Current research level of King Regeneration for (Picked player)) + 1) for (Picked player)
              • Game - Display to (All allies of Player_King.) for 10.00 seconds the text: (((Strings_PlayersColor[(Player number of (Owner of (Selling unit)))] + (Name of (Owner of (Selling unit)))) + |r upgraded your team King's regeneration to level |cffffcc00) + ((String((Current research level of King Regeneration for Player_King))) + |r))
              • Set VariableSet Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] = (Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] + 1)
              • -------- --------
              • -------- Income --------
              • Set VariableSet Integers_Income[(Player number of (Owner of (Selling unit)))] = (Integers_Income[(Player number of (Owner of (Selling unit)))] + 3)
            • Else - Actions
              • Player - Make Upgrade King Regeneration Unavailable for training/construction by (Owner of (Selling unit))
              • Player - Add 80 to (Owner of (Selling unit)).Current lumber
              • Player - Add -80 to (Owner of (Selling unit)).Total lumber gathered
              • Game - Display to (Player group((Owner of (Selling unit)))) for 10.00 seconds the text: This upgrade is alr...
        • Else - Actions
      • -------- --------
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Floating Text - Change text of FloatingTexts_KingUpgrades[(Integer A)] to ((|cffff0000Damage:|r + ((String((Current research level of King Attack Damage for (Owner of (Selling unit))))) + |n)) + ((|cff8080ffHit Point:|r + ((String((Current research level of King Hit Point for (Owner of (Selling unit))))) + |n)) + (|cffffcc00Reg using font size 10.00
      • -------- --------
      • Trigger - Run Update Income <gen> (ignoring conditions)
      • Unit - Remove (Sold unit) from the game
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_King Equal to Player 23 (Emerald)
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of West King 0448 <gen> using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Special Effect - Create a special effect attached to the origin of East King 0447 <gen> using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
          • Special Effect - Destroy (Last created special effect)

  • King Upgrades x5
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Attack x5
          • (Unit-type of (Sold unit)) Equal to Upgrade King Hit Points x5
          • (Unit-type of (Sold unit)) Equal to Upgrade King Regeneration x5
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Selling unit)) is an ally of Player 23 (Emerald).) Equal to True
        • Then - Actions
          • Set VariableSet Player_King = Player 23 (Emerald)
          • Set VariableSet Unit_King = West King 0448 <gen>
        • Else - Actions
          • Set VariableSet Player_King = Player 24 (Peanut)
          • Set VariableSet Unit_King = East King 0447 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Attack x5
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current research level of King Attack Damage for Player_King) Less than (Max research level of King Attack Damage for Player_King)
            • Then - Actions
              • Player Group - Pick every player in (All allies of Player_King.) and do (Actions)
                • Loop - Actions
                  • Player - Set the current research level of King Attack Damage to ((Current research level of King Attack Damage for (Picked player)) + 5) for (Picked player)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of [Upgrade] King Attack Damage for Unit_King) Equal to 0
                • Then - Actions
                  • Unit - Add [Upgrade] King Attack Damage to Unit_King
                • Else - Actions
                  • Unit - Set level of [Upgrade] King Attack Damage for Unit_King to ((Level of [Upgrade] King Attack Damage for Unit_King) + 5)
              • Game - Display to (All allies of Player_King.) for 10.00 seconds the text: (((Strings_PlayersColor[(Player number of (Owner of (Selling unit)))] + (Name of (Owner of (Selling unit)))) + |r upgraded your team King's attack to level |cffffcc00) + ((String((Current research level of King Attack Damage for Player_King))) + |r))
              • Set VariableSet Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] = (Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] + 5)
              • -------- --------
              • -------- Income --------
              • Set VariableSet Integers_Income[(Player number of (Owner of (Selling unit)))] = (Integers_Income[(Player number of (Owner of (Selling unit)))] + 15)
            • Else - Actions
              • Player - Make Upgrade King Attack Unavailable for training/construction by (Owner of (Selling unit))
              • Player - Add 400 to (Owner of (Selling unit)).Current lumber
              • Player - Add -400 to (Owner of (Selling unit)).Total lumber gathered
              • Game - Display to (Player group((Owner of (Selling unit)))) for 10.00 seconds the text: This upgrade is alr...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Hit Points x5
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current research level of King Hit Point for Player_King) Less than (Max research level of King Hit Point for Player_King)
            • Then - Actions
              • Player Group - Pick every player in (All allies of Player_King.) and do (Actions)
                • Loop - Actions
                  • Player - Set the current research level of King Hit Point to ((Current research level of King Hit Point for (Picked player)) + 5) for (Picked player)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of King Hit Points [Upgrade] for Unit_King) Equal to 0
                • Then - Actions
                  • Unit - Add [Upgrade] King Hit Points to Unit_King
                  • Unit - Set level of [Upgrade] King Hit Points for Unit_King to ((Current research level of King Hit Point for (Owner of Unit_King)) + 5)
                  • Unit - Remove [Upgrade] King Hit Points from Unit_King
                • Else - Actions
              • Game - Display to (All allies of Player_King.) for 10.00 seconds the text: (((Strings_PlayersColor[(Player number of (Owner of (Selling unit)))] + (Name of (Owner of (Selling unit)))) + |r upgraded your team King's hit points to level |cffffcc00) + ((String((Current research level of King Hit Point for Player_King))) + |r))
              • Set VariableSet Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] = (Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] + 5)
              • -------- --------
              • -------- Income --------
              • Set VariableSet Integers_Income[(Player number of (Owner of (Selling unit)))] = (Integers_Income[(Player number of (Owner of (Selling unit)))] + 15)
            • Else - Actions
              • Player - Make Upgrade King Hit Points Unavailable for training/construction by (Owner of (Selling unit))
              • Player - Add 400 to (Owner of (Selling unit)).Current lumber
              • Player - Add -400 to (Owner of (Selling unit)).Total lumber gathered
              • Game - Display to (Player group((Owner of (Selling unit)))) for 10.00 seconds the text: This upgrade is alr...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Upgrade King Regeneration x5
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current research level of King Regeneration for Player_King) Less than (Max research level of King Regeneration for Player_King)
            • Then - Actions
              • Player Group - Pick every player in (All allies of Player_King.) and do (Actions)
                • Loop - Actions
                  • Player - Set the current research level of King Regeneration to ((Current research level of King Regeneration for (Picked player)) + 5) for (Picked player)
              • Game - Display to (All allies of Player_King.) for 10.00 seconds the text: (((Strings_PlayersColor[(Player number of (Owner of (Selling unit)))] + (Name of (Owner of (Selling unit)))) + |r upgraded your team King's regeneration to level |cffffcc00) + ((String((Current research level of King Regeneration for Player_King))) + |r))
              • Set VariableSet Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] = (Integers_KingUpgradesBought[(Player number of (Owner of (Selling unit)))] + 5)
              • -------- --------
              • -------- Income --------
              • Set VariableSet Integers_Income[(Player number of (Owner of (Selling unit)))] = (Integers_Income[(Player number of (Owner of (Selling unit)))] + 15)
            • Else - Actions
              • Player - Make Upgrade King Regeneration Unavailable for training/construction by (Owner of (Selling unit))
              • Player - Add 400 to (Owner of (Selling unit)).Current lumber
              • Player - Add -400 to (Owner of (Selling unit)).Total lumber gathered
              • Game - Display to (Player group((Owner of (Selling unit)))) for 10.00 seconds the text: This upgrade is alr...
        • Else - Actions
      • -------- --------
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Floating Text - Change text of FloatingTexts_KingUpgrades[(Integer A)] to ((|cffff0000Damage:|r + ((String((Current research level of King Attack Damage for (Owner of (Selling unit))))) + |n)) + ((|cff8080ffHit Point:|r + ((String((Current research level of King Hit Point for (Owner of (Selling unit))))) + |n)) + (|cffffcc00Reg using font size 10.00
      • -------- --------
      • Trigger - Run Update Income <gen> (ignoring conditions)
      • Unit - Remove (Sold unit) from the game
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_King Equal to Player 23 (Emerald)
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of West King 0448 <gen> using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Special Effect - Create a special effect attached to the origin of East King 0447 <gen> using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
          • Special Effect - Destroy (Last created special effect)
 
Level 10
Joined
Jun 20, 2017
Messages
333
What does increasing a trigger by 5x mean?
It means I have a unit that can be upgraded, Increases his damage bonus by x, hp by x and hp regen by x, the first trigger works fine I guess but the second not exactly!
30 lvl for dmg/40 lvl for hp/20 lvl for hp regen
I setup some dummy unit and when you purchase that it will add those thing to your unit!
 

Attachments

  • 1.jpg
    1.jpg
    47.1 KB · Views: 10
  • 2.jpg
    2.jpg
    66 KB · Views: 11
  • 3.jpg
    3.jpg
    64.7 KB · Views: 10
  • 4.jpg
    4.jpg
    19.7 KB · Views: 10

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
Understood, apologies if that came off as rude.

A possible issue I see right away is this:
  • (Current research level of King Attack Damage for Player_King) Less than (Max research level of King Attack Damage for Player_King)
This condition checks to see if you're already max research level before increasing it by 1. In your case you'll be increasing it by 5, so you could be in a situation where your research level is 38/40, then you buy 5x, and go to 43/40. I assume the game is smart enough to know that > max should simply set it to max but who knows with Warcraft.

Less important, an optimization can be made with the Special Effects at the very end of the trigger. Simply create/destroy a Special Effect at the Origin of Unit_King, you don't need the If Then Else.
 
Last edited:
Status
Not open for further replies.
Top