• 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] Protection spell help

Status
Not open for further replies.
Level 3
Joined
Jun 6, 2007
Messages
48
I have a hero called the Earthfather, one of his skills will link to a friendly/allied unit and take 80% of their damage and transfer it through the link to the earthfather leaving the unit to only take the remaining 20%. Some example are the Ragnarok Crusaders Sacrifice spell or i guess you could say Spirit Link however if i make a custom ability based on Spirit Link then crank the value to 0.80 it makes both units take 80% which means they take 160% total which is just stupid.

I have tried different ways of doing this and each time it's lead to failure or half working triggers which is why i'm posting here to ask for help so i can learn from a more experience coder, if this has to be done in Jass then by all means do it in Jass, i'm trying to learn Jass aswell but atm i'm more experience in GUI.


Spell creates a link that transfers 80% of the damage to the Earthfather.
Spell lightning art can be anything but the Drain Life effect would be excellent.
Only one links should be up at any given time.

Thanks in advance to anyone that helps.
 
Level 13
Joined
Mar 16, 2008
Messages
941
This is possible in Gui: (this won't be MUI or MPI like this)
1. Trigger: When your hero casts the spell on target unit, create a new trigger that has the event "target unit of ability being cast takes damage". Wait for example 10 seconds and destroy that trigger afterwards.
New Trigger: Increase the life of the target by "damage taken*0.8" and order the damagesource to damage Earthfather by "damage taken*0.8".
You need to care that sometimes "damage taken*0.8" is more then max HP. You need to check it in an if-condition and if it's more start a timer with 0 timeout (will cause the damage to be applied before the heal, without it's the other way round) and heal it afterwards...

Also you can search for "damage detection" ;)
 
Status
Not open for further replies.
Top