HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random % to pick variable

05-01-2005, 03:50 AM#1
Zandose
I'm having trouble picking 1 of 6 variables based on %. Like 0%-10% would equal 1. And just in case your wondering I know how to do it but I don't want to use if statments. It's just too messy.

Heres what I have so far.
Code:
S Terrain Copy
    Events
    Conditions
    Actions
        -------- Terrain Types --------
        Set Terrain_Type[1] = Lordaeron Summer - Dirt
        Set Terrain_Type[2] = Lordaeron Summer - Rough Dirt
        Set Terrain_Type[3] = Lordaeron Summer - Grassy Dirt
        Set Terrain_Type[4] = Lordaeron Summer - Rock
        Set Terrain_Type[5] = Lordaeron Summer - Grass
        Set Terrain_Type[6] = Lordaeron Summer - Dark Grass
05-01-2005, 06:06 AM#2
Raptor--
you want weighted randomness or just standard?

standard just say Terrain_Type[Math - random number between 1 and 6]
05-01-2005, 03:54 PM#3
Zandose
Quote:
Originally Posted by Raptor--
you want weighted randomness or just standard?

standard just say Terrain_Type[Math - random number between 1 and 6]

I wanted to give each number 1-6 a % chance to be picked.

Anyways I think I've found a way. Thanks anyways.
05-01-2005, 09:10 PM#4
Guest
Set RandomnessVariable to a random number between 1 to 100.

Then if RandomnessVariable more than or equal to 1 and less than or equal to 10, do whatever. For the next set use 11 to whatever.