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

EVENT_PLAYER_HERO_REVIVE_CANCEL only fires when clicking cancel

Status
Not open for further replies.
Level 23
Joined
Jan 1, 2009
Messages
1,610
JASS:
Hi folks,

I have the following snippet
Wurst:
CreateTrigger()
		..registerAnyUnitEvent(EVENT_PLAYER_HERO_REVIVE_CANCEL)
		..addAction(() -> print("on Revive Cancel")

As you can probably tell it fires on the REVIVE_CANCEL event.
Now the problem is, that it ONLY fires when you cancel the revive-process by hitting the Cancel-Spell (or Escape since it's the hotkey),
but NOT when you click the icon in the training-queue (which most people do).

Does anyone have an idea on catching the clicked Icon event? (onTrainCanel doesn't work)

Any help is appreciated.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Are you retarded dude?
If you have no good input then don't post at all okay?
Read what I posted above. I am using that Event, but IT DOESN'T WORK!!

Relax I meant to post the unit specific one.
I was trying to post this one.
I am on my phone and internet is bad here atm.
EVENT_UNIT_HERO_REVIVE_CANCEL
Also I am simply trying to help no reason to be rude.

It's even in the freakin title, do you just post to get a higher postcounter?
I do not care about something trivial like that.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
That one doesn't work either.
And yes, if you post without testing if it actually could help, your posts are useless

If you are trying to solve your problem being rude like that with people who cannot test then that is just useless. Not the people trying to help you.

It can be caught using the order id as everything has an order id.
The best way would be to find out the order id then use that to catch it.

If you can't figure that out then you need to create your on queue and check every 0.03 to see if that unit is still being revived.

I used this method before when testing my item and unit gold / lumber cost system to make sure it worked correctly when giving back hero gold / lumber revive cost that was cut short.
 
Level 23
Joined
Jan 1, 2009
Messages
1,610
Create a unit group and check every 0.03 to see if that unit is still being revived.

I used this method before when testing my item and unit gold / lumber cost system to make sure it worked correctly when giving back hero gold / lumber revive cost that was cut short.

Ok, sounds reasonable, how do I check if a unit is still being revived?
 
You could make a counter for your hero. Each time it starts reviving you increase this hero-specific counter.

Then if you want to check if hero is reviving, you make a backup of the counter, and order your building to revive your hero.

After a 0 seconds timeout timer you can check if current counter still equals your backup value. If yes, it's still reviving.
 
Status
Not open for further replies.
Top