• 🏆 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!

Loading a unit from a hashtable returns null

Status
Not open for further replies.
Level 7
Joined
Jun 14, 2009
Messages
235
The title

  • Warp Dagger Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Warp Dagger
    • Actions
      • Set Temp_unit[0] = (Casting unit)
      • Set Temp_player[0] = (Owner of Temp_unit[0])
      • Set Temp_integer[0] = (Level of Warp Dagger for Temp_unit[0])
      • Set Temp_point[0] = (Position of (Casting unit))
      • Set Temp_point[1] = (Target point of ability being cast)
      • Set Temp_real[0] = (Angle from Temp_point[0] to Temp_point[1])
      • Set Temp_point[2] = (Temp_point[0] offset by 100.00 towards Temp_real[0] degrees)
      • Unit - Create 1 Warp Dagger Missile for Temp_player[0] at Temp_point[2] facing Temp_real[0] degrees
      • Unit Group - Add (Last created unit) to WarpDaggerGroup
      • Hashtable - Save Handle Of(Temp_unit[0]) as 0 of (Key (Last created unit)) in WarpDaggerHashtable
      • Game - Display to (All players) the text: (Name of (Load 0 of (Key (Last created unit)) in WarpDaggerHashtable))
      • Game - Display to (All players) the text: (String((Key (Last created unit))))
      • Hashtable - Save Handle OfTemp_player[0] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
      • Hashtable - Save Handle OfTemp_point[2] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
      • Hashtable - Save Temp_integer[0] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
      • Hashtable - Save Temp_real[0] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
      • Hashtable - Save (700.00 + (100.00 x (Real(Temp_integer[0])))) as 1 of (Key (Last created unit)) in WarpDaggerHashtable
  • Warp Dagger Move
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
    • Unit Group - Pick every unit in WarpDaggerGroup and do (Actions)
      • Loop - Actions
        • Set Missile = (Picked unit)
        • Set MissileHandle = (Picked unit)
        • Set MissilePosition = (Load 0 of (Key (Picked unit)) in WarpDaggerHashtable)
        • Set Caster = (Load 0 of (Key (Picked unit)) in WarpDaggerHashtable)
        • Game - Display to (All players) the text: (Name of (Load 0 of (Key (Picked unit)) in WarpDaggerHashtable))
        • Game - Display to (All players) the text: (Name of Caster)
        • Set Owner = (Load 0 of (Key (Picked unit)) in WarpDaggerHashtable)
        • Set SpellLevel = (Load 0 of (Key (Picked unit)) from WarpDaggerHashtable)
        • Set Angle = (Load 0 of (Key (Picked unit)) from WarpDaggerHashtable)
        • Set DistanceToGo = (Load 1 of (Key (Picked unit)) from WarpDaggerHashtable)
        • Set Temp_point[0] = (MissilePosition offset by 20.00 towards Angle degrees)
        • Unit - Move Missile instantly to Temp_point[0], facing Angle degrees
        • Unit Group - Pick every unit in (Random 1 units from (Units within 70.00 of Temp_point[0])) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Picked unit) is A structure) Equal to False
                • (Picked unit) Not equal to No unit
                • ((Picked unit) is alive) Equal to True
                • ((Picked unit) is Magic Immune) Equal to False
              • Then - Actions
                • Game - Display to (All players) the text: hit
                • Set Target = (Picked unit)
                • Set Temp_point[0] = (Position of Caster)
                • Set Temp_point[1] = (Position of Target)
                • Set Temp_real[2] = (Angle from Temp_point[0] to Temp_point[1])
                • Unit - Move Caster instantly to Temp_point[2], facing Angle degrees
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Target belongs to an enemy of Owner) Equal to True
                  • Then - Actions
                    • Unit - Cause Caster to damage Target, dealing (30.00 + (60.00 x (Real(SpellLevel)))) damage of attack type Spells and damage type Enhanced
                  • Else - Actions
                • Unit - Kill Missile
                • Unit Group - Remove Missile from WarpDaggerGroup
                • Hashtable - Clear all child hashtables of child (Key MissileHandle) in WarpDaggerHashtable
                • Skip remaining actions
              • Else - Actions
        • Set DistanceToGo = (DistanceToGo - 20.00)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • DistanceToGo Less than or equal to 0.00
          • Then - Actions
            • Unit - Kill Missile
            • Unit Group - Remove Missile from WarpDaggerGroup
            • Hashtable - Clear all child hashtables of child (Key MissileHandle) in WarpDaggerHashtable
            • Skip remaining actions
            • Game - Display to (All players) the text: done
          • Else - Actions
            • Hashtable - Save DistanceToGo as 1 of (Key MissileHandle) in WarpDaggerHashtable
            • Hashtable - Save Handle OfTemp_point[0] as 0 of (Key MissileHandle) in WarpDaggerHashtable
It just return nothing

The hashtable exists, it just does nothing

Edited: I copied the wrong thing, it was the right hash table, i just copy pasted it wrong... Also
 
Last edited:
Level 7
Joined
Jun 14, 2009
Messages
235
Oh.. Oops! I forgot to edit that part for this... Its missile hashtable normally, but it still doesn't work... :(
 
Level 7
Joined
Jun 14, 2009
Messages
235
K, ill edit it in a bit, I don't have it now... But the weird thing is real, and integer etc works fine, its just units that won't load
 
You save 4 values as 0 of (Key(Last created unit)); each of them will replace the previous ones. You save a real under 0, an integer under 0, you save a location under 0 and you save a player under 0. Use 0, 1, 2, 3 respectively to save individual values.
  • Hashtable - Save Handle OfTemp_player[0] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
  • Hashtable - Save Handle OfTemp_point[2] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
  • Hashtable - Save Temp_integer[0] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
  • Hashtable - Save Temp_real[0] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
Should be:

  • Hashtable - Save Handle OfTemp_player[0] as 0 of (Key (Last created unit)) in WarpDaggerHashtable
    • Hashtable - Save Handle OfTemp_point[2] as 1 of (Key (Last created unit)) in WarpDaggerHashtable
    • Hashtable - Save Temp_integer[0] as 2 of (Key (Last created unit)) in WarpDaggerHashtable
    • Hashtable - Save Temp_real[0] as 3 of (Key (Last created unit)) in WarpDaggerHashtable

Finally, you don't need to save the player, just use, e.g.:
  • Set Caster = (Load 0 of (Key(Picked unit)) from WarpDaggerHashtable)
  • Unit - Create 1 unit for (Owner of (Caster)) at ...
 
Status
Not open for further replies.
Top