- Joined
- Mar 15, 2012
- Messages
- 2,887
Never mind... I fixed it.
[trigger=Casting]
Charge
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Charge
Actions
Set p2 = (Target point of ability being cast)
Set Dat_C_Index = (Dat_C_Index + 1)
Set Dat_C_Caster[Dat_C_Index] = (Triggering unit)
Set p = (Position of Dat_C_Caster[Dat_C_Index])
Set Dat_C_Timer[Dat_C_Index] = 90
Set Dat_C_Angle[Dat_C_Index] = (Angle from p to p2)
Unit - Add Feet SFX Charging to Dat_C_Caster[Dat_C_Index]
Custom script: call RemoveLocation(udg_p)
Custom script: call RemoveLocation(udg_p2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 1
Then - Actions
Trigger - Turn on Charge Loop <gen>
Else - Actions
[/trigger]
[trigger=Loop]
Charge Loop
Events
Time - dattimer expires
Conditions
Actions
For each (Integer Dat_C_Loop) from 1 to Dat_C_Index, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Timer[Dat_C_Loop] Less than or equal to 0
Then - Actions
Unit - Remove Feet SFX Charging from Dat_C_Caster[Dat_C_Loop]
Set Dat_C_Caster[Dat_C_Loop] = Dat_C_Caster[Dat_C_Index]
Set Dat_C_Caster[Dat_C_Index] = No unit
Set Dat_C_Timer[Dat_C_Loop] = Dat_C_Timer[Dat_C_Index]
Set Dat_C_Angle[Dat_C_Loop] = Dat_C_Angle[Dat_C_Index]
Set Dat_C_Index = (Dat_C_Index - 1)
Set Dat_C_Loop = (Dat_C_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
Set Dat_C_Timer[Dat_C_Loop] = (Dat_C_Timer[Dat_C_Loop] - 1)
Set Dat_C_Point_Private = (Position of Dat_C_Caster[Dat_C_Loop])
Special Effect - Create a special effect at Dat_C_Point_Private using Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Dat_C_Point_Private)
Custom script: call SetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop]) + 50 * Cos(udg_Dat_C_Angle[udg_Dat_C_Loop]) * bj_DEGTORAD)
Custom script: call SetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop]) + 50 * Sin(udg_Dat_C_Angle[udg_Dat_C_Loop]) * bj_DEGTORAD)
[/trigger]
The timer event is also working fine and is started in another trigger so it can't be because there is no timer running. The trigger isn't turned off either.
The problem is the unit doesn't move correctly as well it doesn't move correctly to the target point. It moves too slow to some other angle.
For anyone wondering what the fix was... It was the following. Thanks for reading.
Yes I know I got some indexing stuff to fix as well. Though at least the movement is resolved. =)
[trigger=Casting]
Charge
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Charge
Actions
Set p2 = (Target point of ability being cast)
Set Dat_C_Index = (Dat_C_Index + 1)
Set Dat_C_Caster[Dat_C_Index] = (Triggering unit)
Set p = (Position of Dat_C_Caster[Dat_C_Index])
Set Dat_C_Timer[Dat_C_Index] = 90
Set Dat_C_Angle[Dat_C_Index] = (Angle from p to p2)
Unit - Add Feet SFX Charging to Dat_C_Caster[Dat_C_Index]
Custom script: call RemoveLocation(udg_p)
Custom script: call RemoveLocation(udg_p2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 1
Then - Actions
Trigger - Turn on Charge Loop <gen>
Else - Actions
[/trigger]
[trigger=Loop]
Charge Loop
Events
Time - dattimer expires
Conditions
Actions
For each (Integer Dat_C_Loop) from 1 to Dat_C_Index, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Timer[Dat_C_Loop] Less than or equal to 0
Then - Actions
Unit - Remove Feet SFX Charging from Dat_C_Caster[Dat_C_Loop]
Set Dat_C_Caster[Dat_C_Loop] = Dat_C_Caster[Dat_C_Index]
Set Dat_C_Caster[Dat_C_Index] = No unit
Set Dat_C_Timer[Dat_C_Loop] = Dat_C_Timer[Dat_C_Index]
Set Dat_C_Angle[Dat_C_Loop] = Dat_C_Angle[Dat_C_Index]
Set Dat_C_Index = (Dat_C_Index - 1)
Set Dat_C_Loop = (Dat_C_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
Set Dat_C_Timer[Dat_C_Loop] = (Dat_C_Timer[Dat_C_Loop] - 1)
Set Dat_C_Point_Private = (Position of Dat_C_Caster[Dat_C_Loop])
Special Effect - Create a special effect at Dat_C_Point_Private using Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Dat_C_Point_Private)
Custom script: call SetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop]) + 50 * Cos(udg_Dat_C_Angle[udg_Dat_C_Loop]) * bj_DEGTORAD)
Custom script: call SetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop]) + 50 * Sin(udg_Dat_C_Angle[udg_Dat_C_Loop]) * bj_DEGTORAD)
[/trigger]
The timer event is also working fine and is started in another trigger so it can't be because there is no timer running. The trigger isn't turned off either.
The problem is the unit doesn't move correctly as well it doesn't move correctly to the target point. It moves too slow to some other angle.
For anyone wondering what the fix was... It was the following. Thanks for reading.
[trigger=]
Charge
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Charge
Actions
Set p2 = (Target point of ability being cast)
Set Dat_C_Index = (Dat_C_Index + 1)
Set Dat_C_Caster[Dat_C_Index] = (Triggering unit)
Set p = (Position of Dat_C_Caster[Dat_C_Index])
Set Dat_C_Timer[Dat_C_Index] = 90
Set Dat_C_Angle[Dat_C_Index] = (Angle from p to p2)
Set Dat_C_Speed[Dat_C_Index] = 35.00
Set Dat_C_X[Dat_C_Index] = (Dat_C_Speed[Dat_C_Index] x (Cos(Dat_C_Angle[Dat_C_Index])))
Set Dat_C_Y[Dat_C_Index] = (Dat_C_Speed[Dat_C_Index] x (Sin(Dat_C_Angle[Dat_C_Index])))
Unit - Add Feet SFX Charging to Dat_C_Caster[Dat_C_Index]
Custom script: call RemoveLocation(udg_p)
Custom script: call RemoveLocation(udg_p2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 1
Then - Actions
Trigger - Turn on Charge Loop <gen>
Else - Actions
[/trigger]
[trigger=]
Charge Loop
Events
Time - dattimer expires
Conditions
Actions
For each (Integer Dat_C_Loop) from 1 to Dat_C_Index, 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
Dat_C_Timer[Dat_C_Loop] Less than or equal to 0
Dat_C_Speed[Dat_C_Loop] Less than or equal to 0.00
Then - Actions
Unit - Remove Feet SFX Charging from Dat_C_Caster[Dat_C_Loop]
Set Dat_C_Caster[Dat_C_Loop] = Dat_C_Caster[Dat_C_Index]
Set Dat_C_Caster[Dat_C_Index] = No unit
Set Dat_C_Timer[Dat_C_Loop] = Dat_C_Timer[Dat_C_Index]
Set Dat_C_Angle[Dat_C_Loop] = Dat_C_Angle[Dat_C_Index]
Set Dat_C_Index = (Dat_C_Index - 1)
Set Dat_C_Loop = (Dat_C_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
Set Dat_C_Timer[Dat_C_Loop] = (Dat_C_Timer[Dat_C_Loop] - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 2) Equal to 1
Then - Actions
Set Dat_C_Point_Private = (Position of Dat_C_Caster[Dat_C_Loop])
Special Effect - Create a special effect at Dat_C_Point_Private using Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Dat_C_Point_Private)
Else - Actions
Set Dat_C_Speed[Dat_C_Loop] = (Dat_C_Speed[Dat_C_Loop] - 1.00)
Set Dat_C_Angle[Dat_C_Loop] = (Atan2(Dat_C_Y[Dat_C_Loop], Dat_C_X[Dat_C_Loop]))
Set Dat_C_X[Dat_C_Loop] = (Dat_C_Speed[Dat_C_Loop] x (Cos(Dat_C_Angle[Dat_C_Loop])))
Set Dat_C_Y[Dat_C_Loop] = (Dat_C_Speed[Dat_C_Loop] x (Sin(Dat_C_Angle[Dat_C_Loop])))
Custom script: call SetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop]) + udg_Dat_C_X[udg_Dat_C_Loop] )
Custom script: call SetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop]) + udg_Dat_C_Y[udg_Dat_C_Loop] )
[/trigger]
Charge
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Charge
Actions
Set p2 = (Target point of ability being cast)
Set Dat_C_Index = (Dat_C_Index + 1)
Set Dat_C_Caster[Dat_C_Index] = (Triggering unit)
Set p = (Position of Dat_C_Caster[Dat_C_Index])
Set Dat_C_Timer[Dat_C_Index] = 90
Set Dat_C_Angle[Dat_C_Index] = (Angle from p to p2)
Set Dat_C_Speed[Dat_C_Index] = 35.00
Set Dat_C_X[Dat_C_Index] = (Dat_C_Speed[Dat_C_Index] x (Cos(Dat_C_Angle[Dat_C_Index])))
Set Dat_C_Y[Dat_C_Index] = (Dat_C_Speed[Dat_C_Index] x (Sin(Dat_C_Angle[Dat_C_Index])))
Unit - Add Feet SFX Charging to Dat_C_Caster[Dat_C_Index]
Custom script: call RemoveLocation(udg_p)
Custom script: call RemoveLocation(udg_p2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 1
Then - Actions
Trigger - Turn on Charge Loop <gen>
Else - Actions
[/trigger]
[trigger=]
Charge Loop
Events
Time - dattimer expires
Conditions
Actions
For each (Integer Dat_C_Loop) from 1 to Dat_C_Index, 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
Dat_C_Timer[Dat_C_Loop] Less than or equal to 0
Dat_C_Speed[Dat_C_Loop] Less than or equal to 0.00
Then - Actions
Unit - Remove Feet SFX Charging from Dat_C_Caster[Dat_C_Loop]
Set Dat_C_Caster[Dat_C_Loop] = Dat_C_Caster[Dat_C_Index]
Set Dat_C_Caster[Dat_C_Index] = No unit
Set Dat_C_Timer[Dat_C_Loop] = Dat_C_Timer[Dat_C_Index]
Set Dat_C_Angle[Dat_C_Loop] = Dat_C_Angle[Dat_C_Index]
Set Dat_C_Index = (Dat_C_Index - 1)
Set Dat_C_Loop = (Dat_C_Loop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Dat_C_Index Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
Set Dat_C_Timer[Dat_C_Loop] = (Dat_C_Timer[Dat_C_Loop] - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 2) Equal to 1
Then - Actions
Set Dat_C_Point_Private = (Position of Dat_C_Caster[Dat_C_Loop])
Special Effect - Create a special effect at Dat_C_Point_Private using Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Dat_C_Point_Private)
Else - Actions
Set Dat_C_Speed[Dat_C_Loop] = (Dat_C_Speed[Dat_C_Loop] - 1.00)
Set Dat_C_Angle[Dat_C_Loop] = (Atan2(Dat_C_Y[Dat_C_Loop], Dat_C_X[Dat_C_Loop]))
Set Dat_C_X[Dat_C_Loop] = (Dat_C_Speed[Dat_C_Loop] x (Cos(Dat_C_Angle[Dat_C_Loop])))
Set Dat_C_Y[Dat_C_Loop] = (Dat_C_Speed[Dat_C_Loop] x (Sin(Dat_C_Angle[Dat_C_Loop])))
Custom script: call SetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitX(udg_Dat_C_Caster[udg_Dat_C_Loop]) + udg_Dat_C_X[udg_Dat_C_Loop] )
Custom script: call SetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop], GetUnitY(udg_Dat_C_Caster[udg_Dat_C_Loop]) + udg_Dat_C_Y[udg_Dat_C_Loop] )
[/trigger]
Yes I know I got some indexing stuff to fix as well. Though at least the movement is resolved. =)
Last edited: