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

Hashtable crash

Level 4
Joined
Dec 26, 2021
Messages
45
Hello,

just picking up hashtables again and have a noob issue.

udg_valueUT is a unit type variable --> effectively i am using the ut as an int key and trying to grab/save a book to index 0 - for some reason this crashes and i am not clear on why.

  • Actions
    • Trigger - Run GetUnitTypeCost <gen> (ignoring conditions)
    • Custom script: set udg_int = udg_valueUT
    • Set VariableSet isFound = (Load 0 of int from cardDictionary.)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • isFound Equal to True
      • Then - Actions
        • Set VariableSet isUnit = isFound
      • Else - Actions
        • Unit - Create 1 valueUT for Neutral Passive at mapCenter facing Default building facing degrees
        • Set VariableSet unit = (Last created unit)
        • Unit - Remove (Last created unit) from the game
        • Trigger - Run GetDictionaryValueUT <gen> (ignoring conditions)
 
unit-type -> int with custom script is fine.
You don't show a lot of things, but some things to keep in mind:
You need to create the cardDictionary and store it to the variable somewhere (such as on map initialize event).
You could also cause an infinite loop with your triggers I guess.

You also create a unit, store it to a variable and remove it (making it point to null or "No Unit" as it's called in GUI)... That's a bit strange and unnecessary. If you try to use the "unit" variable, it might cause a crash I guess, depending on what your other triggers does.
 
Level 4
Joined
Dec 26, 2021
Messages
45
unit-type -> int with custom script is fine.
You don't show a lot of things, but some things to keep in mind:
You need to create the cardDictionary and store it to the variable somewhere (such as on map initialize event).
You could also cause an infinite loop with your triggers I guess.

You also create a unit, store it to a variable and remove it (making it point to null or "No Unit" as it's called in GUI)... That's a bit strange and unnecessary. If you try to use the "unit" variable, it might cause a crash I guess, depending on what your other triggers does.
Actually you're right; i missed a trigger and was simply too tired to see it resulting in inf loop. I googled some stuff on the hash tables and found there was a period where they were bugged but now seems fine and tested on other maps without issue :)

Thanks
 
Top