| 09-08-2004, 10:35 PM | #1 |
i can't believe i'm asking thit... but... i wasn't able to to find a suitable way 2 do a random hero selection system. i tried: i set: --- variant [unit group named "Heros"] event: add [unit type of [ a hero ] to [unit group[Heros]] add [unit type of [ another hero ] to [unit group[Heros]] add [unit type of [ and another ] to [unit group[Heros]] .... for integer A from 1 to 10 --- create a [random unit from unit group[Heros] for player(integerA) at [random point in [a region]] --- remove last created unit from [unit group [Heros]] well.. i don't know why the unit group is still empty after the "add [unit type]..." So.. i tried the the next trigger: Hero(1 to 10) [arrayed Unit type variant] MyInteger [integer variant] Set hero(1) = [a hero] Set hero(2) = [another hero] Set hero(3) .... for integer A from 1 to 10 set MyInteger = random integer between 1 and 10 create a Hero(MyInteger) for player(integer A) at [random point in [a region] ok.. this one works... yes, but. can you see the problem? the variant MyInteger gets a random integer between 1 and 10 every time. not a different number every time. Do you undestand? if anyone knows how to resolve this... c ya. |
| 09-08-2004, 10:45 PM | #2 |
hero[1]=footman ... hero[10]=doom guard heroN = 10 for integer A from 1 to 10 set MyInteger = random integer between 1 and heroN ... (do stuff with hero[MyInteger]) ... set hero[MyInteger]=hero[heroN] set heroN = heroN - 1 edit: and in your unit group version, you were removing last created unit, but what you had to remove was the Random unit that came out |
| 09-08-2004, 10:53 PM | #3 |
exactly. but how can i remove an exact number between 1 and 10?? what's that about HeroN? |
| 09-08-2004, 10:55 PM | #4 |
ooh! sorry. i understand but.. check it again.. doesn't work... still. |
| 09-08-2004, 11:18 PM | #5 |
mmmh.. you're right... did you do it by yourself?? or you saw it in another place? i'll apply it right now!! thanks Lord Vexorian! ^_^ |
