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

[Spell] Heals for 40% of mana spent

Status
Not open for further replies.
You need 2 Triggers to create such an effect, If it is Pasive as i understand.
  • You use the "A Unit Starts an effect event"
  • check for your item.
  • Save Mana & User in Global Variables
  • Start a Timer (0 seconds)
------------
  • Another Trigger (Event Timer Expires)
  • Calc (saved Mana - Current Mana = Spent Mana )
  • Heal your Unit by that value
  • Regain Mana start
    • Ereignisse
      • Unit - A unit starts the effect of a spell
    • Conditions
      • ((Triggering unit) has an item of type Your Item) Gleich True
    • Actions
      • Set Regain_Mana_Old = (Mana of (Triggering unit))
      • Set Regain_Mana_User = (Triggering unit)
      • Countdown-Timer - Start Regain_Mana_Timer as a Einmalig timer that will expire in 0.00 seconds
  • Regain Mana do
    • Ereignisse
      • Time - Regain_Mana_Timer expires
    • Bedingungen
    • Aktionen
      • Set Regain_Mana_Spent = (Regain_Mana_Old - (Mana of Regain_Mana_User))
      • Unit - Set life of Regain_Mana_User to ((Life of Regain_Mana_User) + (Regain_Mana_Spent x 0.40))
Edit: Sry for that missunderstanding names though you wanted to save spent Mana.
 
Level 3
Joined
Nov 21, 2016
Messages
30
You need 2 Triggers to create such an effect, If it is Pasive as i understand.
  • You use the "A Unit Starts an effect event"
  • check for your item.
  • Save Mana & User in Global Variables
  • Start a Timer (0 seconds)
------------
  • Another Trigger (Event Timer Expires)
  • Calc (saved Mana - Current Mana = Spent Mana )
  • Heal your Unit by that value
  • Regain Mana start
    • Ereignisse
      • Unit - A unit starts the effect of a spell
    • Conditions
      • ((Triggering unit) has an item of type Your Item) Gleich True
    • Actions
      • Set Regain_Mana_Old = (Mana of (Triggering unit))
      • Set Regain_Mana_User = (Triggering unit)
      • Countdown-Timer - Start Regain_Mana_Timer as a Einmalig timer that will expire in 0.00 seconds
  • Regain Mana do
    • Ereignisse
      • Time - Regain_Mana_Timer expires
    • Bedingungen
    • Aktionen
      • Set Regain_Mana_Spent = (Regain_Mana_Old - (Mana of Regain_Mana_User))
      • Unit - Set life of Regain_Mana_User to ((Life of Regain_Mana_User) + (Regain_Mana_Spent x 0.40))
Edit: Sry for that missunderstanding names though you wanted to save spent Mana.

i allready went through something like this but this way the old and new mana values are set the same for some abilities because of the long casting times
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
The "starts effect of an ability" triggers right after the cast time as soon as the ability's effect is truly started. Mana is not yet deducted at this point. When the 0.00 timer expires (nearly instanteously) the mana cost has been deducted.

Were you using that event and a 0 timeout timer or a different method? I believe what Taysen suggested should work.
 
Level 3
Joined
Nov 21, 2016
Messages
30
The "starts effect of an ability" triggers right after the cast time as soon as the ability's effect is truly started. Mana is not yet deducted at this point. When the 0.00 timer expires (nearly instanteously) the mana cost has been deducted.

Were you using that event and a 0 timeout timer or a different method? I believe what Taysen suggested should work.

but the thing is that i need to put a cooldown on that effect and i was using a iten to trigger the heal effect

when unit casts it sets the vars and order use iten and when iten skill went of it triggers the heal action but a unit can't use a iten when is casting like undead lich ultimate
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Okay I understand your problem. IMO you shouldn't use the item itself to achieve the heal, as that's much easier to do with triggers; the item should be there just to show the cooldown. As for how to do that I have two ideas.

For both you will need two versions of the item: the first is just an blank dummy item that does nothing and can't be used, and the second is the one that has an ability that will actually display the cooldown. You need two versions of the item that you will switch back and forth between because there is no way (AFAIK) for a trigger (the one that does the actual healing) to check if an item is on cooldown, so instead you'll have to check if the unit has the dummy version of the item (not on cooldown: heal should happen) or not (on cooldown/doesn't have the item at all: heal shouldn't happen). After the heal happens, wait the duration of the cooldown (timer is probably better) and then switch the items back.

1: Give the cooldown item a version of Amulet of Spell Shield. When it should go on cooldown just create a dummy to cast a spell with no travel time on it (Inner Fire, for example), which will trigger the spell shield and put it on cooldown. This specifically doesn't interrupt channeled abilities so I know it should work... it just might be a little visually unappealing if the spell doesn't get cast immediately.

2: Modify the method from this tutorial: Passive ability with cooldown - Best method! Give the cooldown item a modified Exhume Corpses. When it should go on cooldown, add the Cargo Hold (Meat Wagon) ability to the unit. Make sure you've previously disabled CH as specified in the trigger. I am honestly not sure if this will work but it is definitely a better way if it does.
 
Status
Not open for further replies.
Top