- Joined
- Mar 29, 2012
- Messages
- 542
Hey guys i have a problem in my spell 'Knockback'...
Spell Description :
Knock the target backwards, dealing bonus damage when hit tree.
Level 1 - 50 knock damage, 10 tree damage.
Level 2 - 75 knock damage, 15 tree damage.
Level 3 - 100 knock damage, 20 tree damage.
Problem that i found using debug message :
The caster cast the spell on some unit, but when cast sometimes the distance change to correct value and sometimes change to wrong value.
Example :
The first cast the distance set to 400, the second cast the distance set to -10, -20, or -30. The third cast the distance set to 400.
Here is the triggers
Spell Description :
Knock the target backwards, dealing bonus damage when hit tree.
Level 1 - 50 knock damage, 10 tree damage.
Level 2 - 75 knock damage, 15 tree damage.
Level 3 - 100 knock damage, 20 tree damage.
Problem that i found using debug message :
The caster cast the spell on some unit, but when cast sometimes the distance change to correct value and sometimes change to wrong value.
Example :
The first cast the distance set to 400, the second cast the distance set to -10, -20, or -30. The third cast the distance set to 400.
Here is the triggers
[trigger=]K Configuration
Events
Map initialization
Conditions
Actions
-------- CONFIGURABLE --------
-------- set the distance to knock the target --------
Set K_Max_Distance[1] = 400.00
Set K_Max_Distance[2] = 500.00
Set K_Max_Distance[3] = 600.00
-------- set the speed when target is knocked --------
Set K_Knock_Speed[1] = 30.00
Set K_Knock_Speed[2] = 30.00
Set K_Knock_Speed[3] = 30.00
-------- set the damage to target --------
Set K_Damage[1] = 50.00
Set K_Damage[2] = 75.00
Set K_Damage[3] = 100.00
-------- set the damage to target when target hit tree --------
Set K_Bonus_Damage[1] = 10.00
Set K_Bonus_Damage[2] = 15.00
Set K_Bonus_Damage[3] = 20.00
-------- set the range to detect nearby tree of target --------
Set K_Target_AoE = 150.00
-------- set the effect when the target start knocked --------
Set K_Effect[1] = Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
-------- set the effect when the target is knocking back --------
Set K_Effect[2] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
-------- set the effect when the target is knocked --------
Set K_Effect[3] = Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
-------- set the attack type --------
Set K_Attack_Type = Normal
-------- set the damage type --------
Set K_Damage_Type = Defensive
[/trigger]
Events
Map initialization
Conditions
Actions
-------- CONFIGURABLE --------
-------- set the distance to knock the target --------
Set K_Max_Distance[1] = 400.00
Set K_Max_Distance[2] = 500.00
Set K_Max_Distance[3] = 600.00
-------- set the speed when target is knocked --------
Set K_Knock_Speed[1] = 30.00
Set K_Knock_Speed[2] = 30.00
Set K_Knock_Speed[3] = 30.00
-------- set the damage to target --------
Set K_Damage[1] = 50.00
Set K_Damage[2] = 75.00
Set K_Damage[3] = 100.00
-------- set the damage to target when target hit tree --------
Set K_Bonus_Damage[1] = 10.00
Set K_Bonus_Damage[2] = 15.00
Set K_Bonus_Damage[3] = 20.00
-------- set the range to detect nearby tree of target --------
Set K_Target_AoE = 150.00
-------- set the effect when the target start knocked --------
Set K_Effect[1] = Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
-------- set the effect when the target is knocking back --------
Set K_Effect[2] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
-------- set the effect when the target is knocked --------
Set K_Effect[3] = Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
-------- set the attack type --------
Set K_Attack_Type = Normal
-------- set the damage type --------
Set K_Damage_Type = Defensive
[/trigger]
[trigger=]K Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Knockback
Actions
-------- START --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
K_Index_Size Equal to 0
Then - Actions
Trigger - Turn on K Loop <gen>
Else - Actions
Set K_Index_Size = (K_Index_Size + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
K_Index_Size Greater than K_Max_Index
Then - Actions
Set K_Index[K_Index_Size] = K_Index_Size
Set K_Max_Index = K_Index_Size
Else - Actions
Set K_Current_Index = K_Index[K_Index_Size]
Set K_Caster[K_Current_Index] = (Triggering unit)
Set K_Target[K_Current_Index] = (Target unit of ability being cast)
Set K_Level = (Level of (Ability being cast) for K_Caster[K_Current_Index])
Set K_Max_Distance[K_Current_Index] = K_Max_Distance[K_Level]
Set K_Knock_Speed[K_Current_Index] = K_Knock_Speed[K_Level]
Set K_Damage[K_Current_Index] = K_Damage[K_Level]
Set K_Bonus_Damage[K_Current_Index] = K_Bonus_Damage[K_Level]
Set Temp_Point = (Position of K_Caster[K_Current_Index])
Set Temp_Point2 = (Position of K_Target[K_Current_Index])
Set K_Angle[K_Current_Index] = (Angle from Temp_Point to Temp_Point2)
Custom script: call RemoveLocation(udg_Temp_Point)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is A flying unit) Equal to True
Then - Actions
Special Effect - Create a special effect attached to the origin of K_Target[K_Current_Index] using K_Effect[1]
Special Effect - Destroy (Last created special effect)
Else - Actions
Special Effect - Create a special effect at Temp_Point2 using K_Effect[1]
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Temp_Point2)
[/trigger]
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Knockback
Actions
-------- START --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
K_Index_Size Equal to 0
Then - Actions
Trigger - Turn on K Loop <gen>
Else - Actions
Set K_Index_Size = (K_Index_Size + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
K_Index_Size Greater than K_Max_Index
Then - Actions
Set K_Index[K_Index_Size] = K_Index_Size
Set K_Max_Index = K_Index_Size
Else - Actions
Set K_Current_Index = K_Index[K_Index_Size]
Set K_Caster[K_Current_Index] = (Triggering unit)
Set K_Target[K_Current_Index] = (Target unit of ability being cast)
Set K_Level = (Level of (Ability being cast) for K_Caster[K_Current_Index])
Set K_Max_Distance[K_Current_Index] = K_Max_Distance[K_Level]
Set K_Knock_Speed[K_Current_Index] = K_Knock_Speed[K_Level]
Set K_Damage[K_Current_Index] = K_Damage[K_Level]
Set K_Bonus_Damage[K_Current_Index] = K_Bonus_Damage[K_Level]
Set Temp_Point = (Position of K_Caster[K_Current_Index])
Set Temp_Point2 = (Position of K_Target[K_Current_Index])
Set K_Angle[K_Current_Index] = (Angle from Temp_Point to Temp_Point2)
Custom script: call RemoveLocation(udg_Temp_Point)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is A flying unit) Equal to True
Then - Actions
Special Effect - Create a special effect attached to the origin of K_Target[K_Current_Index] using K_Effect[1]
Special Effect - Destroy (Last created special effect)
Else - Actions
Special Effect - Create a special effect at Temp_Point2 using K_Effect[1]
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Temp_Point2)
[/trigger]
[trigger=]K Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer K_Loop) from 1 to K_Index_Size, do (Actions)
Loop - Actions
Set K_Current_Index = K_Index[K_Loop]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(K_Target[K_Current_Index] is alive) Equal to True
K_Max_Distance[K_Current_Index] Greater than 0.00
Then - Actions
Set Temp_Point = (Position of K_Target[K_Current_Index])
Set Temp_Point2 = (Temp_Point offset by K_Knock_Speed[K_Current_Index] towards K_Angle[K_Current_Index] degrees)
Set K_Point_X = (X of Temp_Point2)
Set K_Point_Y = (Y of Temp_Point2)
Custom script: call RemoveLocation(udg_Temp_Point)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is A flying unit) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain pathing at Temp_Point2 of type Flyability is off) Equal to True
Then - Actions
Set K_Max_Distance[K_Current_Index] = 0.00
Else - Actions
Custom script: call SetUnitX(udg_K_Target[udg_K_Current_Index], udg_K_Point_X)
Custom script: call SetUnitY(udg_K_Target[udg_K_Current_Index], udg_K_Point_Y)
Special Effect - Create a special effect attached to the origin of K_Target[K_Current_Index] using K_Effect[2]
Special Effect - Destroy (Last created special effect)
Else - Actions
Set Temp_Point = (Position of K_Target[K_Current_Index])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain pathing at Temp_Point2 of type Walkability is off) Equal to True
Then - Actions
Set K_Max_Distance[K_Current_Index] = 0.00
Else - Actions
Custom script: call SetUnitX(udg_K_Target[udg_K_Current_Index], udg_K_Point_X)
Custom script: call SetUnitY(udg_K_Target[udg_K_Current_Index], udg_K_Point_Y)
Special Effect - Create a special effect at Temp_Point using K_Effect[2]
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Temp_Point)
Destructible - Pick every destructible within K_Target_AoE of Temp_Point2 and do (Actions)
Loop - Actions
Unit - Order Harvester to Harvest (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current order of Harvester) Equal to (Order(harvest))
Then - Actions
Destructible - Kill (Picked destructible)
Unit - Cause K_Caster[K_Current_Index] to damage K_Target[K_Current_Index], dealing K_Bonus_Damage[K_Current_Index] damage of attack type K_Attack_Type and damage type K_Damage_Type
Else - Actions
Unit - Order Harvester to Stop
Custom script: call RemoveLocation(udg_Temp_Point2)
Set K_Max_Distance[K_Current_Index] = (K_Max_Distance[K_Current_Index] - K_Knock_Speed[K_Current_Index])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is alive) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is A flying unit) Equal to True
Then - Actions
Special Effect - Create a special effect attached to the origin of K_Target[K_Current_Index] using K_Effect[3]
Special Effect - Destroy (Last created special effect)
Else - Actions
Set Temp_Point = (Position of K_Target[K_Current_Index])
Special Effect - Create a special effect at Temp_Point using K_Effect[3]
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Cause K_Caster[K_Current_Index] to damage K_Target[K_Current_Index], dealing K_Damage[K_Current_Index] damage of attack type K_Attack_Type and damage type K_Damage_Type
Else - Actions
-------- END --------
Set K_Index[K_Loop] = K_Index[K_Index_Size]
Set K_Index[K_Index_Size] = K_Current_Index
Set K_Index_Size = (K_Index_Size - 1)
Set K_Loop = (K_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
K_Index_Size Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Skip remaining actions
Else - Actions
[/trigger]
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer K_Loop) from 1 to K_Index_Size, do (Actions)
Loop - Actions
Set K_Current_Index = K_Index[K_Loop]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(K_Target[K_Current_Index] is alive) Equal to True
K_Max_Distance[K_Current_Index] Greater than 0.00
Then - Actions
Set Temp_Point = (Position of K_Target[K_Current_Index])
Set Temp_Point2 = (Temp_Point offset by K_Knock_Speed[K_Current_Index] towards K_Angle[K_Current_Index] degrees)
Set K_Point_X = (X of Temp_Point2)
Set K_Point_Y = (Y of Temp_Point2)
Custom script: call RemoveLocation(udg_Temp_Point)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is A flying unit) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain pathing at Temp_Point2 of type Flyability is off) Equal to True
Then - Actions
Set K_Max_Distance[K_Current_Index] = 0.00
Else - Actions
Custom script: call SetUnitX(udg_K_Target[udg_K_Current_Index], udg_K_Point_X)
Custom script: call SetUnitY(udg_K_Target[udg_K_Current_Index], udg_K_Point_Y)
Special Effect - Create a special effect attached to the origin of K_Target[K_Current_Index] using K_Effect[2]
Special Effect - Destroy (Last created special effect)
Else - Actions
Set Temp_Point = (Position of K_Target[K_Current_Index])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain pathing at Temp_Point2 of type Walkability is off) Equal to True
Then - Actions
Set K_Max_Distance[K_Current_Index] = 0.00
Else - Actions
Custom script: call SetUnitX(udg_K_Target[udg_K_Current_Index], udg_K_Point_X)
Custom script: call SetUnitY(udg_K_Target[udg_K_Current_Index], udg_K_Point_Y)
Special Effect - Create a special effect at Temp_Point using K_Effect[2]
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Temp_Point)
Destructible - Pick every destructible within K_Target_AoE of Temp_Point2 and do (Actions)
Loop - Actions
Unit - Order Harvester to Harvest (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current order of Harvester) Equal to (Order(harvest))
Then - Actions
Destructible - Kill (Picked destructible)
Unit - Cause K_Caster[K_Current_Index] to damage K_Target[K_Current_Index], dealing K_Bonus_Damage[K_Current_Index] damage of attack type K_Attack_Type and damage type K_Damage_Type
Else - Actions
Unit - Order Harvester to Stop
Custom script: call RemoveLocation(udg_Temp_Point2)
Set K_Max_Distance[K_Current_Index] = (K_Max_Distance[K_Current_Index] - K_Knock_Speed[K_Current_Index])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is alive) Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(K_Target[K_Current_Index] is A flying unit) Equal to True
Then - Actions
Special Effect - Create a special effect attached to the origin of K_Target[K_Current_Index] using K_Effect[3]
Special Effect - Destroy (Last created special effect)
Else - Actions
Set Temp_Point = (Position of K_Target[K_Current_Index])
Special Effect - Create a special effect at Temp_Point using K_Effect[3]
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Cause K_Caster[K_Current_Index] to damage K_Target[K_Current_Index], dealing K_Damage[K_Current_Index] damage of attack type K_Attack_Type and damage type K_Damage_Type
Else - Actions
-------- END --------
Set K_Index[K_Loop] = K_Index[K_Index_Size]
Set K_Index[K_Index_Size] = K_Current_Index
Set K_Index_Size = (K_Index_Size - 1)
Set K_Loop = (K_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
K_Index_Size Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Skip remaining actions
Else - Actions
[/trigger]