- Joined
- Jun 10, 2007
- Messages
- 557
I know I had a hashtable question a few weeks ago but I figured out the problem then and it worked fine... for a while. Now I have another one that's messing up in a completely different way.
Basically, the objective is to have the caster move towards the target point in a manner similar to a knockback and if he encounters any enemies along the way, the spell ends and he spawns a dummy unit that casts a spell on the enemy.
But what ends up happening is that he rockets across the map, not always in the targeted direction, going much farther and for much longer than I intend. The effect appears to be cumulative too; after casting the spell a few times he goes farther and faster than the last time. He stops and casts the dummy spell when he hits an enemy just fine, though.
So... I've been combing this thing for a while now and can't see what's wrong with it. Anybody find anything that might cause this? +rep will, of course, be given to helpful replies.
And before you ask, yes, I created the hashtable properly on map initialization.
Basically, the objective is to have the caster move towards the target point in a manner similar to a knockback and if he encounters any enemies along the way, the spell ends and he spawns a dummy unit that casts a spell on the enemy.
But what ends up happening is that he rockets across the map, not always in the targeted direction, going much farther and for much longer than I intend. The effect appears to be cumulative too; after casting the spell a few times he goes farther and faster than the last time. He stops and casts the dummy spell when he hits an enemy just fine, though.
-
Charge Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Charge (Berserker)
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in ChargeGroup) Equal to 0
-
-
Then - Actions
-
Trigger - Turn on Charge FX <gen>
-
-
Else - Actions
-
-
Unit Group - Add (Triggering unit) to ChargeGroup
-
Unit - Pause (Triggering unit)
-
Animation - Play (Triggering unit)'s walk animation, using only Common animations
-
Set Location = (Position of (Triggering unit))
-
Set Location2 = (Target point of ability being cast)
-
Set ChargeAngle = (Angle from Location to Location2)
-
Set ChargeDistance = ((Distance between Location and Location2) x 0.04)
-
Set ChargeTime = ((Distance between Location and Location2) / 600.00)
-
Set ChargeLevel = (Level of Charge (Berserker) for (Triggering unit))
-
Hashtable - Save ChargeAngle as 0 of (Key (Triggering unit)) in Charge
-
Hashtable - Save ChargeDistance as 1 of (Key (Triggering unit)) in Charge
-
Hashtable - Save ChargeTime as 2 of (Key (Triggering unit)) in Charge
-
Hashtable - Save ChargeLevel as 3 of (Key (Triggering unit)) in Charge
-
Custom script: call RemoveLocation (udg_Location)
-
Custom script: call RemoveLocation (udg_Location2)
-
-
-
Charge FX
-
Events
-
Time - Every 0.04 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in ChargeGroup and do (Actions)
-
Loop - Actions
-
Set Location = (Position of (Picked unit))
-
Set ChargeAngle = (Load 0 of (Key (Picked unit)) from Charge)
-
Set ChargeDistance = (Load 1 of (Key (Picked unit)) from Charge)
-
Set ChargeTime = (Load 2 of (Key (Picked unit)) from Charge)
-
Set ChargeLevel = (Load 3 of (Key (Picked unit)) from Charge)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
ChargeTime Greater than 0.00
-
-
Then - Actions
-
Unit - Move (Picked unit) instantly to (Location offset by ChargeDistance towards ChargeAngle degrees)
-
Hashtable - Save (ChargeTime - 0.04) as 2 of (Key (Picked unit)) in Charge
-
Set Group = (Units within 100.00 of Location matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in Group) Greater than or equal to 1
-
-
Then - Actions
-
Set Unit = (Random unit from Group)
-
Unit - Create 1 Dummy for (Owner of (Picked unit)) at Location facing Default building facing degrees
-
Unit - Add Maul to (Last created unit)
-
Unit - Set level of Maul for (Last created unit) to ChargeLevel
-
Unit - Order (Last created unit) to Neutral - Firebolt Unit
-
Unit - Unpause (Picked unit)
-
Animation - Reset (Picked unit)'s animation
-
Hashtable - Save 0.00 as 2 of (Key (Picked unit)) in Charge
-
-
Else - Actions
-
-
Custom script: call DestroyGroup (udg_Group)
-
-
Else - Actions
-
Unit - Unpause (Picked unit)
-
Animation - Reset (Picked unit)'s animation
-
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Charge
-
Unit Group - Remove (Picked unit) from ChargeGroup
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in ChargeGroup) Equal to 0
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
-
Custom script: call RemoveLocation (udg_Location)
-
-
-
-
So... I've been combing this thing for a while now and can't see what's wrong with it. Anybody find anything that might cause this? +rep will, of course, be given to helpful replies.
And before you ask, yes, I created the hashtable properly on map initialization.