Hi i got a question, i am making some footmen map, i got stuck at the trigger of making a allrandom mode. When i create a -ar mode, it works fine, but the problems is it always random the same unit for each players. Can any pls tell me how to solve this problem or give me an example of how to make a allrandom mode for footmen game thx!!
Event: Map initialization Conditions: Actions: Set heroes[1] = bloodmage set heroes[2] = paladin set heroes[3] = archmage (and so on. the variable heroes being a unit type array with the number of max heroes you have as the array number)
Event: player 1(red) types -ar as an exact match Conditions: Actions: Pick all players in matching player is a user = true and matching player is playing = true and do loop actions - create 1 heroes[random number from 1 to (max number of heroes) for picked player at picked players start location(or w/e region)
the problem, is i understand it, is not that the SAME UNIT is given to SEVERAL players but more that EVERY TIME there are the same units given to the same players as in the turn/s before...
There is no randomizer in singleplayer. Therefore if you want to test a somewhat random trigger you should do it in multiplayer. The more players the better the randomizing function of WC3
and for randomly giving each player a hero without giving one twice - this shall work
variables integer tmp_1 = length of your array integer tmp_2 = 0 unittype array heroes[] = your heroes(starting with heroes[0])
I didnt try it out but i don't think that it prevents game from giving same heroes. You have to check for given heroes each time you randomized that number. Your trigger checks for maximum array size... why that ?
i pick a random unit from that array (e.g. index = 3/7) then i move the last value of the array to the position the unit i gave was in (herores[3] = heroes[7]) then i reduce the length of the array by one (not the real length, but the length that is considered for giving heroes)
now i have no hero within my array that ha sbeen given to anyone already
hope it's understandable, for i do not have the time thinking about it for more than a few seconds - i'm mapping atm
You pick heroes[3] out of those 7 Then you set the pick range from 7 to 6 That means hero 7 cant be picked anymore. It doesnt mean hero 3 won't be used again.
tja, da sieht man mal, wozu es nützlich is, wenn man n weilchen programmiert und sich so des ein oder andere angewöhnt ^^ (und für mich IST esa einfacher ^^ - weil kürzer als der rest ^^)
Ich bin nie über html hinausgekommen beim 'programmieren' *g* Aber das schöne is ja das es immer ne menge wege zum ziel gibt und das nachher niemand sieht welchen man genommen hat
Shorter = better , thats true. Ashes on my head I suck