• 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] Goblin Land Mine; Stat relationed damage

Status
Not open for further replies.
Level 15
Joined
Jan 27, 2007
Messages
948
Well, I am working on a spell which is named "Explosive Trap". The spell consists of a goblin land mine that is placed anywhere and after 10 seconds it will explode upon the proximity of any foe. When it explodes it deals an AoE damage equal to 6x to 7x the caster's agility.
My triggering goes this far:
  • Explosive Trap
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Explosive Trap
    • Actions
      • Set AntiLeakGroup2 = (Units within 200.00 of (Position of (Dying unit)))
      • Unit Group - Pick every unit in AntiLeakGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Cause (Dying unit) to damage (Picked unit), dealing ((Real((Agility of (Dying unit) (Include bonuses)))) x (Random real number between 6.00 and 7.00)) damage of attack type Normal and damage type Normal
      • Custom script: set udg_AntiLeakGroup2 = null
But I'm quite stuck at this part:

  • Unit - Cause (Dying unit) to damage (Picked unit), dealing ((Real((Agility of (Dying unit) (Include bonuses)))) x (Random real number between 6.00 and 7.00)) damage of attack type Normal and damage type Normal
Since I'm absolutely sure land mines DO NOT have agility. And even they would I need the caster's agility, not the land mine one.
Please keep in mind this spell has to be MUI (It's a hunter skill which can be picked by many players).

I hope I have been clear. Thanks in advance!
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Untitled Trigger 024
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
  • Untitled Trigger 016
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Goblin Land Mine
    • Actions
      • Custom script: set udg_ID = GetHandleId(GetSummonedUnit())
      • Hashtable - Save (6.00 x (Real((Agility of (Triggering unit) (Include bonuses))))) as 0 of ID in hash
  • Untitled Trigger 025
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Goblin Land Mine
    • Actions
      • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())
      • Set r1 = (Load 0 of ID from hash)
      • Hashtable - Clear all child hashtables of child ID in hash
Variables:
hash // hashtable
r1 // real
ID //integer

Ofcourse you can name your variables whateber you like, just change the custom scripts accordingly.

In the last trigger the damage is loaded into the r1 variable. Do the unit group pick after that.

The unit dies trigger should be initially off, turned on when a land mine is spawned, and turned off when there are no land mines in the map.

You could also save handle of the caster as 1 of ID, and the load it to make the caster deal the damage. Actually you could store only the caster and not the damage, and calculate the damage when the unit dies.
 
Level 15
Joined
Jan 27, 2007
Messages
948
Mmmh, this makes much sense.. many thanks!

I have just a question; what is this for?

  • Custom script: set udg_ID = GetHandleId(GetSummonedUnit())
  • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())



Edit to not double-post:
I used what you said as a base, and it awesomely helped me!!
Instead of saving the damage, I saved the unit itself in the hashtable (as you said), instead of a real, I used a unit variable of course and with the unit stored I used it to be the damaging unit and it uses it's agility. I'm not sure if this is MUI but I think it is (and hope so xD)
Many thanks, MANY!! (already +rep'ed)
 
Last edited:
Level 11
Joined
Nov 15, 2007
Messages
800
I have just a question; what is this for?

  • Custom script: set udg_ID = GetHandleId(GetSummonedUnit())
  • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())

Many people use JNGP which AFAIK doesn't have handle ID functions in GUI, so you have to get handle ID through custom script. Which is probably faster anyway.
 
Level 11
Joined
Nov 15, 2007
Messages
800
That means it is used to replace a part of the triggering?

Yes, it's used to replace
  • Hashtable - Save Handle Of(Triggering unit) as Whatever Value in Whatever Value of Whichever Hashtable

Unit handles are integers, so
  • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())
sets an integer variable to the unit's handle ID, and then stores that integer in the hash table. The default World Editor has functions for it in GUI, but JNGP doesn't.
 
Status
Not open for further replies.
Top