Hello, I recently returned to wc3 world edit after a 6-7(ish? stopped right after hashtable were added) break, so trying to freshen up on how stuff worked again. Been reading around on a couple of GUI tutorials trying to relearn the basics and stuff I never learned; and though I would try to make a simple charge spell.
However I cant figure out why it keeps moving my unit toward the center of the map instead of the target.
variable used:
Move_Group_runner is a group
temp_location is a point array
charge skill is based on channel and here is my triggers:
What happens is that no matter where my caster stands and target, he moves to the center of the map and deals no dmg to the target; by this I would assume my understanding on how hashtable storing units is incorrect? and my trigger keeps trying to set a position of a null target and therefore move toward the center of the map and deal damage to a non-existing target?
Anyway outside of my current problem, any additional help on how stuff can be made more efficient or if I missed cleaning up any leaks would be very welcome.
Cheers
edit: I'm an idiot, my
However I cant figure out why it keeps moving my unit toward the center of the map instead of the target.
variable used:
Move_Group_runner is a group
temp_location is a point array
charge skill is based on channel and here is my triggers:
-
presetup
-
Events
- Map initialization
- Conditions
-
Actions
- Hashtable - Create a hashtable
- Set Move_Hashtable = (Last created hashtable)
-
Events
-
startup run
-
Events
- Unit - A unit Starts the effect of an ability
- Conditions
-
Actions
- Unit Group - Add (Triggering unit) to Move_Group_runner
- Hashtable - Save (Key (Target unit of ability being cast)) as (Key target) of (Key (Triggering unit)) in Move_Hashtable
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (moving <gen> is on) Equal to False
-
Then - Actions
- Trigger - Turn on moving <gen>
- Else - Actions
-
If - Conditions
-
Events
-
moving
-
Events
- Time - Every 0.04 seconds of game time
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in Move_Group_runner) Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
-
Else - Actions
-
Unit Group - Pick every unit in Move_Group_runner and do (Actions)
-
Loop - Actions
- Set temp_location[0] = (Position of (Picked unit))
- Set temp_location[1] = (Position of (Load (Key target) of (Key (Picked unit)) in Move_Hashtable))
- Set temp_location[2] = (temp_location[0] offset by 50.00 towards (Angle from temp_location[0] to temp_location[1]) degrees)
- Unit - Move (Picked unit) instantly to temp_location[2]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between temp_location[0] and temp_location[1]) Less than or equal to 150.00
-
Then - Actions
- Unit - Cause (Picked unit) to damage (Load (Key target) of (Key (Picked unit)) in Move_Hashtable), dealing 60.00 damage of attack type Spells and damage type Normal
- Unit Group - Remove (Picked unit) from Move_Group_runner
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Move_Hashtable
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation(udg_temp_location[1])
- Custom script: call RemoveLocation(udg_temp_location[2])
- Custom script: call RemoveLocation(udg_temp_location[0])
-
Loop - Actions
-
Unit Group - Pick every unit in Move_Group_runner and do (Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
What happens is that no matter where my caster stands and target, he moves to the center of the map and deals no dmg to the target; by this I would assume my understanding on how hashtable storing units is incorrect? and my trigger keeps trying to set a position of a null target and therefore move toward the center of the map and deal damage to a non-existing target?
Anyway outside of my current problem, any additional help on how stuff can be made more efficient or if I missed cleaning up any leaks would be very welcome.
Cheers
edit: I'm an idiot, my
- Hashtable - Save (Key (Target unit of ability being cast)) as (Key target) of (Key (Triggering unit)) in Move_Hashtable
Last edited: