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

Prevent unit from dying after 0 HP

Status
Not open for further replies.
Level 3
Joined
Jul 22, 2011
Messages
37
Yes, it's me again. I feel like, the SC2 section in the hive consists of me asking questions and Dr Super Good answering.
So this one is special, couldn't find anything like that.
I want a neutral Sentry, both teams can capture the Sentry by "destroying" it, however it does not just "die".
My goal is to prevent it from dying after dropping to 0 HP and just change the ownership while going back to full HP/Shields. Right now I've temporary solved it with this:
  • Sentry Speed
    • Events
      • Unit - Any Unit is attacked
    • Local Variables
    • Conditions
      • (Triggering unit) == Celerity Sentry [61.50, 77.50]
      • ((Triggering unit) Life (Current)) <= 60.0
    • Actions
      • Unit - Change ownership of (Triggering unit) to player (Owner of (Attacking Unit)) and Change Color
      • Variable - Set Celerity Sentry = (Triggering unit)
      • Unit - Set (Triggering unit) Life to 700.0
      • Unit - Set (Triggering unit) Shields to 300.0
So, if a team attacks the Sentry, and it drops to 60hp or less, it changes the ownership, everything is working fine but that's a crappy solution
because a) I want them to bring it down to 0 HP b) If someone does more than ~60 damage in one hit in an unfortunate situation where the Sentry has 61 hp, it will just die... that's not supposed to happen. Those Sentries should be indestructible but players still have to attack to capture it.
Any Idea, Dr Super Good? :D
 
Last edited:
Level 9
Joined
Dec 21, 2006
Messages
490
use the campaign behavior that prevents the heroes from dying. additionally you can also add a change ownership effect that triggers on attack. you will need an validator to prevent changing the owner all the time.

if ppl would spend some reputation more ppl would answer in this forum.
 
Level 3
Joined
Jul 22, 2011
Messages
37
I did :) also:
additionally you can also add a change ownership effect that triggers on attack. you will need an validator to prevent changing the owner all the time.
How do validators work then? I mean, I don't want to change the ownership on the first attack, although the Unit has full hp. Only if it drops to 0 or very close to 0.
 
Level 19
Joined
Jan 12, 2011
Messages
1,523
Sentry Speed
Events
Unit - Any Unit is attacked
Local Variables
Conditions
(Triggering unit) == Celerity Sentry [61.50, 77.50]
((Triggering unit) Life (Current)) <= 60.0
Actions
Unit - Change ownership of (Triggering unit) to player (Owner of (Attacking Unit)) and Change Color
Variable - Set Celerity Sentry = (Triggering unit)
Unit - Set (Triggering unit) Life to 700.0
Unit - Set (Triggering unit) Shields to 300.0



is that sc2? it looks like war3 triggers o_O
 
Level 3
Joined
Jul 22, 2011
Messages
37
And again, thanks Dr Super Good. +rep.
I was kinda lazy and tired when I looked at your solution. It works in-game. Now I'll have to figure out how it works in the editor. It's obviously not just the trigger. Probably behavior/effect as well. The terran CC is obviously bugged since it's set on 0-1 hp and repeats the channeling for infinite times because it's burning down the whole time.
Not a big problem though, especially not for me.
Thanks again.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
The terran CC is obviously bugged since it's set on 0-1 hp and repeats the channeling for infinite times because it's burning down the whole time.
If will stop if you throw enough SCVs at it. You could obviously make it reheal the building on conversion but that makes little sense (how can a building be burning down and suddenly rehealed?!).

The channeling is there to stop ping ponging ownership due to splash effects or damage over time.

A possible improvement would be to make the building reheal to like 33%-50% HP gradually over the channeling time period.
 
Status
Not open for further replies.
Top