• 🏆 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] Add a specific amount of mana when an ability is used.

Status
Not open for further replies.
Level 6
Joined
Sep 17, 2004
Messages
277
Here's an old trigger I used to make "Charge" for my warrior hero.

  • Warrior Charge Action
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Charge (Test)
    • Actions
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\Invisibility\InvisibilityTarget.mdl
      • Set SpecialFX = (Last created special effect)
      • Trigger - Run Special Effect Destruction <gen> (ignoring conditions)
      • Sound - Play WarriorHeroricLeap <gen> at 100.00% volume, located at (Position of (Triggering unit)) with Z offset 1500.00
      • Set Stored_Unit[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
      • Wait 0.15 game-time seconds
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Real(((Level of Charge (Test) for (Triggering unit)) x 1))) damage of attack type Hero and damage type Normal
Instead of the damage (or maybe after it), I'd like it to add 4 mana (for level 1, 8 for level 2, 12 for level 3) to the unit's mana. Not set it to 4 mana, but add 4 mana. Is this possible?
 
Level 3
Joined
May 7, 2009
Messages
21
I think this should work

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + 4.00)
So use the set mana function,
then arithmetic,
then (unit property) + 4
 
  • Mana
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of (YourUnit)) Equal to 1
        • Then - Actions
          • Unit - Set mana of (YourUnit) to ((Mana of (YourUnit)) + 4.00)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (YourUnit)) Equal to 2
            • Then - Actions
              • Unit - Set mana of (YourUnit) to ((Mana of (YourUnit)) + 8.00)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Hero level of (YourUnit)) Equal to 3
                • Then - Actions
                  • Unit - Set mana of (YourUnit) to ((Mana of (YourUnit)) + 12.00)
                • Else - Actions
or in your case (shorter)

  • Mana
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (YourUnit)) Equal to (Integer A)
            • Then - Actions
              • Unit - Set mana of (YourUnit) to ((Mana of (YourUnit)) + (4.00 x (Real(Integer A))))
            • Else - Actions
Edit: uups an error, fixing it
Edit2: okay fixed
 
Level 3
Joined
May 7, 2009
Messages
21
In his trigger,

  • For each (Integer A) from 1 to 3, do (Actions)
will make it so it's only applied to your hero when his level is either 1, 2, or 3
 
ups, made a fault again ;) try this. This should be alright
  • Mana
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of YourAbility for (YourUnit)) Equal to (Integer A)
            • Then - Actions
              • Unit - Set mana of (YourUnit) to ((Mana of (YourUnit)) + (4.00 x (Real(Integer A))))
            • Else - Actions
 
Level 9
Joined
Apr 25, 2009
Messages
468
Heres another one, like 10x more simple...

1 action...

Unit - Set mana of (YourUnit) to ((Mana of (YourUnit)) + (4.00 x (Level of (Ability being cast) for (YourUnit)))
 
Status
Not open for further replies.
Top