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

[Solved] Loading Unit-Type ID values

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I'm trying to achieve the storage of UnitType ID damage and resistance values in a hashtable, and then transform it into actual Damage and Resistance.

This way I add the damage:
  • Damage Set
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set DamageHash = (Last created hashtable)
      • Custom script: set udg_i = 'hfoo'
      • -------- Physical Damage --------
      • Hashtable - Save 100.00 as 1 of i in DamageHash
      • -------- Physical Resistance --------
      • Hashtable - Save 0.85 as 2 of i in DamageHash
0.85 means 15% Resistance. I'd like to know how to make it work with 0.15 to make it a bit easier. The actual formula is "Damage * Resistance".

This way I do the damage:
  • Damage Itself
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Custom script: set udg_i = 'hfoo'
      • Set PD = (Load 1 of i from DamageHash)
      • Set PR = (Load 2 of i from DamageHash)
      • -------- Physycal Damage --------
      • Custom script: if udg_PD > 0 then
      • Custom script: call UnitDamageTarget(udg_GDD_DamageSource, udg_GDD_DamagedUnit, (udg_PD * udg_PR), true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
      • Custom script: endif
      • Trigger - Turn on (This trigger)
I tried using Key(Handle) but didn't worked.

  • Custom script: set udg_Handle1 = ConvertUnitType(GetHandleId(udg_GDD_DamageSource))
  • Custom script: set udg_Handle2 = ConvertUnitType(GetHandleId(udg_GDD_DamagedUnit))
This is just an example, of course. I just used 'udg_i' to test. What I actually need are those handles of GDD_DamageSource and GDD_DamagedUnit so the system automatically retrieves the data of those units and uses it.
 
Status
Not open for further replies.
Top