Random pickups doubt
#1

I'd like to create a system which spawns objects such as guns, bags, etc. all around the map, so the player can go and pick them up, drop them, etc.
I've seen some systems but the problem's in the random thing, I don't really know how to do it since they could appear even in the air.
Thanks!
Reply
#2

Most of those scripts aren't really 100% random. Of course you could create true randomness, fetch Z position using MapAndreas, but you'd have to refine it. Usually it's done like:
1. Create an array of viable positions
pawn Код:
static stock const Float:Positions[3193219837132][3] = {
{ X, Y, Z },
{ X, Y, Z },
//ad nauseam
}
2. Generate random number between 0 and sizeof Positions - 1
3. Use that as an index
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)