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

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,201
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