Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
1 step - add all of your heroes to HeroGroup.
2 step - check when any hero die.
3 step - when hero die check number of alive heroes in HeroGroup.
4 step - if all units in heroGroup are Dead. then victory/defeat
that wont work if there is more than 2 players. if there is more than 2 players each player needs their own unit group and when all except one is empty the player remaining wins.
The easiest solution is a simple integer array. This allows for mpi.
Simply increase integer for that player when that player creates a hero unit. Decrease it when that players hero unit dies. After decreasing check if integer is less than 1. In the then block make that player lose.
Using a unit group with a check to count units in unit group is inefficient. To count units in unit group it loops through every unit and increases an integer.
i guess that an integer would also be possible but i never thought of using that in a victory condition. each player still need their own variable though.
Because the trigger you posted is very inefficient.
Using an integer array is a lot more efficient than looping through all units in map. Checking if they are owned by a player. Creating a unit group. Leaking when you check number of units in group. Then destroying group.
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.