• 🏆 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 Variable as a Key in Hastables

Status
Not open for further replies.
Level 4
Joined
May 2, 2009
Messages
69
I'm new to using hashtables, but they're amazing. Unfortunately, I don't know how to make my trigger cleaner by loading a variable as my key for retrieving info.

  • Protective Sweep
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Protective Sweep - Def Q
    • Actions
      • Set Def_Prot_Caster = (Casting unit)
      • -------- Retrieving Stats --------
      • Set Combat_AttackPower = (Load 4 of (Key (Casting unit)) from Combat_Hash)
      • Set Combat_CritChance = (Load 6 of (Key (Casting unit)) from Combat_Hash)
      • Set Combat_CritPower = (Load 7 of (Key (Casting unit)) from Combat_Hash)
      • -------- ------------ --------
This is what my trigger looks like, but I want to be able to replace the "(Key(Casting unit))" with "(Key(Def_Prot_Caster))" but I can't find any way to.
Is it possible? Or even necessary at all? I prefer it that way just because it looks cleaner, but I can deal if it's unnecessary or more difficult than it needs to be.

Thoughts? :ogre_hurrhurr:
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
there are only one option in that case.
you need to use some jass sorry.

  • Custom script: set udg_integer = GetHandleId(udg_unit)
you need 2 GUI variables to use that. 1 integer variable named integer and one unit variable named unit. Put this script at the top of the actions and then use it as a key. (you can change the names ofc but the "udg_" needs to be there)
 
Status
Not open for further replies.
Top