HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Randomizing Trees

10-16-2004, 03:16 AM#1
Athifos
Ok, I have been racking my brain and I can't come up with a solution. I have a map with 10 different custom units, each with a different tree model. What I want to happen is when the game loads up you can choose the difficulty (the number of trees) and then that amount of trees gets placed randomly in an area, but I want the trees to be chosen at random. I can do it with a set amount, but since I will be letting the players choose, I don't know how to do this. I'm sure there is an easy solution, I just can't see it.
10-16-2004, 03:27 AM#2
JoSanchez55
I dont completly understand your question but i may have an answer. Create a variable intergeter and set it to a random number between x-x. Then do:

If (variable) = X create 1 tree1 else do nothing
If (variable) = X create 1 tree2 else do nothing
etc...
10-16-2004, 03:57 AM#3
-={tWiStÄr}=-
it should be the exact same as with a set number
loop 1 - DIFFICULTYINTEGER
set randomnessint = random number between 1 & 10
create 1 treeunits[randomnessint]
treeunits is a unit array where u set treeunits[1] to the first tree, treeunits[2] to the second tree etc. DIFFICULTYINTEGER is the # of trees the user(s) chose
10-16-2004, 05:21 AM#4
Athifos
Yep, that's it. It's that stupid Loop function I needed and I looked right over it. Thanks