• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] charge skill moves "charger" toward center of map instead of target (possible hashtable error?)

Status
Not open for further replies.
Level 3
Joined
May 5, 2007
Messages
21
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:

  • presetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Move_Hashtable = (Last created hashtable)
  • 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
  • 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
              • Custom script: call RemoveLocation(udg_temp_location[1])
              • Custom script: call RemoveLocation(udg_temp_location[2])
              • Custom script: call RemoveLocation(udg_temp_location[0])


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
was a "save integer" instead of a "save unit handle"
 
Last edited:
Level 3
Joined
May 5, 2007
Messages
21
Hashtable - Save (Key (Target unit of ability being cast)) as (Key target) of (Key (Triggering unit)) in Move_Hashtable

You're saving a key of the unit (its handle id), you need to save the unit itself.
haha yeah, figured it out a couple of minutes after posting this, now i feel stupid sitting here for an h.

cheers for the fast reply doe
 
Status
Not open for further replies.
Top