- Joined
- Oct 6, 2022
- Messages
- 185
Well I do not know if it was dash in the first place or maybe i could also call it "move" or moving triangle shape, but so maybe I just thought that i could call it triangle dash was like that, sorry for the late replyWhy do you want to make a dash spell that returns to its original position?
Thats fine, it wasnt late. I wanted to make sure that there werent additional requirements to the spell. I spent a lot of time to create a dash/charge spell system using techniques I have seen used before and with a lot of configurability from trying to configure other systems myself. Its a very common approach that uses dynamic indexing. Tell me if it works for you or if you have any questions.Well I do not know if it was dash in the first place or maybe i could also call it "move" or moving triangle shape, but so maybe I just thought that i could call it triangle dash was like that, sorry for the late reply
Thanks, I'll use this as my other method if ever the caseThats fine, it wasnt late. I wanted to make sure that there werent additional requirements to the spell. I spent a lot of time to create a dash/charge spell system using techniques I have seen used before and with a lot of configurability from trying to configure other systems myself. Its a very common approach that uses dynamic indexing. Tell me if it works for you or if you have any questions.
Triangle Dash Start 1
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Fan of Knives
Actions
Set VariableSet DashMax = (DashMax + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashMax Equal to 1
Then - Actions
Trigger - Turn on Dash Periodic <gen>
Else - Actions
Set VariableSet DashUnit[DashMax] = (Triggering unit)
-------- Sets the amount of dashes --------
Set VariableSet DashAmount[DashMax] = 3
-------- Sets the distance of each dash --------
Set VariableSet DashDistance[DashMax] = 256.00
-------- Sets the distance traveled each period of 0.03 seconds. Needs to be dividable with DashDistance to a full integer --------
Set VariableSet DashSpeed[DashMax] = (DashDistance[DashMax] / 8.00)
-------- Saves the original angle of the casting unit --------
Set VariableSet DashAngleOriginal[DashMax] = (Facing of DashUnit[DashMax])
-------- Decides wether or not the original angle should be restored after the spell is finished --------
Set VariableSet DashAngleOriginalBool[DashMax] = True
-------- Sets the first angle --------
Set VariableSet DashAngle[DashMax] = (DashAngleOriginal[DashMax] + 30.00)
-------- Sets the changle in degrees for the next dashes if DashAmount is greater than 1. The angle is reduced by this amount --------
Set VariableSet DashAngleChange[DashMax] = 120.00
Unit - Make DashUnit[DashMax] face DashAngle[DashMax]
Animation - Play DashUnit[DashMax]'s attack animation
-------- Sets the animation the unit plays --------
Set VariableSet DashAnimationString[DashMax] = attack
-------- Sets the effect that continually occurs during the spell --------
Set VariableSet DashEffectString[DashMax] = Abilities\Spells\Orc\MirrorImage\MirrorImageCaster.mdl
-------- Sets how often the effect occurs --------
Set VariableSet DashEffectInterval[DashMax] = 2
-------- Sets if the effect occurs on the units position or on the unit itself --------
Set VariableSet DashEffectPointBool[DashMax] = True
-------- Configurable option to allow a customizable event to occur during each period or at the end of each dash --------
Set VariableSet DashType[DashMax] = 1
-------- Creates an effect on the unit that is destroyed when the spell is finished --------
Special Effect - Create a special effect attached to the chest of DashUnit[DashMax] using <Empty String>
Set VariableSet DashUnitEffect[DashMax] = (Last created special effect)
Unit Group - Add DashUnit[DashMax] to DashGroup
Countdown Timer - Start DashTimer as a One-shot timer that will expire in 0.00 seconds
Triangle Dash Start 2
Events
Time - DashTimer expires
Conditions
Actions
Unit Group - Pick every unit in DashGroup and do (Actions)
Loop - Actions
Custom script: call BlzPauseUnitEx(GetEnumUnit(), true)
Unit Group - Remove (Picked unit) from DashGroup.
EDIT: I forgot to add any check for pathing but it shouldnt matter for the Triangle Dash spell at least...
Dash Periodic
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer DashIndex) from 1 to DashMax, do (Actions)
Loop - Actions
Set VariableSet TempPoint[0] = (Position of DashUnit[DashIndex])
Set VariableSet TempPoint[1] = (TempPoint[0] offset by DashSpeed[DashIndex] towards DashAngle[DashIndex] degrees.)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and DashEffectInterval[DashIndex]) Equal to 1
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashEffectPointBool[DashIndex] Equal to True
Then - Actions
Special Effect - Create a special effect at TempPoint[1] using DashEffectString[DashIndex]
Else - Actions
Special Effect - Create a special effect attached to the origin of DashUnit[DashIndex] using DashEffectString[DashIndex]
Special Effect - Destroy (Last created special effect)
Else - Actions
Set VariableSet DashX = (X of TempPoint[1])
Set VariableSet DashY = (Y of TempPoint[1])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashType[DashIndex] Equal to 1
Then - Actions
Else - Actions
Custom script: call SetUnitX(udg_DashUnit[udg_DashIndex], udg_DashX)
Custom script: call SetUnitY(udg_DashUnit[udg_DashIndex], udg_DashY)
Custom script: call RemoveLocation(udg_TempPoint[0])
Custom script: call RemoveLocation(udg_TempPoint[1])
Set VariableSet DashDistanceProgress[DashIndex] = (DashDistanceProgress[DashIndex] + DashSpeed[DashIndex])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashDistanceProgress[DashIndex] Greater than or equal to DashDistance[DashIndex]
Then - Actions
Set VariableSet DashDistanceProgress[DashIndex] = 0.00
Set VariableSet DashAngle[DashIndex] = (DashAngle[DashIndex] - DashAngleChange[DashIndex])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashType[DashIndex] Equal to 1
Then - Actions
Else - Actions
Set VariableSet DashAmount[DashIndex] = (DashAmount[DashIndex] - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashAmount[DashIndex] Equal to 0
Then - Actions
Custom script: call BlzPauseUnitEx(udg_DashUnit[udg_DashIndex], false)
Animation - Queue DashUnit[DashIndex]'s stand animation
Special Effect - Destroy DashUnitEffect[DashIndex]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashAngleOriginalBool[DashIndex] Equal to True
Then - Actions
Unit - Make DashUnit[DashIndex] face DashAngleOriginal[DashIndex]
Else - Actions
Set VariableSet DashAmount[DashIndex] = DashAmount[DashMax]
Set VariableSet DashAngle[DashIndex] = DashAngle[DashMax]
Set VariableSet DashAngleChange[DashIndex] = DashAngleChange[DashMax]
Set VariableSet DashAngleOriginal[DashIndex] = DashAngleOriginal[DashMax]
Set VariableSet DashAngleOriginalBool[DashIndex] = DashAngleOriginalBool[DashMax]
Set VariableSet DashDistance[DashIndex] = DashDistance[DashMax]
Set VariableSet DashDistanceProgress[DashIndex] = DashDistanceProgress[DashMax]
Set VariableSet DashSpeed[DashIndex] = DashSpeed[DashMax]
Set VariableSet DashUnit[DashIndex] = DashUnit[DashMax]
Set VariableSet DashUnitEffect[DashIndex] = DashUnitEffect[DashMax]
Set VariableSet DashAnimationString[DashIndex] = DashAnimationString[DashMax]
Set VariableSet DashEffectString[DashIndex] = DashEffectString[DashMax]
Set VariableSet DashEffectInterval[DashIndex] = DashEffectInterval[DashMax]
Set VariableSet DashEffectPointBool[DashIndex] = DashEffectPointBool[DashMax]
Set VariableSet DashType[DashIndex] = DashType[DashMax]
Set VariableSet DashMax = (DashMax - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DashMax Equal to 0
Then - Actions
Trigger - Turn off Dash Periodic <gen>
Else - Actions
Else - Actions
Unit - Make DashUnit[DashIndex] face DashAngle[DashIndex]
Else - Actions
Facing angle - 45 degrees with an offset of 200 = first point
Facing angle + 45 degrees with an offset of 200 = second point
third point = the starting position of the unit.