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

Trigger for a mana restore aura

Status
Not open for further replies.
Level 3
Joined
Aug 31, 2010
Messages
35
Hey,
I wanted a passive ability for my Arch Mage but I have no idea what to do. Here's the tooltip (how the ability should work).

If a unit in 1000 range casts a spell there is a chance of 5%/10%/15%/20% to restore mana equal to 2%/4%/6%/8% of the heroes mana.

Thanks for help.

/edit Up to 10 players can have this ability.
 
Last edited:
Level 20
Joined
Oct 21, 2006
Messages
3,230
cba to open editor but the basics are:

Unit starts effect of casting ability

Triggering unit has buff AURA equal to true

If/Then/Else
IF Integer - Math - Random number between 0 to 100 less than or equal to 10 (10%)
THEN Unit add mana X (or set mana to current+X)
ELSE (do nothing)


+ you cant get the cost data from abilities so you have to store them to variables in the map init for an example and adding unit limit to aura can require "a bit" more effort.
 
Level 3
Joined
Aug 31, 2010
Messages
35
/changed the tooltip

I'll explain.
Whenever a unit (friend or foe) in 1000 range casts any spell there is a chance that the Arch Mage restores a percent value of his mana. I've got 10 players for my map who can have the ability at the same time and can stand together.

The spell is a passive ability.
 
Level 6
Joined
Dec 9, 2007
Messages
208
That's just what Super-Sheep explained. And as he finished saying, it's easier to just give back a flat amount of mana instead of storing every spell and rank into variables.

+rep to Super-Sheep for usefull guide :)
 
Simple, create a dummy aura ability that has 1000 range and a custom buff(important to the triggers), but no effects eg. Devotion Aura with AoE 1000, but no armor bonus, and use the below combined with Super-sheep's suggestion.
  • Mana
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) has buff <Your Aura Buff>) Equal to True
    • Actions
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Unfortunely, Warcraft does not have an native to get the mana cost of an abilities, but there's a really easy way to detect how much mana the unit has lost.

Use the event "Unit - Begins channeling an ability", save the unit mana, then when a unit finishes the casting, run action to check % chance, if it happens, compare the units mana to the saved variable, get the lost mana point and restore mana equal to the lost one.

This way also has it cons, because if in that time the unit is mana-burned or hit by feedback it will generate more lost mana, but that's just exceptions.
 
Status
Not open for further replies.
Top