My Lightning Spell is not working properly.
The First Attempt is going wrong.
Please check it out for me
Spell is in the attachment
Code
VoC Cast
VoC Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to VoC_Spell
Actions
Set VoC_DurationSet = 20.00
Set VoC_LightningNameSet = AFOD
Set VoC_UnitSourceSet = (Triggering unit)
Set VoC_UnitTargetSet = (Target unit of ability being cast)
Set VoC_LevelSet = (Level of VoC_Spell for (Triggering unit))
Trigger - Run VoC Run <gen> (ignoring conditions)
VoC Run
VoC Run
Events
Conditions
Actions
Custom script: local real x1
Custom script: local real y1
Custom script: local real z1
Custom script: local real x2
Custom script: local real y2
Custom script: local real z2
Set VoC_MaxIndex = (VoC_MaxIndex + 1)
Set VoC_Duration[VoC_MaxIndex] = VoC_DurationSet
Set VoC_LightningName[VoC_MaxIndex] = VoC_LightningNameSet
Set VoC_UnitSource[VoC_MaxIndex] = VoC_UnitSourceSet
Set VoC_UnitTarget[VoC_MaxIndex] = VoC_UnitTargetSet
Set VoC_Level[VoC_CurrentIndex] = VoC_LevelSet
Set VoC_LightningFadeInterval[VoC_MaxIndex] = ((1.00 / VoC_DurationSet) x VoC_Interval)
Set VoC_LightningAlpha[VoC_MaxIndex] = 1.00
Custom script: set x1 = GetUnitX(udg_VoC_UnitSource[udg_VoC_MaxIndex])
Custom script: set y1 = GetUnitY(udg_VoC_UnitSource[udg_VoC_MaxIndex])
Custom script: call MoveLocation(udg_VoC_Location, x1, y1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(VoC_UnitSource[VoC_MaxIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z1 = GetLocationZ(udg_VoC_Location) + udg_VoC_UnitZ
Else - Actions
Custom script: set z1 = GetLocationZ(udg_VoC_Location) + GetUnitFlyHeight(udg_VoC_UnitSource[udg_VoC_MaxIndex])
Custom script: set x2 = GetUnitX(udg_VoC_UnitTarget[udg_VoC_MaxIndex])
Custom script: set y2 = GetUnitY(udg_VoC_UnitTarget[udg_VoC_MaxIndex])
Custom script: call MoveLocation(udg_VoC_Location, x2, y2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(VoC_UnitTarget[VoC_MaxIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z2 = GetLocationZ(udg_VoC_Location) + udg_VoC_UnitZ
Else - Actions
Custom script: set z2 = GetLocationZ(udg_VoC_Location) + GetUnitFlyHeight(udg_VoC_UnitTarget[udg_VoC_MaxIndex])
Custom script: set udg_VoC_Lightning[udg_VoC_MaxIndex] = AddLightningEx(udg_VoC_LightningName[udg_VoC_MaxIndex], true, x1, y1, z1, x2, y2, z2)
Trigger - Turn on VoC Loop <gen>
VoC Loop
VoC Loop
Events
Conditions
Actions
Custom script: local real x1
Custom script: local real y1
Custom script: local real z1
Custom script: local real x2
Custom script: local real y2
Custom script: local real z2
For each (Integer VoC_CurrentIndex) from 1 to VoC_MaxIndex, do (Actions)
Loop - Actions
Set VoC_PointSource[VoC_CurrentIndex] = (Position of VoC_UnitSource[VoC_CurrentIndex])
Set VoC_PointTarget[VoC_CurrentIndex] = (Position of VoC_UnitTarget[VoC_CurrentIndex])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
VoC_UnitSource[VoC_CurrentIndex] Not equal to No unit
Then - Actions
Custom script: set x1 = GetUnitX(udg_VoC_UnitSource[udg_VoC_CurrentIndex])
Custom script: set y1 = GetUnitY(udg_VoC_UnitSource[udg_VoC_CurrentIndex])
Custom script: call MoveLocation(udg_VoC_Location, x1, y1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(VoC_UnitSource[VoC_CurrentIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z1 = GetLocationZ(udg_VoC_Location) + udg_VoC_UnitZ
Else - Actions
Custom script: set z1 = GetLocationZ(udg_VoC_Location) + GetUnitFlyHeight(udg_VoC_UnitSource[udg_VoC_CurrentIndex])
Else - Actions
Custom script: set x1 = GetLocationX(udg_VoC_PointSource[udg_VoC_CurrentIndex])
Custom script: set y1 = GetLocationY(udg_VoC_PointSource[udg_VoC_CurrentIndex])
Custom script: call MoveLocation(udg_VoC_Location, x1, y1)
Custom script: set z1 = GetLocationZ(udg_VoC_Location) + udg_VoC_PointSourceZ[udg_VoC_CurrentIndex]
-------- For UnitSource Location --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
VoC_UnitTarget[VoC_CurrentIndex] Not equal to No unit
Then - Actions
Custom script: set x2 = GetUnitX(udg_VoC_UnitTarget[udg_VoC_CurrentIndex])
Custom script: set y2 = GetUnitY(udg_VoC_UnitTarget[udg_VoC_CurrentIndex])
Custom script: call MoveLocation(udg_VoC_Location, x2, y2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(VoC_UnitTarget[VoC_CurrentIndex] is A ground unit) Equal to True
Then - Actions
Custom script: set z2 = GetLocationZ(udg_VoC_Location) + udg_VoC_UnitZ
Else - Actions
Custom script: set z2 = GetLocationZ(udg_VoC_Location) + GetUnitFlyHeight(udg_VoC_UnitTarget[udg_VoC_CurrentIndex])
Else - Actions
Custom script: set x2 = GetLocationX(udg_VoC_PointTarget[udg_VoC_CurrentIndex])
Custom script: set y2 = GetLocationY(udg_VoC_PointTarget[udg_VoC_CurrentIndex])
Custom script: call MoveLocation(udg_VoC_Location, x2, y2)
Custom script: set z2 = GetLocationZ(udg_VoC_Location) + udg_VoC_PointTargetZ[udg_VoC_CurrentIndex]
-------- For TargetSource Location --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
VoC_Duration[VoC_CurrentIndex] Greater than 0.00
(VoC_UnitSource[VoC_CurrentIndex] is alive) Equal to True
Then - Actions
Set VoC_Duration[VoC_CurrentIndex] = (VoC_Duration[VoC_CurrentIndex] - VoC_Interval)
Set VoC_LightningAlpha[VoC_CurrentIndex] = (VoC_LightningAlpha[VoC_CurrentIndex] - VoC_LightningFadeInterval[VoC_CurrentIndex])
Custom script: if udg_VoC_LightningAlpha[udg_VoC_CurrentIndex] < 0.00 then
Custom script: set udg_VoC_Duration[udg_VoC_CurrentIndex] = -0.01
Custom script: else
Custom script: call MoveLightningEx(udg_VoC_Lightning[udg_VoC_CurrentIndex], true, x1, y1, z1, x2, y2, z2)
Custom script: call SetLightningColor(udg_VoC_Lightning[udg_VoC_CurrentIndex], 1.00, 1.00, 1.00, udg_VoC_LightningAlpha[udg_VoC_CurrentIndex])
Custom script: endif
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
VoC_Timer[VoC_CurrentIndex] Greater than 0.00
Then - Actions
Set VoC_Timer[VoC_CurrentIndex] = (VoC_Timer[VoC_CurrentIndex] - 0.03)
Else - Actions
Unit - Cause VoC_UnitSource[VoC_CurrentIndex] to damage VoC_UnitTarget[VoC_CurrentIndex], dealing VoC_Damage[VoC_Level[VoC_CurrentIndex]] damage of attack type Spells and damage type Normal
Floating Text - Create floating text that reads (String((Integer(VoC_Damage[VoC_Level[VoC_CurrentIndex]])))) above VoC_UnitTarget[VoC_CurrentIndex] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
Set VoC_Timer[VoC_CurrentIndex] = 1.00
Set VoC_Distance_Between[VoC_CurrentIndex] = (Distance between VoC_PointSource[VoC_CurrentIndex] and VoC_PointTarget[VoC_CurrentIndex])
Set VoC_Angle_Between[VoC_CurrentIndex] = (Angle from VoC_PointSource[VoC_CurrentIndex] to VoC_PointTarget[VoC_CurrentIndex])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
VoC_Distance_Between[VoC_CurrentIndex] Greater than VoC_Distance_Border[VoC_Level[VoC_CurrentIndex]]
Then - Actions
Unit - Move VoC_UnitTarget[VoC_CurrentIndex] instantly to (VoC_PointSource[VoC_CurrentIndex] offset by VoC_Distance_Border[VoC_Level[VoC_CurrentIndex]] towards VoC_Angle_Between[VoC_CurrentIndex] degrees), facing Default building facing degrees
Custom script: call DestroyEffect(AddSpecialEffectTarget(udg_VoC_Effect_Model[1], udg_VoC_UnitTarget[udg_VoC_CurrentIndex],udg_VoC_Attachment[1]))
Else - Actions
Else - Actions
Lightning - Destroy VoC_Lightning[VoC_CurrentIndex]
Custom script: call RemoveLocation(udg_VoC_PointSource[udg_VoC_CurrentIndex])
Custom script: call RemoveLocation(udg_VoC_PointTarget[udg_VoC_CurrentIndex])
Set VoC_PointSource[VoC_CurrentIndex] = VoC_PointSource[VoC_MaxIndex]
Set VoC_PointTarget[VoC_CurrentIndex] = VoC_PointTarget[VoC_MaxIndex]
Set VoC_Duration[VoC_CurrentIndex] = VoC_Duration[VoC_MaxIndex]
Set VoC_Lightning[VoC_CurrentIndex] = VoC_Lightning[VoC_MaxIndex]
Set VoC_UnitSource[VoC_CurrentIndex] = VoC_UnitSource[VoC_MaxIndex]
Set VoC_UnitTarget[VoC_CurrentIndex] = VoC_UnitTarget[VoC_MaxIndex]
Set VoC_PointSourceZ[VoC_CurrentIndex] = VoC_PointSourceZ[VoC_MaxIndex]
Set VoC_PointTargetZ[VoC_CurrentIndex] = VoC_PointTargetZ[VoC_MaxIndex]
Set VoC_LightningName[VoC_CurrentIndex] = VoC_LightningName[VoC_MaxIndex]
Set VoC_LightningAlpha[VoC_CurrentIndex] = VoC_LightningAlpha[VoC_MaxIndex]
Set VoC_LightningFadeInterval[VoC_CurrentIndex] = VoC_LightningFadeInterval[VoC_MaxIndex]
Set VoC_CurrentIndex = (VoC_CurrentIndex - 1)
Set VoC_MaxIndex = (VoC_MaxIndex - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Trigger - Turn off VoC Loop <gen>
Else - Actions
Custom script: call RemoveLocation(udg_VoC_PointSource[udg_VoC_CurrentIndex])
Custom script: call RemoveLocation(udg_VoC_PointTarget[udg_VoC_CurrentIndex])
Last edited: Dec 31, 2012