Well I've been working on this "shove" spell for quite some hours today, however I still got problems to get it to work (not even MUI).
Here's the code:
Right now all it does it push back a unit the first time I use it. Then when I use it again it won't do anything. I've troubleshooted the trigger and I've found out that the reason why it doesn't do it the second time is because it in the knockback trigger doesn't pick any units:
I know the code is one big mess and such, also the reason why I use arrays is because I want to make it MUI (later when I get it to work).
I've had so much trouble with this spell thus any help is greatly appreciated!
Also I know that there are other problems with the spell than the one I pointed out here, however I need to start somewhere which is why I want to fix that error first.
Here's the code:
Trigger:
- Shove Start
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Shove
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Shove_Customvalue Less than 100
- Then - Actions
- Set Shove_Customvalue = (Shove_Customvalue + 1)
- Else - Actions
- Set Shove_Customvalue = 1
- If - Conditions
- Set Shove_Angle[Shove_Customvalue] = (Facing of (Triggering unit))
- Set Shove_Caster[Shove_Customvalue] = (Triggering unit)
- Set Shove_CasterPoint[Shove_Customvalue] = (Position of (Triggering unit))
- Set Shove_Group[Shove_Customvalue] = (Units within 600.00 of Shove_CasterPoint[Shove_Customvalue] matching ((Unit-type of (Matching unit)) Equal to Gnoll))
- Unit Group - Pick every unit in Shove_Group[Shove_Customvalue] and do (Actions)
- Loop - Actions
- Set Shove_TargetPoint[Shove_Customvalue] = (Position of (Picked unit))
- Set Shove_DistanceAngle[Shove_Customvalue] = (Angle from Shove_CasterPoint[Shove_Customvalue] to Shove_TargetPoint[Shove_Customvalue])
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Shove_DistanceAngle[Shove_Customvalue] Less than 0.00
- Then - Actions
- Set Shove_DistanceAngle[Shove_Customvalue] = (Shove_DistanceAngle[Shove_Customvalue] + 360.00)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Shove_DistanceAngle[Shove_Customvalue] Less than (Shove_Angle[Shove_Customvalue] + 60.00)
- Shove_DistanceAngle[Shove_Customvalue] Greater than (Shove_Angle[Shove_Customvalue] - 60.00)
- Then - Actions
- Unit Group - Add (Picked unit) to Shove_PushUnits[Shove_Customvalue]
- Trigger - Turn on Knockback <gen>
- Else - Actions
- If - Conditions
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
Trigger:
- **INITIALLY OFF**
- Knockback
- Events
- Time - Every 0.02 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in Shove_PushUnits[Shove_Customvalue] and do (Actions)
- Loop - Actions
- Unit - Move (Picked unit) instantly to (Shove_TargetPoint[Shove_Customvalue] offset by 3.00 towards Shove_DistanceAngle[Shove_Customvalue] degrees)
- Set Shove_TargetPoint[Shove_Customvalue] = (Position of (Picked unit))
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Shove_Knockbackoff Less than 100
- Then - Actions
- Set Shove_Knockbackoff = (Shove_Knockbackoff + 1)
- Else - Actions
- Set Shove_Knockbackoff = 0
- Trigger - Turn off (This trigger)
- If - Conditions
- Unit Group - Pick every unit in Shove_PushUnits[Shove_Customvalue] and do (Actions)
- Events
- Knockback
Right now all it does it push back a unit the first time I use it. Then when I use it again it won't do anything. I've troubleshooted the trigger and I've found out that the reason why it doesn't do it the second time is because it in the knockback trigger doesn't pick any units:
Trigger:
- Unit Group - Pick every unit in Shove_PushUnits[Shove_Customvalue] and do (Actions)
- Loop - Actions
- **The trigger doesn't get here on the second use**
- Unit - Move (Picked unit) instantly to (Shove_TargetPoint[Shove_Customvalue] offset by 3.00 towards Shove_DistanceAngle[Shove_Customvalue] degrees)
- Set Shove_TargetPoint[Shove_Customvalue] = (Position of (Picked unit))
- Loop - Actions
I know the code is one big mess and such, also the reason why I use arrays is because I want to make it MUI (later when I get it to work).
I've had so much trouble with this spell thus any help is greatly appreciated!
Also I know that there are other problems with the spell than the one I pointed out here, however I need to start somewhere which is why I want to fix that error first.