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

Damage Detect variable.

Status
Not open for further replies.
Level 11
Joined
Dec 5, 2009
Messages
846
Hello. I want to detect damage and i thought you could first store the unit in an variable then do another trigger where you use the stored unit in the event Unit - Takes Damage but in that event it wont find the variable... Is there anyway to do this?
I want it like this:

  • Storing
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to Sorceress 0003 <gen>
    • Actions
      • Unit Group - Pick every unit in (Units within 1000.00 of (Position of (Attacking unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set unit = (Picked unit)
          • Set unit2 = (sorceress0013)
          • Trigger - Turn on using the stored <gen>
  • using the stored
    • Events
      • Unit - unit Takes damage
    • Conditions
      • Unit2 Equal to (Damage source)
    • Actions
 
Level 9
Joined
Jul 10, 2011
Messages
562
use GDD (Gui-friendly damage detection)....with that system you can easily get the damage (or the damage dealer or the damaged unit^^)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
The event is made with the variable contents when you call the event constructor. Changing the variable afterwards will not alter the event object in any way. To put this in computer terms the reference to the unit is passed by value and not by reference.
 
Status
Not open for further replies.
Top