Unit is About to Die Event

Lyle.

New Member
Reaction score
32
I need a way for an event to catch right before a certain unit-type is going to die. I need to modify the unit (remove an ability) right before it dies.
 

Romek

Super Moderator
Reaction score
963
Use Damage Detection.

The trigger would run before the actual damage is dealt.
So check if the damage would kill the unit, and if so, remove the ability.
 

Romek

Super Moderator
Reaction score
963
Why would you want to remove an ability just before the unit dies anyway?
 

Lyle.

New Member
Reaction score
32
Why would you want to remove an ability just before the unit dies anyway?

I have an ability based on Bear Form that when used also adds an Engineering Upgrade based skill to change not only the unit but the unit's skills. This works perfectly except if the unit dies in its second form the unit will come back in its first form with out any skills. If I remove the Engineering Upgrade skill it should solve my problem.

Could you help me with this "Damage Detection" event? I use GUI
 

Romek

Super Moderator
Reaction score
963
Trigger:
  • Damage Detection
    • Events
      • Map initialization
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Custom script: if GetTriggerExecCount(GetTriggeringTrigger()) == 0 then
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Some Trigger <gen> the event (Unit - (Picked unit) Takes damage)
      • Skip remaining actions
      • Custom script: endif
      • Trigger - Add to Some Trigger <gen> the event (Unit - (Triggering unit) Takes damage)

Should work. Unless I've messed something up. (It's 3:37am, wouldn't be surprised if I did :p)

Some Trigger is the trigger you want to add the event to.
 

Lyle.

New Member
Reaction score
32
I'm not exactly sure how this works but this is what I have so far, no results.

Trigger:
  • Damage Detection
    • Events
      • Map initialization
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Custom script: if GetTriggerExecCount(GetTriggeringTrigger()) == 0 then
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Alter Form Copy <gen> the event (Unit - (Picked unit) Takes damage)
      • Skip remaining actions
      • Custom script: endif
      • Trigger - Add to Alter Form Copy <gen> the event (Unit - (Triggering unit) Takes damage)


Trigger:
  • Alter Form Copy
    • Events
    • Conditions
    • Actions
      • Wait 2.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Cast is dead) Equal to True
        • Then - Actions
          • Set Form = False
          • Unit - Remove Alterations Ice from Cast
        • Else - Actions


I also tryed doing it with my original trigger.
Trigger:
  • Alter Form
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Alter Form
    • Actions
      • Set Cast = (Casting unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Form Equal to False
        • Then - Actions
          • Set Form = True
          • Wait 0.01 seconds
          • Unit - Add Alterations Ice to (Casting unit)
        • Else - Actions
          • Set Form = False
          • Unit - Remove Alterations Ice from (Casting unit)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
Trigger:
  • Unit - Remove Alterations Ice from (Casting unit)


There is no Casting Unit there....
 

Lyle.

New Member
Reaction score
32
Trigger:
  • Unit - Remove Alterations Ice from (Casting unit)


There is no Casting Unit there....

Ya that helps, but with that Damage Detection trigger my unit runs "Alter Form Copy" everytime the unit is Damaged.


EDIT: Ok I edited my "Alter Form Copy" above and it seems to work. Imma go test it a little more and get back to ya...

EDIT: Ya this will work. Thanks +rep all around : )
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top