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

Timed life and unit immortality

Status
Not open for further replies.
Level 26
Joined
Aug 18, 2009
Messages
4,097
One of the remaining eagerly coveted features in wc3 is to abort unit expiration timers in order to use the blue bar display in the unit ui. The issue is that only the triggered version (UnitApplyTimedLife function) is passive enough to not affect the target in side fashions and permits dynamic durations.

This one, however, as the name suggests, kills the unit in the end, which is again no good. At least you can get rid of the bar instantly by removing the buff (that you have to input into the function) from the target unit, still the unit meets its fate.

That's why a solution would be to render the unit immortal meanwhile. I currently know but one way to trick death. A unit cannot die if it has <= 0 starting hitpoints (set max hitpoints to <= 0). This method seems not viable though since once you go above the death limit (0.405), you cannot return below without killing the unit in turn.

So do you have ideas how to either set up an expiration bar without side effects (like unit losing order, dying), remove the timed life effect without killing the unit or set the unit immortal later on?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Well, if the point is to have the blue bar, then you can use SetUnitTimedLife and at the same time launch a timer that is slightly shorter. When the timer finishes, remove the buff that you set timed life with (I usually use the generic buff).

If that can not be done, then make the unit invulnerable through a damage detection system (does that work actually?)

The last way is making the unit invulnerable through the usual way, although that has severe drawbacks. I guess this can be mitigated by triggering all damage, but this is lots of upfront work.
 
Well here's one way if your not a fan of damage detection systems.

If you don't want to have to index every unit to detect its expire date then I suggest to exploit spellbooks secret and combine it with reincarnation somehow.
I think you should use indexing though otherwise even I am at a lost how you'll avoid those bugs currently anyways.

Will check if there is more methods.

Edit: Another way would be to use resurrection 10 AoE range right as your unit dies, combine it with a unit-group and a death event.

Edit2: No matter what you can do though, the unit dies no matter what. However you can visually fool the human eye quite easily.

The two people above me posted some good idea's too, morphing might provide another way/method for you. Pause/hide sadly don't work from my latest tests.
 

Attachments

  • currently one way.w3x
    17.5 KB · Views: 50
Level 26
Joined
Aug 18, 2009
Messages
4,097
That's a really tough one. Have you tried the typical approaches? Morphing, Abusing pause/hide etc.?

Yes, but nothing seems to abort timed life nor avoid death. Where I assumed a slim chance was to morph the unit into one with zero hp but it still deceased (albeit it does not display a death animation there).

Well, if the point is to have the blue bar, then you can use SetUnitTimedLife and at the same time launch a timer that is slightly shorter. When the timer finishes, remove the buff that you set timed life with (I usually use the generic buff).

That would be an idea for the final realization but first I have to know how to remove the buff without ending the unit's life.

Invulnerability does not avoid death. Of course, I can avoid all other sources of death but not the one that exactly happens because I use timed life.

The map I want to use that in is already customized and monitored to extents that exceed the public systems here by far. I can also easily revive units but the death effect would still be too much because it resets certain things you cannot neatly restore on units without notice like the animation, inner command card, delayed actions, queued orders, animation timers. The coverage would be quite expensive, too.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Avatar would be my favorite but you have to cast it, which would be semi-fatal to death, also spam vast amounts of the ability in order get dynamic durations (long max duration, high resolution). The only target abilities that apply the bar seem to be Hex/Polymorph, which disable the unit.
 
I think hex/polymorph might be easier to "fix" than TimedLife, as the disable effect should go away once you morph the unit.

Have you tried applying a 100.000 life ability and then setting the life to 100% the moment the unit dies? I think this is the approach used for all "trick death" situations with damage detection engines.
Does Timed Life trigger the damage event?

Also, what happens if you apply another timed life buff over an already existing timed life? Let's say your first timed life is 20 seconds and the second is 180 seconds, does the unit still die after 20 seconds? If not then you can apply a long-duration timed life buff right before the unit dies and then hide the bar by removing the buff.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
What about phoenix morph to avoid death?

I tried this as well but the unit still gets interrupted there.

I think hex/polymorph might be easier to "fix" than TimedLife, as the disable effect should go away once you morph the unit.

It does not. Rooting is likewise stubborn btw., else you could somehow use it to change armor types. Iirc, it requires interruption, too, tho.

Have you tried applying a 100.000 life ability and then setting the life to 100% the moment the unit dies? I think this is the approach used for all "trick death" situations with damage detection engines.
Does Timed Life trigger the damage event?

Death does not trigger damage. Restoring the life on life=0 event or death event does not revive the unit. I can instantly (code-instantly) revive the unit on death event but it still detects the interruption. The damage event occurs before damage is dealt, hence why they can still change the outcome in damage systems.

Also, what happens if you apply another timed life buff over an already existing timed life? Let's say your first timed life is 20 seconds and the second is 180 seconds, does the unit still die after 20 seconds? If not then you can apply a long-duration timed life buff right before the unit dies and then hide the bar by removing the buff.

While there can be timers parallel (@Xonok: That's why your test map lags like hell btw if you pause and keep spamming them), only the top one is displayed. I do not know what you mean, even if the duration is extra long, removing the buff kills.

Ps: Infact, I even tried some more stuff yesterday like overwriting the timed life buff via an ability.
 
So all more or less logical approaches are ruled out by now.

Without some neat bug exploits, I doubt you will be able to use the timer bar in the way you desire, unless we find a last-minute bug that hasn't been known until now.



I guess we just have to accept that some stuff simply isn't possible in WC3.

For example, during the last 10 years of WC3, I yet haven't discovered a way to pan the camera for a player instantly that does not interrupt camera swaying by moving the cursor to the screen corners.
I've literally tried thousands of things, as it was the last hurdle to overcome to create a 3rd person camera system that allows turning the camera by moving the mouse cursor to the corners of the screen (that also responds much faster in multiplayer than arrow key controlled 3rd person cams).
I was so damn close to make it (already made it working for standing units), but it failed due to not having a way to pan the camera instantly without breaking the cursor cam movement.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
But we do find new things now and then and improve understanding as the Lab proves. While testing this yesterday I learned that you can reanimate living units. (And if you make the unit survive the timed life, the buff vanishes but the unit is still somehow marked to not be a target for another reanimation, maybe it was flagged as dead partly?)

Zwiebelchen said:
For example, during the last 10 years of WC3, I yet haven't discovered a way to pan the camera for a player instantly that does not interrupt camera swaying by moving the cursor to the screen corners.

I investigated this as well, maybe not instant. You can restrict the camera bounds to the target point, wait some 0.03 seconds, then release it. Ofc it's ugly but if you need it for nearly instant movement, it might be tolerable. Using it for transition pans is the real deal though because your minimap will constantly flash, the needed delay time kinda varies and it constantly interferes with user scroll.

edit: If you pause the expiration timer on the same tick, it gets bugged up, you cannot unpause it, trollol. New expiration timers are unaffected. Even if that does not leak, you cannot swap the display to a new timer or do you know a way to do so? Then it could be tolerable to have an empty bar remaining.
 
Last edited:
I investigated this as well, maybe not instant. You can restrict the camera bounds to the target point, wait some 0.03 seconds, then release it. Ofc it's ugly but if you need it for nearly instant movement, it might be tolerable. Using it for transition pans is the real deal though because your minimap will constantly flash, the needed delay time kinda varies and it constantly interferes with user scroll.
I know about camera bounds and it was my solution when I wrote the system; but the deal with camera bounds is that the delay is too long, as I basicly need twice the update interval on camera bounds:

1) I need to use camera bounds to pan the camera on the unit (takes 0.03 seconds)
2) I need to increase the camera bounds by a small margin to "detect" any micro-camera movement from the player (needs another 0.03 seconds to have an impact)
3) I can now use the detected camera movement to determine in which direction the camera needs to be turned and pan the camera on the unit again; however, GetCameraTargetPosition also has a certain interval of roughly 0.03 seconds to throw a new value

All in all, this method requires 3x the update time for camera bounds for a single cycle. Which results in roughly 0.1 seconds per camera pan. With only 10 FPS on the actual camera panning, the system wasn't smooth enough for applications with moving units, even if it worked and the mouse-to-corner detection was nearly delay-free even in multiplayer (which would have been the perfect 3rd person camera system in multiplayer maps).

The PanCamera natives worked great for periodic re-panning the camera on the unit, but interrupted both arrow-key and mouse-to-corner camera movement, so they couldn't be used at all.

edit: If you pause the expiration timer on the same tick, it gets bugged up, you cannot unpause it, trollol. New expiration timers are unaffected. Even if that does not leak, you cannot swap the display to a new timer or do you know a way to do so? Then it could be tolerable to have an empty bar remaining.
What happens if you remove the buff when the timer is bugged? Does the unit die? Does morphing the unit remove the bugged bar?
 
Status
Not open for further replies.
Top