- Joined
- Sep 11, 2013
- Messages
- 479
Greetings!
I have this spell that was created by @Uncle in this Thread and I wonder.. How can I make this spell to hit invisible units only if are visible to the player that use this spell?
Right now, this spell hit invisible units(through bounce) even if the caster do not see the invisible units and I don't want that.
I changed the triggers a little bit. Right now the spell will only hit units, but not buildings or trees. Also, right now the enemy units that are hit by the spell will take a base damage + percentage damage (0.03%).
I attached the test map below.
The help will be appreciated!
I have this spell that was created by @Uncle in this Thread and I wonder.. How can I make this spell to hit invisible units only if are visible to the player that use this spell?
Right now, this spell hit invisible units(through bounce) even if the caster do not see the invisible units and I don't want that.
I changed the triggers a little bit. Right now the spell will only hit units, but not buildings or trees. Also, right now the enemy units that are hit by the spell will take a base damage + percentage damage (0.03%).
-
Chain Lightning Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Wrath of Wizard - HERO NEW 2025
-
-
Actions
-
Custom script: local destructable d
-
Set VariableSet CL_Index = (CL_Index + 1)
-
Set VariableSet CL_Caster[CL_Index] = (Triggering unit)
-
Set VariableSet CL_Player[CL_Index] = (Owner of CL_Caster[CL_Index])
-
Custom script: set udg_CL_CanBeTargeted[udg_CL_Index] = CreateGroup()
-
-------- --------
-
-------- [ CUSTOMIZE THESE: ] --------
-
Set VariableSet CL_TreeType = Barrel
-
Set VariableSet CL_TreeType2 = Ashenvale Tree Wall
-
Set VariableSet CL_TreeType3 = Black Citadel Tree Wall
-
Set VariableSet CL_TreeType4 = Dungeon Tree Wall
-
Set VariableSet CL_TreeType5 = Felwood Tree Wall
-
Set VariableSet CL_TreeType6 = Icecrown Tree Wall
-
Set VariableSet CL_TreeType7 = Fall Tree Wall
-
Set VariableSet CL_TreeType8 = Rock Chunks
-
Set VariableSet CL_TreeType9 = Frozen Throne Gate
-
Set VariableSet CL_LightningArtTarget = Objects\Spawnmodels\NightElf\NECancelDeath\NECancelDeath.mdl - target
-
Set VariableSet CL_AreaOfEffect[CL_Index] = (360.00 + (40.00 x (Real((Level of (Ability being cast) for CL_Caster[CL_Index])))))
-
Set VariableSet CL_DelayBetweenBounces[CL_Index] = 0.20
-
Set VariableSet CL_DamageReduction[CL_Index] = 0.00
-
Set VariableSet CL_Damage[CL_Index] = (15.00 + (20.00 x (Real((Level of (Ability being cast) for CL_Caster[CL_Index])))))
-
Set VariableSet CL_NumberOfTargetsHit[CL_Index] = (2 + (1 x (Level of (Ability being cast) for CL_Caster[CL_Index])))
-
-------- --------
-
-------- [ STOP - TURN ON THE LOOP TRIGGER: ] --------
-
Set VariableSet CL_DelayBetweenBouncesReset[CL_Index] = CL_DelayBetweenBounces[CL_Index]
-
Trigger - Turn on Chain Lightning Loop <gen>
-
-------- --------
-
-------- [ DAMAGE TARGET / KILL TREE: ] --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Target destructible of ability being cast) Equal to No destructible
-
-
Then - Actions
-
-------- UNIT was found! --------
-
Set VariableSet CL_Target = (Target unit of ability being cast)
-
Set VariableSet CL_LightningSource[CL_Index] = (Position of CL_Target)
-
-------- --------
-
-------- Customize the Special Effect: --------
-
Special Effect - Create a special effect attached to the overhead of CL_Target using CL_LightningArtTarget
-
Special Effect - Destroy (Last created special effect)
-
-------- --------
-
-------- Deal damage: --------
-
Set VariableSet CL_NumberOfTargetsHit[CL_Index] = (CL_NumberOfTargetsHit[CL_Index] - 1)
-
Unit Group - Add CL_Target to CL_CanBeTargeted[CL_Index]
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
Set VariableSet Chain_NewReal1 = ((Max life of CL_Target) x 0.03)
-
Unit - Cause CL_Caster[CL_Index] to damage CL_Target, dealing (Chain_NewReal1 + CL_Damage[CL_Index]) damage of attack type Spells and damage type Magic
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
Set VariableSet CL_Damage[CL_Index] = (CL_Damage[CL_Index] x (1.00 - CL_DamageReduction[CL_Index]))
-
-
Else - Actions
-
-------- TREE was found! --------
-
Set VariableSet CL_Tree = (Target destructible of ability being cast)
-
Custom script: set d = udg_CL_Tree
-
Set VariableSet CL_LightningSource[CL_Index] = (Position of CL_Tree)
-
-------- --------
-
-------- Customize the Special Effect: --------
-
Special Effect - Create a special effect at CL_LightningSource[CL_Index] using CL_LightningArtTarget
-
Special Effect - Destroy (Last created special effect)
-
-------- --------
-
-------- Kill tree: --------
-
Set VariableSet CL_NumberOfTargetsHit[CL_Index] = (CL_NumberOfTargetsHit[CL_Index] - 1)
-
Set VariableSet CL_Damage[CL_Index] = (CL_Damage[CL_Index] x (1.00 - CL_DamageReduction[CL_Index]))
-
Wait 0.00 seconds
-
Custom script: call KillDestructable(d)
-
-
-
Custom script: set d = null
-
-
-
Chain Lightning Loop
-
Events
-
Time - Every 0.02 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer CL_Loop) from 1 to CL_Index, do (Actions)
-
Loop - Actions
-
Set VariableSet CL_DelayBetweenBounces[CL_Loop] = (CL_DelayBetweenBounces[CL_Loop] - 0.02)
-
-------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
CL_DelayBetweenBounces[CL_Loop] Less than or equal to 0.01
-
-
Then - Actions
-
Set VariableSet CL_DelayBetweenBounces[CL_Loop] = CL_DelayBetweenBouncesReset[CL_Loop]
-
-------- --------
-
-------- Check for units before checking for trees: --------
-
Trigger - Run Chain Lightning Get Closest Unit <gen> (ignoring conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
CL_Target Not equal to No unit
-
-
Then - Actions
-
-------- UNIT was found! --------
-
-------- --------
-
-------- Customize the Special Effect: --------
-
Special Effect - Create a special effect attached to the overhead of CL_Target using CL_LightningArtTarget
-
Special Effect - Destroy (Last created special effect)
-
-------- --------
-
-------- Deal damage: --------
-
Set VariableSet CL_LightningSource[CL_Loop] = (Position of CL_Target)
-
Set VariableSet CL_NumberOfTargetsHit[CL_Loop] = (CL_NumberOfTargetsHit[CL_Loop] - 1)
-
Unit Group - Add CL_Target to CL_CanBeTargeted[CL_Loop]
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
Set VariableSet Chain_NewReal2 = ((Max life of CL_Target) x 0.03)
-
Unit - Cause CL_Caster[CL_Loop] to damage CL_Target, dealing (Chain_NewReal2 + CL_Damage[CL_Loop]) damage of attack type Spells and damage type Magic
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
-------- ------------------------------------------------------- --------
-
Set VariableSet CL_Damage[CL_Loop] = (CL_Damage[CL_Loop] x (1.00 - CL_DamageReduction[CL_Loop]))
-
-
Else - Actions
-
Trigger - Run Chain Lightning Get Closest Tree <gen> (ignoring conditions)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
CL_Tree Not equal to No destructible
-
-
Then - Actions
-
-------- TREE was found! --------
-
Set VariableSet CL_LightningSource[CL_Loop] = (Position of CL_Tree)
-
-------- --------
-
-------- Customize the Special Effect: --------
-
Special Effect - Create a special effect at CL_LightningSource[CL_Loop] using CL_LightningArtTarget
-
Special Effect - Destroy (Last created special effect)
-
-------- --------
-
-------- Kill tree: --------
-
Set VariableSet CL_NumberOfTargetsHit[CL_Loop] = (CL_NumberOfTargetsHit[CL_Loop] - 1)
-
Set VariableSet CL_Damage[CL_Loop] = (CL_Damage[CL_Loop] x (1.00 - CL_DamageReduction[CL_Loop]))
-
Destructible - Kill CL_Tree
-
-
Else - Actions
-
-------- No targets found - End early! --------
-
Set VariableSet CL_NumberOfTargetsHit[CL_Loop] = 0
-
-
-
-
-
-------- --------
-
-------- De-index this instance of the spell if it's out of targets: --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
CL_NumberOfTargetsHit[CL_Loop] Equal to 0
-
-
Then - Actions
-
Custom script: call RemoveLocation(udg_CL_LightningSource[udg_CL_Loop])
-
Custom script: call DestroyGroup(udg_CL_CanBeTargeted[udg_CL_Loop])
-
-------- --------
-
-------- This is how Dynamic Indexing manages separate instances of the same ability: --------
-
Set VariableSet CL_AreaOfEffect[CL_Loop] = CL_AreaOfEffect[CL_Index]
-
Set VariableSet CL_Caster[CL_Loop] = CL_Caster[CL_Index]
-
Set VariableSet CL_Damage[CL_Loop] = CL_Damage[CL_Index]
-
Set VariableSet CL_DamageReduction[CL_Loop] = CL_DamageReduction[CL_Index]
-
Set VariableSet CL_DelayBetweenBounces[CL_Loop] = CL_DelayBetweenBounces[CL_Index]
-
Set VariableSet CL_DelayBetweenBouncesReset[CL_Loop] = CL_DelayBetweenBouncesReset[CL_Index]
-
Set VariableSet CL_NumberOfTargetsHit[CL_Loop] = CL_NumberOfTargetsHit[CL_Index]
-
Set VariableSet CL_LightningSource[CL_Loop] = CL_LightningSource[CL_Index]
-
Set VariableSet CL_CanBeTargeted[CL_Loop] = CL_CanBeTargeted[CL_Index]
-
Set VariableSet CL_Player[CL_Loop] = CL_Player[CL_Index]
-
-------- --------
-
Set VariableSet CL_Index = (CL_Index - 1)
-
Set VariableSet CL_Loop = (CL_Loop - 1)
-
-------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
CL_Index Equal to 0
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-
-
Chain Lightning Get Closest Unit
-
Events
-
Conditions
-
Actions
-
Set VariableSet CL_Target = No unit
-
Set VariableSet CL_AreaOfEffect[0] = 9999999.00
-
Set VariableSet CL_UnitGroup = (Units within CL_AreaOfEffect[CL_Loop] of CL_LightningSource[CL_Loop] matching ((((Matching unit) belongs to an enemy of CL_Player[CL_Loop].) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is in CL_CanBeTargeted[CL_Loop]
-
Unit Group - Pick every unit in CL_UnitGroup and do (Actions)
-
Loop - Actions
-
Set VariableSet CL_Point = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is A structure) Equal to False
-
(Distance between CL_LightningSource[CL_Loop] and CL_Point) Less than or equal to CL_AreaOfEffect[0]
-
-
Then - Actions
-
Set VariableSet CL_Target = (Picked unit)
-
Set VariableSet CL_AreaOfEffect[0] = (Distance between CL_LightningSource[CL_Loop] and CL_Point)
-
-
Else - Actions
-
-
Custom script: call RemoveLocation(udg_CL_Point)
-
-
-
Custom script: call DestroyGroup (udg_CL_UnitGroup)
-
-
-
Chain Lightning Get Closest Tree
-
Events
-
Conditions
-
Actions
-
Set VariableSet CL_Tree = No destructible
-
Set VariableSet CL_AreaOfEffect[0] = 9999999.00
-
Destructible - Pick every destructible within CL_AreaOfEffect[CL_Loop] of CL_LightningSource[CL_Loop] and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType2
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType3
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType4
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType5
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType6
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType7
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType8
-
(Destructible-type of (Picked destructible)) Equal to CL_TreeType9
-
-
-
((Picked destructible) is alive) Equal to True
-
-
Then - Actions
-
Set VariableSet CL_Point = (Position of (Picked destructible))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Distance between CL_LightningSource[CL_Loop] and CL_Point) Less than or equal to CL_AreaOfEffect[0]
-
-
Then - Actions
-
Set VariableSet CL_Tree = (Picked destructible)
-
Set VariableSet CL_AreaOfEffect[0] = (Distance between CL_LightningSource[CL_Loop] and CL_Point)
-
-
Else - Actions
-
-
Custom script: call RemoveLocation(udg_CL_Point)
-
-
Else - Actions
-
-
-
-
-
-
Stop Spell Immunity
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to Wrath of Wizard - HERO NEW 2025
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Target unit of ability being cast) is Magic Immune) Equal to True
-
-
Then - Actions
-
Unit - Order (Casting unit) to Stop.
-
Custom script: call SimError(GetOwningPlayer(GetTriggerUnit()), "Can't target spell immunity units")
-
-
Else - Actions
-
-
-
I attached the test map below.
The help will be appreciated!