how can i make things spawn randomly in a circle, i know how to make things get spawned in the same spot each time , realative to the player, and i know the proc rand(), but i have no clue how i would get this to be in the shape or close to the shape of a circle
please help
ID:160272
Oct 10 2008, 10:42 am
|
|
Oh, one more thing, if you check out the resources page you'll find some good code on creating circles near the bottom of the first page. "BasicMath" by AbyssDragon.
|
Randomization: [link] You can use pick() to randomly pick a value from a list.
Getting a list of turfs in a circle: you could use a loop with turn() and get_step() |
In response to Kaioken
|
|
I was looking at the DM guide just now, and I found an even easier way:
block(get_step(centerturf,NORTHWEST),get_step(centerturf,SOUTHEAST)) The only trouble (assuming you're not standing next to a map edge) is that this isn't a true circle, just a block. You'd need something like AbyssDragon's simple math library for a good circle generator. |
If you're still confused, here's a few links that might help:
Using Lists
rand() reference
If that's still too hard, practice coding for a bit and you should pick it up in time. In the meanwhile, stick with static spawn points.