• 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.

[Trigger] Is this possible with hashtables?

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
This bothers be that I can't seem to find a way to do this.

When you assign a hashtable key:

save (udg_temp_real) as key(damage) of key("Event Response - Triggering Unit) in (udg_Hashtable_01)

If I have a unit stored as udg_temp_unit, why can't I do this:

save (udg_temp_real) as key(damage) of key(udg_temp_unit) in (udg_Hashtable_01)

I get around this by doing:

Unit Group - add (udg_temp_unit) to (udg_temp_group)
Pick All units in (udg_temp_group) and do actions:
- save (udg_temp_real) as key(damage) of key(Picked Unit) in (udg_Hashtable_01)

but it seems like there should be a way to do this. Can anyone help?
 
  • Custom script: set udg_temp_real = GetHandleId(udg_temp_unit)
for some stupid reason blizzard disabled that is is possible to use variables in GUI as a parameter for GetHandleId
just use this line of custom script and it should work

edit:
if u are using the non-BJ version maker mantioned you should make sure to switch the array indexes (they are swapped)
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
You can use this custom script. It's just converted from GUI. I believe there is a better alternative, without that BJ. I'll try to look it up.

  • Custom script: call SaveRealBJ( udg_Temp_Real_1, StringHash("damage"), GetHandleId(udg_Temp_Unit_2), udg__Hash )
(Save what real as something for some unit in hash)
 
Last edited:
Level 8
Joined
Apr 30, 2009
Messages
338
Another question related to this:

  • d2
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of GDD_DamageSource) Equal to D.RNG-1 Searing Arrow
        • Then - Actions
          • Set temp_point = (Position of GDD_DamageSource)
          • Unit - Create 1 D.RNG Arrow Source for (Owner of GDD_DamageSource) at temp_point facing Default building facing degrees
          • Custom script: call SaveReal(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("duration"),3)
          • Custom script: call SaveReal(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("damage"),2)
          • Countdown Timer - Start T_RNG_ArrowRemove as a One-shot timer that will expire in 0.00 seconds
        • Else - Actions
I want to save handle of "Last Created Unit" as "source" of key(udg_GDD_DamagedUnit) in H_RNG_SearingArrow

I tried BSing from
Custom script:
JASS:
call SaveReal(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("damage"),2)

into
Custom script:
JASS:
call SaveUnitHandle(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("source"),GetHandleId(LastCreatedUnit))

but it didn't work :(


And to be sure, the 2 lines of custom I have in that trigger are doing this:

Save 3 as "duration" of key(udg_GDD_DamagedUnit) in (udg_H_RNG_SearingArrow)
Save 2 as "damage" of key(udg_GDD_DamagedUnit) in (udg_H_RNG_SearingArrow)
 
Level 8
Joined
Apr 30, 2009
Messages
338
I added that and then I get bogus error messages saying

call RemoveLocation(udg_temp_point)

is an invalid argument type (integer)

So I delete that line and then it does the same thing with a timer and ruins the whole trigger

  • sfdf
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of GDD_DamageSource) Equal to D.RNG-1 Searing Arrow
        • Then - Actions
          • Set temp_point = (Position of GDD_DamageSource)
          • Unit - Create 1 D.RNG Arrow Source for (Owner of GDD_DamageSource) at temp_point facing Default building facing degrees
          • Custom script: call SaveReal(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("duration"),3)
          • Custom script: call SaveReal(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("damage"),2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (GDD_DamagedUnit is in G_RNG_SearingArrow) Equal to False
            • Then - Actions
              • Unit Group - Add GDD_DamagedUnit to G_RNG_SearingArrow
              • Unit - Add RNG-D1 Searing Arrow to GDD_DamagedUnit
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Searing Arrow 002 <gen> is on) Equal to False
                • Then - Actions
                  • Trigger - Turn on Searing Arrow 002 <gen>
                • Else - Actions
            • Else - Actions
          • Custom script: call SaveUnitHandle(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("source"),GetHandleId(GetLastCreatedUnit()))
          • Custom script: call RemoveLocation(udg_temp_point)
          • Countdown Timer - Start T_RNG_ArrowRemove as a One-shot timer that will expire in 0.00 seconds
        • Else - Actions
Everything below the save real custom scripts errors calling "invalid argument" - integer

-------------

Lol, and here I totally guessed and of course got it wrong. I want the second "Else" to have

Remove unit from game: load "source" of key(udg_GDD_DamagedUnit) from H_RNG_SearingArrow

My guess was:
JASS:
call RemoveUnit(GetHandleId(udg_H_RNG_SearingArrow,GetHandleId(udg_GDD_DamagedUnit),StringHash("source")))

based on converting a Remove Unit into custom text

I knew this damn ranger hero would be the biggest pain in the ass all because of arrow spells and damage detecting

----------

besides downloading the jass helper and typing stuff in, is there any way to know if I'm right when I guess besides waiting for the map to error?
 
Last edited:
Status
Not open for further replies.
Top