| 05-25-2007, 08:55 PM | #1 |
I'm making an ability that gives 100 bonus hit points to a unit when it reincarnates. How do I detect when this is happening so that I can do what needs to be done? |
| 05-25-2007, 09:15 PM | #2 |
| 05-25-2007, 09:20 PM | #3 |
I'll give it a shot, but I have a strong feeling that it won't work. EDIT: Doesn't work. |
| 05-26-2007, 04:59 AM | #4 |
you'll need 2 function, one is detecting the unit's death - if the unit is death, set some variable A to true then you'll need to run a loop every t seconds, checking the unit's current life - if the unit's life is <= 0.405, set some variavle B to true then if A and B are true, then the unit is really dead, if A is false and B is true, the unit is reincarnating |
| 06-03-2007, 03:30 AM | #5 |
But I don't think (during a reincarnation) that the unit actually dies. Take DotA for example. If a unit has reincarnation and an item that drops on death, it will not drop. |
| 06-03-2007, 03:46 AM | #6 |
Thit is demo will get reincarnation event for single unit, 100% accurate and detect both items\skills. Single unit only. GUI done. Kill your own hero located near items to test it. |
| 06-03-2007, 04:02 AM | #7 |
| 06-03-2007, 04:27 AM | #8 |
Reincarnation is an extremely stupid spell. When I have the event "Unit Dies" and on triggering a message is displayed, it displays. Yet in the example given here the unit's health merely goes below 1, and he does not die. When a condition (such as, Unit Type of Dying Unit is Tauren Chieftan -- which I know is true) is applied to the above function I made, it no longer works. Blizzard officially went homosexual for this ability. Bastards. Anyways, ruler, incase you don't understand what the JASS is doing. Basically it registers an event when a unit's HP goes below 1, and then when the unit dies. If the unit doesn't die, then it knows reincarnation has been put into effect, thus running into the next set of actions. In the next set of actions, a timer is given a 0 expiration time (no idea why) and once the timer expires it adds the event: "Unit's Life is Above 1" which is what happens upon exitting the Reincarnating state. This is an extremely confusing process because of how completely retarded Blizzard went on this. *edit* If anybody could please explain to me, why is the timer with an expiration time of 0.00 being used? I really don't see the point of this. Let me get this straight though, if the unit DIES, you know the event didn't register, but if the unit's HP goes below 1, it did register? This is probably the gayest time I've ever had understanding a blizzard ability. |
| 06-20-2007, 04:25 PM | #9 |
Ah, yes, reincarnation event, I remember the "fun" I had figuring this one out. Basicaly, the unit dies event does not occur if the unit is killed, but is about to be reincarnated. I guess the event is tied to the code that also awards bounty/exp for the kill, and the reincarnation ability skips this code completely. However, there's another way to detect when a unit dies: by detecting when it's hp gets below 1 (or 0.405, as I've heard in some sources). This event will run no matter if reincarnation comes into effect, since it detects hp change, not the actual death. The trick is, whenever this event occurs, to check if the death event also occured, which is tricky since you have to pass data between threads and other such fun. If the death event didn't occur, it's reincarnation time. |
