• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Replace unit after Reincarnation

Status
Not open for further replies.
Level 12
Joined
Jun 20, 2017
Messages
959
I think there's a better way to do this, but you can check if the unit which has been killed has reincarnate and if so whether its alive (reincarnate has worked) a few seconds later and then replace it
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
I think there's a better way to do this, but you can check if the unit which has been killed
Unfortunately a unit with reincarnation does not die, if it is not on cooldown, so it won't fire the "a unit dies"-event. If you use the event from GUI unit event instead it should work.
Apart from that, this is how I would do it as well.
 
Level 12
Joined
Jun 20, 2017
Messages
959
@Jampion I didn't know, what about ability finished casting = reincarnation would that do?
Or trigger that checks if a unit got attacked then checks if its hp is below 1
 
Level 11
Joined
Jun 2, 2004
Messages
849
If it's going to be replaced anyway, why even use the reincarnation ability? Let the unit die normally which is very easy to detect with triggers, play the reincarnation special effects, spawn the new unit after a delay, and remove the old unit's corpse.
 
Level 7
Joined
Jan 23, 2011
Messages
350
I mean, GUI Unit Event is the easiest way to do this by far. Since the aank effect and else will already occur and you only would be Replacing after it revives

If you use a dummy abil and Unit dies event, then you have to create the sfx of the aank, remove the corpse, save needed values, use timers to wait, and then creating the new unit
It just too long.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
finished casting = reincarnation would that do?
Does not work either. Passive abilities usually don't have cast events. The only reason for GUI unit event to exist is to emulate events, that are not possible through normal events, but are very useful.
Or trigger that checks if a unit got attacked then checks if its hp is below 1
A unit is attacked event fires, when the attacker starts the attack animation, so you can still cancel it and no actual attack happens. You can use: attack-stop-attack-stop.. very quickly to fire multiple attack events in one second.
You usually use a Damage Detection System (DDS) to detect if a unit takes damage, because it's much more reliable. However this still does not work, because units can die without taking damage. Examples are instant kill skills (at least I think they don't deal damage): death pact, dark ritual, transmute
And negative regeneration: phoenix, unholy frenzy

If it's going to be replaced anyway, why even use the reincarnation ability? Let the unit die normally which is very easy to detect with triggers, play the reincarnation special effects, spawn the new unit after a delay, and remove the old unit's corpse.
This is a good solution, unless it's important, that the unit does not die. As I said reincarnated units do not fire the death event, so it won't be counted as a kill and it won't give gold or experience. Same problem with the hydra ability.
So basically if you actually wan't the unit to die (give gold, drop items, give experience, fire death event) and after that replace it you can use hydra ability or Kaiyuu's solution.
 
Level 12
Joined
Jun 20, 2017
Messages
959
I was gonna say use the pheonix's morphing ability to morph the unit then replace whatever it got morphed into, but the hydra thing seems way better
 
Status
Not open for further replies.
Top