hello all is it possible to make it so when a unit is hit by a spell it will cast another. For example you cast fireball on a unit then it casts say chain lightning on a random unit within a certain range? Thx all for ur help
Yes it is. You will need a dummy unit with chain lightning. And here is the code:
Event - An Unit Starts Casting an Ability Conditions - Ability Being Cast equal fireball Actions - Set targ = (Target Unit of Ability Being Cast) - Wait 1.00 seconds //Too lazy for a formula - Create 1 Dummy for (Owner of (Triggering Unit)) at (Position of targ) facing 0.00 - Add 2.00 seconds expiration timer to (Last Created Unit) - Order (Last Created Unit) to Orc - Far Seer - Chain Lightning Random Unit within ((Units Within x range of targ) Matching Condition ((Picked Unit) is an enemy of (Triggering Unit)) equal to true)
this works but is it possible to do it with custom spells also where is this "- Set targ = (Target Unit of Ability Being Cast) " and the random unit within range sry im not as good as i used to be.
What im trying to do eactly is i have a spell called black plague-1 and every time it strikes a target i want it to cast another custom spell called black plague-2. Black plague-1 is like chain lighning and black plague-2 is like forked lightning.
ok if i understand this correctly, u want the hero (one with fireball) to cast chain lightning whenever it casts fireball? do u want it to be random?
ok so heres the code for it to happen the way i said,
Trigger
Events Unit - A unit Begins casting an ability Conditions (Ability being cast) Equal to Your Ability Actions Set PlagueTarget = (Target unit of ability being cast) Unit - Chain Lightning Dummy spell to (Triggering unit) Unit - Order (Triggering unit) to Orc Far Seer - Chain Lightning PlagueTarget Wait 1.00 seconds Unit - Remove Chain Lightning Dummy spell from (Triggering unit)
Where PlagueTarget is a variable (unit)
if u wanted it to be a % chance u would do this:
Trigger
Events Unit - A unit Begins casting an ability Conditions (Ability being cast) Equal to Your Ability Actions Set PlagueTarget = (Target unit of ability being cast) If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (Random integer number between 1 and 100) Less than or equal to 5 Then - Actions Unit - Create 1 PlagueDummy for (Owner of Triggering Unit) at (Position of Triggering Unit) facing (Position of (PlagueTarget)) Set PlagueUnit = (Last created unit)
Unit - Add a 2.00 second Generic expiration timer to PlagueUnit Unit - Order (PlagueUnit) to Orc Far Seer - Chain Lightning PlagueTarget
Else - Actions Do nothing
Now for this spell ur ganna have to make a Dummy unit dummy spell, so yeah i hope this is wat u want.
Nojix... targ is a unit variable, and you assign it the (Target Unit of Ability Being Cast) at the beginning of the trigger. Read the FAQ to understand.
And now, you want it to cast a chain lightning spell, and from each target hit by the chain lightning to create a fork lightning at a random unit? I'm afraid that's impossible, unless you trigger the chain lightning yourself. Chain Lightning is special. You can't determine the targets hit by it. You can do it with single target spells though. So be more specific about what you want, and about what the spell is supposed to do.