Destructible Dies - GetKillingUnit()?

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
In a map i'm making, units have Tree Chop (Based on Night Elf Eat Tree ability), and a quest is based on killing an specific tree. I'd like to know if i can use 'Event Response - Killing unit' or 'GetKillingUnit()' to play a sound for that unit.


  • Quest1TreeChop
    • Events
      • Destructible - Summer Tree Wall 0630 <gen> dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Amelia[(Player number of (Owner of (Killing unit)))] Equal to 1
          • Rose[(Player number of (Owner of (Killing unit)))] Equal to 0
        • Then - Actions
          • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetKillingUnit()) then
          • Quest - Display to (All players) the Quest Update message: Main Quest Updated:...
          • Quest - Mark (Last created quest requirement) as Completed
          • Quest - Create a quest requirement for (Last created quest) with the description Talk to |cffffd700A...
          • Quest - Flash the quest dialog button
          • Sound - Play Secret_Found_01 <gen> at 100.00% volume, skipping the first 0.00 seconds
          • Custom script: endif
          • Set Amelia[(Player number of (Owner of (Killing unit)))] = 2
          • Set Rose[(Player number of (Owner of (Killing unit)))] = 1
        • Else - Actions
      • Wait 3.00 seconds
      • Destructible - Resurrect Summer Tree Wall 0630 <gen> with (Max life of Summer Tree Wall 0630 <gen>) life and Show birth animation


I know i have to check some stuff, the trigger is not complete. I just want to know the Killing Part :p

EDIT: Just thinking about it: If GetKillingUnit() doesn't work for destructibles, does "Pick every unit around destructible and do actions would work?"

EDIT: This is the trigger using Pick Every Unit and works, so far. At least the sound is played, and the other actions also take place, though I haven't done any test with other players at the same time.

  • Quest1TreeChop Copy
    • Events
      • Destructible - Summer Tree Wall 0630 <gen> dies
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 125.00 of (Position of Summer Tree Wall 0630 <gen>) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Amelia[(Player number of (Owner of (Picked unit)))] Equal to 1
              • Rose[(Player number of (Owner of (Picked unit)))] Equal to 0
            • Then - Actions
              • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then
              • Quest - Mark (Last created quest requirement) as Completed
              • Quest - Create a quest requirement for (Last created quest) with the description Talk to |cffffd700A...
              • Quest - Flash the quest dialog button
              • Quest - Display to (All players matching ((Owner of (Picked unit)) Equal to (Owner of (Picked unit)))) the Quest Update message: - Main Quest Update...
              • Sound - Play Secret_Found_01 <gen> at 100.00% volume, skipping the first 0.00 seconds
              • Custom script: endif
              • Set Amelia[(Player number of (Owner of (Picked unit)))] = 2
              • Set Rose[(Player number of (Owner of (Picked unit)))] = 1
            • Else - Actions
      • Wait 3.00 seconds
      • Destructible - Resurrect Summer Tree Wall 0630 <gen> with (Max life of Summer Tree Wall 0630 <gen>) life and Show birth animation
 
Last edited:
Level 12
Joined
Feb 22, 2010
Messages
1,115
Things will be easy if your skill based on eat tree.

  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Eat Tree
      • (Target destructible of ability being cast) Equal toSummer Tree Wall 0630 <gen>
    • Actions
      • Unit - Kill (Triggering unit)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
But the Tree dies with the skill, there's no need to kill it with the trigger xD What i need is to check know who the killer unit is to make the actions.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
There is no response event about the killing unit when a destructable death event fire, that's why Ceday's way will work (ofc the skill by itself must not kill the destructable, it should be a dummy one without any real effect).

But care that the "destructable death event" will also fire for any sort of death like an attack, or a kill with a trigger action.

So instead of adding this event you would add no event at all and add inside Ceday's trigger an executing of trigger Quest1TreeChop checking conditions.

Then, in the trigger Quest1TreeChop, GetTriggerUnit will be the caster, so the killing unit.

EDIT : Your pick every is truly innacurate, you can't guess which unit has killed the destructable in the case there are several heroes within the range.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Any unit in the game has an ability to target a tree, only that one, and this is one of the few 'vulnerable' trees around. Anyway, it's really good to know your suggestions. I'll follow them for sure if I find any problem related to this in further tests :)

Actually, I don't really have problems with that, since this is the first quest, and the tree revives every 3 second, and it's the only way to go through, so, every hero will have to destroy it anyway, and the effect will only work for those units. (Those 2 conditions are unique, they're turned to 2 and 1, and never go back to previous values).

Thaks to you both!
 
Status
Not open for further replies.
Top