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

Mana cost with triggers.

Status
Not open for further replies.
Level 2
Joined
Jul 9, 2008
Messages
25
Is there a trigger action to increase/decrease a unit's mana by a set amount? I'm trying to make a spell that costs 1% of the caster's mana, but all I can find are "Set Mana (To Percentage)" and "Set Mana (To Value)", when I need something more similar to "Damage Target".

Alternatively, I tried to do "Set Mana (To Value)", with the value being the caster's maximum mana, minus a variable (named mana) divided by 100, with another trigger that sets the variable to a caster's max mana whenever a unit casts the spell. But the only mana-related number that a variable can be set to is "percentage mana of (unit)", and I don't know what that means.
 
Level 2
Joined
Aug 8, 2008
Messages
17
so.. what exactly are you trying to do? Zap all there mana when they cast it or half of it? If not just go to object editor and put the manacost on the ability...
 
Level 2
Joined
Jul 9, 2008
Messages
25
Thanks for the help.

so.. what exactly are you trying to do? Zap all there mana when they cast it or half of it? If not just go to object editor and put the manacost on the ability...

The spell's effect is based on the intelligence of the hero, and I want to give it a mana cost that is not a fixed number, so that the spell is effective at low and high levels without needing more than one rank.
 
Level 8
Joined
May 21, 2008
Messages
218
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Sap Mana
    • Actions
      • Set CastingUnit = (Casting unit)
      • Set UnitMana = (Integer((Mana of CastingUnit)))
      • Set Maxunitmana = (Integer((Max mana of CastingUnit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Real(Maxunitmana)) / 100.00) Greater than (Real(UnitMana))
        • Then - Actions
          • Do nothing
          • Custom script: Call Remove Unit (udg_CastingUnit)
          • Custom script: Call Remove Integer (udg_UnitMana)
          • Custom script: Call Remove Integer (udg_Maxunitmana)
        • Else - Actions
          • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) - ((Real(Maxunitmana)) / 100.00))
          • Custom script: Call Remove Unit (udg_CastingUnit)
          • Custom script: Call Remove Integer (udg_UnitMana)
          • Custom script: Call Remove Integer (udg_Maxunitmana)
Im new to the whole trigger leak thing correct me if I'm Wrong.
 
Status
Not open for further replies.
Top