Page 1 of 1

prevent Random Hero

Posted: Wed Feb 21, 2018 10:58 am
by BugMeNot
In advanced option map. Theres checkbox list random hero. How to disable this ?

Re: prevent Random Hero

Posted: Wed Feb 21, 2018 11:03 am
by 3ICE
Asked by Rayhan.
How to prevent Random Hero ?

Daniel Berezvai:

Easy enough, I think. The idea is:
Event: Elapsed game time 0.01 sec (or something similar, just do it right after map initialization)
Action: Delete all heroes from the map by doing this sequence:
For loop: Pick each unit in (playable map area) matching (picked unit is a hero)*
Remove picked unit from the game.
* explained in followup comment.

*= It has been a while since I used GUI. This Unit group - pick all units thing might go differently, for example:
All units in area matching condition
condition=Unit has flag
has flag = is a hero
area=entire map

Good luck!

Alejandro: that might work

Daniel Berezvai Also also: make sure you don't remove heroes you yourself placed in the map, for example if you use the wisp + circle of power + hero standing next to it hero pick scheme, exclude those heroes from the unit group. (With something like: units owned by player matching condition)

Rayhan ggwp :D. Thankyou so much for the information. I will try it !!

Daniel Berezvai Here I opened the editor and made this:
t_ugr Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Remove (Picked unit) from the game)

Important to change every instance of "triggering unit" to either "picked" or "matching" unit, as appropriate.

Without JASS it is impossible to get rid of the useless "Equal to True" bit. Not really a big performance hit anyway. Just hurts to see any inefficiency. We can probably ignore the memory leak too (one unit group), as this code only runs once.

Every time I post in a closed group I feel sad. Why don't we allow the whole world to see this?

To alleviate that effect I copied my solution to my website so anyone googling this problem, who is not in this closed facebook group, can find it easily.
http://forum.3ice.hu/viewtopic.php?f=14&t=973