• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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,219
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