HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help with a random choosing system... ?

03-23-2004, 09:41 AM#1
InSAnE_NiNjA
i'm trying to make a map that does a random selection in the begining of the game... one similar to the one in dark deeds... help plz?
03-23-2004, 11:02 AM#2
johnfn
You should make an array of heroes. Like so:


Hero(1) = blademaster
Hero(2) = warden
Hero(3) = devastator

...

And then after you do that, you do this

Create 1 Hero(random integer from 1 to amount of heroes) at some location facing default building facing degrees.

I put the parts in italic that you need to fill in for yourself.
03-23-2004, 11:03 AM#3
ThyFlame
set Variable1 = random number 1-12

IF Variable1 = 1 AND player 1 == is playing THEN
IF Variable1 = 2 AND player 2 == is playing THEN
03-23-2004, 03:01 PM#4
InSAnE_NiNjA
i still dont' get it... is it possible for u to show me 1?
03-23-2004, 03:58 PM#5
Bloodlust
about what kind of random system are you talking, please?

you know there is a MATH - RANDOM NUMBER thingy
03-23-2004, 07:23 PM#6
ThyFlame
Simple code, the RandomNumber is an integer variable.

Code:
Random Hero Selection
    Events
        Time - Elapsed game time is 0.02 seconds
    Conditions
    Actions
        Set RandomNumber = (Random integer number between 1 and 12)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Player(RandomNumber)) slot status) Equal to Is playing
            Then - Actions
                -------- Here you put which give X hero to player(randomNumber) --------
            Else - Actions
                Trigger - Run (This trigger) (ignoring conditions)


Oh, I just remembered. Where I say to put the code to give X hero to player, you can use another random number [Set RandomNumber2 = random number between 1 and however many heros you have | give player(RandomNumber) hero[RandomNumber2], where hero is a unit variable array and randomnumber2 is another integer array.

You'll need to set the units before that though.

So, at .01 seconds
set hero[1] = blademaster
set hero[2] = naga sea witch
etc.
At .02 seconds run the trigger above.