Curo
Why am I still playing this game...?
- Reaction score
- 109
Been a while since I've asked for help here. Basically, I have a periodic forced movement/knockback system that utilizes hashtables to track individual units. Pretty simple, but I made it from scratch (almost), so it doesn't work.
I'd also appreciate any tips at making it more efficient.
I've added in debug display text lines to find when it stops working. It stops at the following line in the second trigger:
None of the actions afterward are performed. TempRl is a real variable array (size 10). Here are both relevant triggers. The first one works fine. The second one stops 4 action lines in, as noted above:
I'd also appreciate any tips at making it more efficient.
I've added in debug display text lines to find when it stops working. It stops at the following line in the second trigger:
Trigger:
- Set TempRl[1] = (0.04 x ((Load (Key distance) of (Key (Picked unit)) from movement_table) / (Load (Key speed) of (Key (Picked unit)) from movement_table)))
None of the actions afterward are performed. TempRl is a real variable array (size 10). Here are both relevant triggers. The first one works fine. The second one stops 4 action lines in, as noted above:
Trigger:
- Knockback Spell
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Knockback
- Actions
- Set TempPoint[1] = (Position of (Triggering unit))
- Set TempPoint[2] = (Position of (Target unit of ability being cast))
- Hashtable - Save (Angle from TempPoint[1] to TempPoint[2]) as (Key angle) of (Key (Target unit of ability being cast)) in movement_table
- Custom script: call RemoveLocation (udg_TempPoint[1])
- Custom script: call RemoveLocation (udg_TempPoint[2])
- Hashtable - Save 400.00 as (Key distance) of (Key (Target unit of ability being cast)) in movement_table
- Hashtable - Save 400.00 as (Key distance remaining) of (Key (Target unit of ability being cast)) in movement_table
- Hashtable - Save 1.00 as (Key speed) of (Key (Target unit of ability being cast)) in movement_table
- Hashtable - Save True as (Key destroys trees) of (Key (Target unit of ability being cast)) in movement_table
- Hashtable - Save Abilities\Spells\Human\FlakCannons\FlakTarget.mdl as (Key effect) of (Key (Target unit of ability being cast)) in movement_table
- Unit Group - Add (Target unit of ability being cast) to knockback_group
- Events
Trigger:
- Movement
- Events
- Time - Every 0.04 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in knockback_group and do (Actions)
- Loop - Actions
- Set TempUnit = (Picked unit)
- Set TempRl[1] = (0.04 x ((Load (Key distance) of (Key (Picked unit)) from movement_table) / (Load (Key speed) of (Key (Picked unit)) from movement_table)))
- Set TempPoint[1] = (Position of TempUnit)
- Set TempPoint[2] = (TempPoint[1] offset by TempRl[1] towards (Load (Key angle) of (Key (Picked unit)) from movement_table) degrees)
- Custom script: call RemoveLocation (udg_TempPoint[1])
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (TempUnit is Snared) Equal to False
- TempUnit Not equal to boss[11]
- TempUnit Not equal to boss[13]
- Then - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Load (Key destroys trees) of (Key (Picked unit)) from movement_table) Equal to True
- Then - Actions
- Destructible - Pick every destructible within 100.00 of TempPoint[2] and do (If ((((Destructible-type of (Picked destructible)) Equal to Winter Tree Wall) or ((Destructible-type of (Picked destructible)) Equal to Ashenvale Tree Wall)) or ((Destructible-type of (Picked destructible)) Equal to Ashenvale Canopy Tree)) then do (Destructi
- Else - Actions
- If - Conditions
- Unit - Move TempUnit instantly to TempPoint[2]
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
- If - Conditions
- Set TempRl[2] = ((Load (Key distance remaining) of (Key (Picked unit)) from movement_table) - TempRl[1])
- Set TempString = (Load (Key effect) of (Key (Picked unit)) from movement_table)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- TempString Not equal to <Empty String>
- Then - Actions
- Special Effect - Create a special effect at TempPoint[2] using TempString
- Special Effect - Destroy (Last created special effect)
- Else - Actions
- If - Conditions
- Custom script: call RemoveLocation (udg_TempPoint[2])
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- TempRl[2] Greater than 0.00
- Then - Actions
- Hashtable - Save TempRl[2] as (Key distance remaining) of (Key (Picked unit)) in movement_table
- Else - Actions
- Unit Group - Remove TempUnit from knockback_group
- If - Conditions
- Loop - Actions
- Unit Group - Pick every unit in knockback_group and do (Actions)
- Events