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

Need help with my ressurect trigger

Status
Not open for further replies.
Level 5
Joined
Jul 25, 2008
Messages
126
Hey this is what I need. I'm completely baffled on how to go about it. I need it

so when your hero dies it resurrects at the 'nearest' friendly town hall.

Note Town halls can be captured so there isn't always a

designated friendly town hall, players choose teams at start so you don't always

know whos on your team.
 
Level 13
Joined
Sep 14, 2008
Messages
1,407
Mh I think best way is jass but I can try to do it in gui...

Event: Unit dies
condition
Action: For integer Counter 1-10000
Pick every unit within 10 x Counter range of triggering unit
If picked unit = town hall
Owner of picked unit is ally of owner of triggering unit = true
Then: Set Counter = 10000
Resecure hero


That COULD work
 
Level 12
Joined
Mar 16, 2006
Messages
992
Hopefully you understand my explanation.

Unit group, all units that match <town hall> allied to player, set total1 = total1 +1;

Unit group, all units that match <town hall> allied to player, set distance1 = distance from hero to <picked unit> if distance1 > distance2, set distance2 = distance1, total1 = total1 - 1, if total1 <= 0: if distance1 < distance2, spawn hero at distance2, else spawn hero at distance1.

That's what I would do.
 
Last edited:
Status
Not open for further replies.
Top