• 🏆 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!

Reincarnation event?

Status
Not open for further replies.
Level 2
Joined
Jun 20, 2011
Messages
19
Didn't find similar threads, so I decided to start one.
So, I was hoping to make a custom reincarnation spell, with dummy units spawned to do stuff when the ability goes off. Only problem is, I can't find an event that catches reincarnation being cast. So far I've had no luck with "Starts the effect of an ability", "Begins casting an ability" or "Unit Dies" for that matter.
Any ideas or simple workarounds that don't give the casting player a bunch of "hero has fallen" spam by letting it die, then recreating it etc?
Another thing to consider is that my map sports a bunch of reincarnation items on the heroes to represent extra lives, and the hero's own ability should have priority over these, like a normal reincarnation does.
 
A unit indexer based off of the undefend bug is the only way to do it without spamming triggers or periodic timers. Basically the unit dies, fires an undefend order, and if the "unit death" event does not fire then you know it's a reincarnation. When the unit fires its undefend a second time, that means it got revived.

Has this been done in GUI? Absolutely not. I guess I could make one ;)
 
Level 13
Joined
Sep 13, 2010
Messages
550
I brought you a simple GUI function. It filters almost everything like dying and ankh of life item...
  • ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ug = (Units in (Playable map area) matching ((Level of Reincarnation for (Matching unit)) Not equal to (!=) 0))
        • Do Multiple ActionsFor each (Integer A) from 1 to (Number of units in ug), do (Actions)
          • Loop - Actions
            • Custom script: set udg_u = FirstOfGroup( udg_ug )
            • Unit Group - Remove u from ug
            • Trigger - Add to ReincarnEvent <gen> the event (Unit - u's life becomes Less than 1.00)
      • Custom script: call DestroyGroup( udg_ug )
  • ReincarnEvent
    • Events
    • Conditions
      • ((Triggering unit) is dead) Equal to (==) False
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (==) Ankh of Reincarnation
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Do Multiple ActionsFor each PREFERLOCALINTEGER from 1 to 1000, do (Actions)
        • Loop - Actions
          • Wait 0.10 seconds
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Life of (Triggering unit)) Greater than (>) 1.00
              • Then - Actions
                • Game - Display to (All players) the text: I was Reincarnating!
                • Skip remaining actions
              • Else - Actions
If a hero learns this ability add it manually like the ini function with little changes
 
Last edited:
Level 26
Joined
Mar 19, 2008
Messages
3,140
I brought you a simple GUI function. It filters almost everything like dying and ankh of life item...
  • ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ug = (Units in (Playable map area) matching ((Level of Reincarnation for (Matching unit)) Not equal to (!=) 0))
        • Do Multiple ActionsFor each (Integer A) from 1 to (Number of units in ug), do (Actions)
          • Loop - Actions
            • Custom script: set udg_u = FirstOfGroup( udg_ug )
            • Unit Group - Remove u from ug
            • Trigger - Add to ReincarnEvent <gen> the event (Unit - u's life becomes Less than 1.00)
      • Custom script: call DestroyGroup( udg_ug )
  • ReincarnEvent
    • Events
    • Conditions
      • ((Triggering unit) is dead) Equal to (==) False
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (==) Ankh of Reincarnation
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 1000, do (Actions)
        • Loop - Actions
          • Wait 0.10 seconds
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Life of (Triggering unit)) Greater than (>) 1.00
              • Then - Actions
                • Game - Display to (All players) the text: I was Reincarnating!
                • Skip remaining actions
              • Else - Actions
If a hero learns this ability add it manually like the ini function with little changes

You shouldn't use skip remaining actions.
Looping from 1 to 1000!? Dont use waits, they are not MUI, if he has many units with this ability on map, waits will bug it.
 
(Triggering unit) is usable after a wait though this is still extremely bad form.

1. Item reincarnation can be detected via "uses item" events so I don't know what he's doing there.

2. Waits are going to provide pretty bad response time, especially if you need results right away it can take up to half a second to recognize that the unit is back in play.

3. The init he does with the pick all units is silly, there is no need for the extra loop or the extra custom script

4. Yeah this is spamming events which is a really bad thing.

5. A unit's life can go less than one but it only dies if it his the 0.405 mark. It makes no sense that Blizzard made life a real number and not an integer.
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
The last thing you metioned also bothers me, as well as armor, i dont get how unit can have for eg. +0,06 armor it does not make sense in real. (however I know that its for EHP)
Similar problem happened to hastables, part of their functions cant be used but can be selected (what can casue world edit crash -.-)
 
It's because whoever in Blizzard updated World Editor definitely didn't think about that "ability" and "trackable" are not valid types in GUI hence the crash. Basically if you want to save a value that you can't make with variable editor, don't try saving it in hashtable. The only exception is "ability" because that's just an integer rawcode in JASS, you can use JASS to set the ability integer to a variable and then save the variable into the hashtable as integer, then repeat the mess in order to load it.

Or just use JASS to begin with.
 
Level 13
Joined
Sep 13, 2010
Messages
550
You shouldn't use skip remaining actions.
Looping from 1 to 1000!? Dont use waits, they are not MUI, if he has many units with this ability on map, waits will bug it.

Skip remaining actions at the first dont really need but at the second it is. If it doesnt exit then it would spam the I was reincarnating text for 1000 times... Waits are MUI if you are using it well. Triggering things has a local instance for all triggers, nevermind how much time is it running. Try that you create two units from different time and add an enters rect event, wait, and show triggering unit name. You will see.

Bribe said:
(Triggering unit) is usable after a wait though this is still extremely bad form.

1. Item reincarnation can be detected via "uses item" events so I don't know what he's doing there.

2. Waits are going to provide pretty bad response time, especially if you need results right away it can take up to half a second to recognize that the unit is back in play.

3. The init he does with the pick all units is silly, there is no need for the extra loop or the extra custom script

4. Yeah this is spamming events which is a really bad thing.

5. A unit's life can go less than one but it only dies if it his the 0.405 mark. It makes no sense that Blizzard made life a real number and not an integer.

1. Then detect the item event. But hero ability can't be detected via events

2. I can tell that too it is not the fastest, but this loop because cast time can be changed, and it is flexible for different cast times. If it takes 5 second to cast then he can delete the whole loop thing and put a Wait 5 seconds then heres the reincarnating. However I found a problem with that Unit is dead condition. It should be removed because damn warcraft recognises it as dead unit so it cant fire, he should still check if units HP is more than 1 after wait.

3. It silly but I was using this way in Jass so I used here too. Change if you want it is just because my stupid routine.
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Level of Reincarnation for (Matching unit)) Greater than (>) 0)) and do (Actions)
    • Loop - Actions
      • Trigger - Add to ReincarnEvent <gen> the event (Unit - (Picked unit)'s life becomes Less than 1.00)
4. I don't believe that he is having hundreds of units which has reincarnation. For a low amount of units it is perfectly working and lagless.

The common problem is that with this is the loops. Because GUI doesn't have locals then it is harder to make it GUI. Of course it still can be used with custom scripts.

Hope you can understand everything... ;)
 
Level 2
Joined
Jun 20, 2011
Messages
19
Whoa, that's a bit a chew though. I think you may have accounted for more things than I really need to. First of all, I guess I should've mentioned that this ability does not need to be MUI at all - only have one unit that can use it. But let me decipher what I can:
  • ini
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Set ug = (Units in (Playable map area) matching ((Level of Reincarnation for (Matching unit)) Not equal to (!=) 0))
  • Do Multiple ActionsFor each (Integer A) from 1 to (Number of units in ug), do (Actions)
  • Loop - Actions
  • Custom script: set udg_u = FirstOfGroup( udg_ug )
  • Unit Group - Remove u from ug
  • Trigger - Add to ReincarnEvent <gen> the event (Unit - u's life becomes Less than 1.00)
  • Custom script: call DestroyGroup( udg_ug )
The hero learns the ability halfway through the game, they don't start with it. So...call me a fool, but why not just replace this whole hassle with Unit learns a skill and keep the action to add the event to another trigger?
  • ReincarnEvent
  • Events
  • Conditions
  • ((Triggering unit) is dead) Equal to (==) False
  • Actions
  • Do Multiple ActionsFor each (Integer A) from 1 to 6, do (Actions)
  • Loop - Actions
  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (==) Ankh of Reincarnation
  • Then - Actions
  • Skip remaining actions
  • Else - Actions
  • Do Multiple ActionsFor each (Integer A) from 1 to 1000, do (Actions)
  • Loop - Actions
  • Wait 0.10 seconds
  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Life of (Triggering unit)) Greater than (>) 1.00
  • Then - Actions
  • Game - Display to (All players) the text: I was Reincarnating!
  • Skip remaining actions
  • Else - Actions
This is where it gets a little confusing for me, but maybe I'm just paying too much attention to things that don't actually do anything. But first of all, wouldn't this make the item reincarnation go off first and ignore the ability if the hero has the item, when it's the other way around I'd like to do this if possible?
Finally, I guess I was a bit unclear on what exactly I'm looking to detect. The first guy who responded had the right idea with trying to detect when the hero is about to die, although I haven't tried his suggestion just yet, because I'm not sure how to work around the inevitable "unit dies" event even if I do catch the right moment there.
The idea is that my custom stuff is supposed to take place during the reincarnation animation (by default, the little tombstone and all that), not after it.


EDIT: I solved it. Turns out all I had to do is give the hero a stock reincarnation spell (with modified tooltip and icons) and then use the unit takes damage event suggested by the first poster anyway. Add a boolean to mark when reincarnation is on cooldown, a trigger that's only point is to wait out the cooldown and mark it ready again, and this lets me slot in whatever I want on top of the reincarnation animation, which is what I was looking to do here all along.
Still, thanks for all the other ideas. Might come in handy someday.
 
Last edited:
Status
Not open for further replies.
Top