• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Detect unit Death w/ reincarnation

Status
Not open for further replies.
Level 6
Joined
Jan 27, 2007
Messages
208
Trigger 1
Event - Unit enters playable area
Condition - Entering unit Equal to Your Hero
Action - Set Hero[Player number of Owner of Entering Unit] = Entering Unit

Trigger 2
Event - Every 0.1 second
Action
Set HeroHPPlayer1 = Life of [Hero[1]]

Trigger 3
Event - HeroHPPlayer1 becomes Less than or equal to 0.00
Action
Do your action here
 
Level 12
Joined
Mar 16, 2006
Messages
992
What are you trying to do when you detect the reincarnation death? Knowing this will help figure out what you need to do.
 
Level 6
Joined
Jan 27, 2007
Messages
208
Trigger 1
Event - Unit enters playable area
Condition - Entering unit Equal to Your Building
Action - Set Building[Player number of Owner of Entering Unit] = Entering Unit

Trigger 2
Event - Every 0.1 second
Action
Set HeroHPPlayer1 = Life of [Building[1]]

Trigger 3
Event - Elapsed game time is 0.5 second
Action
Set Villager[1]=Your Villager
Set Villager[2]=Your Villager
Set Villager[3]=Your Villager
etc..

Trigger 4
Event - HeroHPPlayer1 becomes Less than or equal to 0.00
Action
Set tempPoint = Position of Dying Unit
Create 1 Villager[Random number between 1-3] at tempPoint unit facing default
Create 1 Villager[Random number between 1-3] at tempPoint unit facing default
Create 1 Villager[Random number between 1-3] at tempPoint unit facing default
Custom Script : RemoveLocation (udg_tempPoint)
 
Level 12
Joined
Mar 16, 2006
Messages
992
You shouldn't be using reincarnation if you just want to rebuild them. That's stupid.

Use a trigger that detects when a unit dies, checking if that unit is a building, or a building of type <type>, and then set point = position of (dying unit), WAIT X seconds, and create 1 (dying unit) at point.

A unit dies
(dying unit) is a building
Set point = position of (dying unit)\
<Create Whatever Villagers at point>
Wait X seconds
Remove Villagers
Create 1 (dying unit) at point
Call RemoveLocation( udg_point )
 
Level 12
Joined
Mar 16, 2006
Messages
992
yeah? and what if another building dies when that one is still dead?

Then the trigger runs again?

You don't know how triggers work, do you. That's how most creep respawn systems work. Just because the trigger has run once and is waiting doesn't mean it can't run again for a different dying unit. Christ.
 
Status
Not open for further replies.
Top