prevent Random Hero

Do you need World Editor help? Ask here!
Before making a new topic:
First, check if your question has already been answered in the Tutorials section.
If you didn't find a solution, use the search function.
If searching didn't help either, you can make a new topic.

Topic title & content:
You must use a descriptive title. (Help plz is not good) (Need help with Dialog buttons is good)
Go into much detail when posting. You should post attachments. Like screenshots of the problem, the map you are making, replays of the error. Or you could even make a screencast (video) of your problem and upload it here.

Grammar seems to be a serious problem amongst teenagers, so use a spell checker or you will get no love.
Read your posts twice, before pressing the reply button.
And do not use profanity. Chatspeak (y r u nub) and Leetspeak (1 C4N S33 H4X) are not welcome here either.

Only World Editor related questions are allowed here!
(Click for help) (Click for World Editor help)

prevent Random Hero

New postby BugMeNot on Wed Feb 21, 2018 10:58 am

In advanced option map. Theres checkbox list random hero. How to disable this ?
This is a guest account intended for use by people who wish to remain anonymous or hate registering.
(Please don't forget to sign your posts with your name if you want us to know who you are.)
User avatar
Posts: 109
Joined: Wed Jan 21, 2009 12:46 pm

Re: prevent Random Hero

New postby 3ICE on Wed Feb 21, 2018 11:03 am

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.
User avatar
Posts: 2373
Joined: Sat Mar 01, 2008 11:34 pm
Location: Hungary
Realm: US East
Account: 3ICE
Clan: 3ICE

Return to HELP

Who is online

Users browsing this forum: No registered users and 20 guests