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

[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