🏆 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!
Count the number of heroes who enter the event and store it in a global integer. Every time one of them dies you decrement the integer (reduce by 1). Check if the integer is equal to 1 (1 hero alive) and then do whatever you want to the winner. You can use a unit group to keep track of the heroes in the event, when the integer is at 1 you can check the unit group for the hero that is still alive in the event and so know who won.
You could also use some kind of list structure and remove dying players from it until the list size is 1. In this case you know the last element in the list must be the winner.
If you remove heroes on player leave or there is some event dropout you may want to add a check to decrement the integer or remove from the list in those cases otherwise you might end up with 1 hero alive and it thing there are still more.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.