Hello, I am not good at triggers so sorry if this is really simple. I would like to make spell that will steal blood from enemy units and transfer it to my hero. This spell is similar to Vladimir's from League of Legends Q spell, you can watch it here:
http://youtu.be/EwSpUvyjhPQ?t=51s
(Actually I would like all his spells in war3, but it's too hard for me)
So I've found 2 ways how to do it.
First one: I use ability on enemy unit, this enemy unit will lose some hp and under enemy unit will spawn dummy which will shoot at me spell that will heal me. Dummy unit shoots at me fireball with like -50 damage and I got healed for 50 hp, but it will also stun me. That is the problem, how to remove stun? Even with 0.01 seconds it still stun me and with 0.00 seconds it will stun forever. I can't find same spell without stun option and which will fly to me. Maybe Death Coil but it is only heal undead units, and I don't have idea how to make it heal all units.
(Kinda bad idea) Second Idea is like the same, but Dummy units instead of spell will attack me with 0 damage and when my hero is get damage, trigger will heal me for some hp, but I don't know trigger that will work when hero is damaged. Because when hero "is attacked" he will get heal before projectile will hurt him.
Please help, maybe you know other method? Guess I made it clear.
You seem to be completely new to triggering in WC3 so I will start at the very bottom of triggers.
Sometimes when something happens in the game, an event is fired.
This is simply to let everyone know that something has happened.
Events are like "Map Initialization", "A unit dies", "A unit is attacked", "Elapsed gametime is equal to (real)", "(player) selects a unit", "A unit enters (region)", etc, etc, etc.
With triggers, you can do something when such an event is fired. This is an event action. (aka Trigger action)
In this trigger, the game displays the text "A unit has died." to all players when a unit died.
-
Dying Unit
-

Events
-

Conditions
-

Actions
-


Game - Display to (All players) the text: A unit has died.
For your situation, we are going to do something when a unit has used a spell.
There are several events that we can use for that:
"A unit is issued an order" -> when a unit is ordered to cast the spell.
"A unit begins casting an ability" -> when that unit is starting to cast the spell.
"A unit begins channeling an ability" -> when that unit is starting to channel the spell.
"A unit starts the effect of an ability" -> when the spell has started it's effect.
"A unit finishes casting an ability" -> when that unit has finished the casting animation without interrupting.
"A unit stops casting an ability" -> when that unit is interrupted (including when he takes a new order)
For now, all you have to know is "A unit starts the effect of an ability".
When the mountain king for example is casting his storm bolt and the projectile is created, that moment this event is fired.
You want to make a spell effect like Vladimir's Transfusion.
So you want to:
- deal damage to the targeted unit
- heal the caster
Both can be done in triggers very easily.
You create a trigger and give it the event "A unit starts the effect of an ability".
Then you have to check if that ability actually is your transfusion.
So you create a condition (can also be done in an If/Then/Else but that doesn't matter)
The condition will be "(Ability being cast) equal to <MyCreatedTransfusionAbility>".
Then you know when a unit has cast the transfusion spell.
-
Vladimir Transfusion
-

Events
-


Unit - A unit Starts the effect of an ability
-

Conditions
-


(Ability being cast) Equal to Transfusion (Vladimir)
-

Actions
-


Game - Display to (All players) the text: A unit has cast Transfusion.
Now all you have to do is deal the damage and heal the caster.
There is an option to set a unit's health and mana to a percentage or raw value.
What you want to do is to set the health of the caster to the health of the caster added to a custom value.
-
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + TempReal)
(To make that "() + ()" you have to use the function "Arithmetic".)
The Triggering unit is always the unit that triggered the event.
In this case it is "A Triggering unit Starts the effect of an ability". In some other cases there are multiple units mentioned in the event or the triggering unit is not even mentioned at all, then you have to take a good look which unit will probably be the triggering unit.
Anyway, you have to set TempReal (which is a global variable) to the amount that the caster has to heal.
If we use the values from the actual ability and remove the ability power scaling of the effect, we get these values:
15 / 25 / 35 / 45 / 55
So you have (5 + 10 X (level)).
So you set TempReal to (5 + (10 x (Level of ability being cast)))
Remember to use Arithmetics twice now.
The level of the ability is an integer (non-decimal-number) and you want a real (decimal-number).
So you have to do "Conversion - Convert integer to real".
Your trigger should now look like this:
-
Vladimir Transfusion
-

Events
-


Unit - A unit Starts the effect of an ability
-

Conditions
-


(Ability being cast) Equal to Transfusion (Vladimir)
-

Actions
-


Set TempReal = (5.00 + (10.00 x (Real((Level of Transfusion (Vladimir) for (Triggering unit))))))
-


Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + TempReal)
Now you only have to do the damage.
You can set the life of the targeted unit to a lower value indeed but that would be stupid because then the caster will not get the credits for killing the unit for example.
So we use a different option: "Unit - Damage Target".
-
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 500.00 damage of attack type Spells and damage type Normal
You have to make the triggering unit deal damage to the targeted unit of the ability. Be aware that this is NOT "targeted unit" but "targeted unit of ability being cast".
The damage should not be 500 though. We can use the same method as before with the TempReal as value. (This is simply to be able to change the values more easily. You can indeed also set the actual value in that field of that function.)
Going back to the wiki, we read:
90 / 125 / 160 / 195 / 230
So you have (55 + 35 X (level)).
So you set TempReal to (55 + (35 x (Level of ability being cast)))
Now the trigger is complete and ready to be used.
-
Vladimir Transfusion
-

Events
-


Unit - A unit Starts the effect of an ability
-

Conditions
-


(Ability being cast) Equal to Transfusion (Vladimir)
-

Actions
-


Set TempReal = (5.00 + (10.00 x (Real((Level of Transfusion (Vladimir) for (Triggering unit))))))
-


Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + TempReal)
-


Set TempReal = (55.00 + (35.00 x (Real((Level of Transfusion (Vladimir) for (Triggering unit))))))
-


Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing TempReal damage of attack type Spells and damage type Normal
Sanguine Blood and Hemoplague are pretty hard to do actually.
But I think that if you take your time to think about them one by one that Tides of Blood and Hemoplague could be achieved.
EDIT:
Also it's a bit different that I was looking for, I mean system is great, but how I do visual effect? I have blood projectile model and I need that it fly to my hero and would be perfect if he gets heal when this blood reaches him. Any ideas?
Well... what you want in that case is to make a missile that travels from the target to the source and apply the heal when it arrives at the source.
To do that, you require a missile system.
You can use mine (but is still under development) or use another one from the spell resource section.
What you want it to do is to heal the target... The best option would be if that missile system has an on-collide event but if it simply supports a heal than it is alright too.
The second option requires a damage detection system.
In that case, you create a custom ability based of Acid Bomb and set the damage to 1 and the duration of the buff to 0.01.
When a unit takes damage, check if that unit has the "Transfusion Heal" buff and if so then remove that buff and heal the target.
This method is less recommended but still works 100%.
It is your call.