| 02-17-2004, 03:45 AM | #1 |
how can i make a random hero select for the players? for example i have 40 heros and at the very start of the game it randomly picks 12 for each of the players (and no overlaps of heros, so no doubles are picked) some1 helped me and made a example map for me with the random character selection information inputted already but i couldnt get it to work here is the map http://battlebotv8.2.tripod.com/GameFAQHelping.zip this was the info inputted : Randomize an Interger (For each player) with Set Varible action. Then in the same trigger which randomizes the Intergers, Run Trigger (Checking Conditions) action for every hero you have... If/Then/Else If Interger Comparisen; RandomHeroInterger Equals to XNumber XBooleanArray Equals to False Then Unit - Create unit facing angle; Create 1 XHero at XRegion for XPlayer Set Varible; XBooleanArray = True Else: Randomize Interger and run all hero triggers could someone tell me why it doesnt work and how to exactly make a random character selection for each player as the game starts? |
| 02-17-2004, 06:02 AM | #2 |
Ok, just add all the possible heroes to a unitgroup variable. then have a for loop for the players, that goes...pick a random unit from unitgroup, create unit for player, remove unit from unitgroup. That way it'll choose a random unit and it won't double up. |
| 02-17-2004, 06:41 PM | #3 |
how do i add heroes to a unit group? do i need array for the unit-group variable? after making the unit -group variable then do i have to use triggers to add the heroes to the unit group? when i try to add the units by select unit it just changes to the map screen and lets me add directly on the map which is not what i wanna do how can i add heroes to the unit -group? |
| 02-17-2004, 08:28 PM | #4 |
Ok, let's say the available heroes, are all owned by neutral passive, and the player selects them in order to choose them as their hero. At melee initialization, have a pick every unit in units owned by neutral passive matching condition matching unit is a hero equal to true. Then look up 'unit group' actions, just beneath the 'unit' actions in the action list, find 'add unit to a unitgroup' then say add picked unit to "herounits"(the unit group you should've made) ok? |
| 02-17-2004, 08:52 PM | #5 |
... God, Random unit from unit group! Ugh, I cannot belive I forgot that! |
| 02-17-2004, 11:47 PM | #6 |
ok i now know how to add heroes to variable unit-group by putting all the heroes i want on the map first and then selecting all the units in that region and putting them into the variable unit-group Unit Group - Pick every unit in (Units in Heros <gen>) and do (Unit Group - Add (Picked unit) to HeroUnitGroup) the thing is, is there a way i can add the heroes into the unit-group without putting them onto the map first? there not much room on my map to do that and 40 heros will take up space and sorta look dumb just standing there idle is there a way to add the heroes without putting them the map first? |
| 02-18-2004, 08:47 AM | #7 |
I would assign each of your units to a unit-type array. If you have 12 Heros then you would assign Hero[0] - Hero[11] (0 counts as a variable). Then your heros are now converted to integers (0 - 11) much easier to deal with. I have a great example from Lord Vexorian here somewhere, let me look for it. From Lord Vexorian. Greetings, hopefully my random number experience will help you: Map Initialization: set N=3 <-------0 is included here! 0123 set hero[0] = paladin set hero[1] = archmage set hero[2] = bloodmage set hero[3] = mountainking The trigger were you pick a random number: set rnd = Math - Random number betwen 0 and N Now use hero[rnd] where you need it, after using it do: set hero[rnd] = hero[N] set N= N-1 Use this to pick your random number (Hero) and then remove that number from your array (so it won't be picked again) |
| 02-18-2004, 09:36 PM | #8 |
alright i know how to set variable unit-type array for each hero assigning a different number for each do i only have to use one variable which is the unit-type array? also, what and how do i do set N=3? and what is "N"? and for the trigger set rnd = Math - Random number betwen 0 and N Now use hero[rnd] where you need it, after using it do: set hero[rnd] = hero[N] set N= N-1 what action do i need to do that , is that all in unit-->action? what is "rnd" is that another variable? also, what action should i use to create the unit? do i use Unit - create unit facing angle ? if i use a unit -action it seems i cant do mulitple actions so i cant create and then loop remove from unit-type array |
| 02-19-2004, 02:47 AM | #9 |
WOOOHOOOO!!!! i finally figured it out !!! its works perfectly!! i realized that i needed 3 variables (1 unit-type array and 2 integers no array) because when i had to set something i figured out it had it had to be a variable with the three variables the rest was easy just a matter of a little math here and there (still dont really understand how the N = (n-1) removes the specific number from the array) Actions Set rnd = (Random integer number between 0 and N) Unit - Create 1 hero[rnd] for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees Set hero[rnd] = hero[N] Set N = (N - 1) Using the three variables was genious!! Thx alot!!! all who helped me !!! Finally !!! YEAAA!!!!!!!! |
