Author Topic: GetRandom Spawn  (Read 1859 times)

I'm trying to get a bot to spawn in  random areas on bricks only, but i don't know if its possible.

Create a list of the bricks, then select a random element from that list
Code: [Select]
function SimSet::randomItem(%this)
{
    return %this.getObject(getRandom(0,%this.getCount()-1));
}

Create a list of the bricks, then select a random element from that list
Code: [Select]
function SimSet::randomItem(%this)
{
    return %this.getObject(getRandom(0,%this.getCount()-1));
}
I think you misunderstand what he means.

I'm pretty sure he has a brick, and then he wants a bot to spawn anywhere on that brick.

I think you misunderstand what he means.

I'm pretty sure he has a brick, and then he wants a bot to spawn anywhere on that brick.
No, he has a group of bricks (probably terrain) and wants bots to spawn randomly on top of the terrain and not outside.

No, he has a group of bricks (probably terrain) and wants bots to spawn randomly on top of the terrain and not outside.

Yea what he said,
but i want the bots to spawn in packs of 5 but i cant figure this out.


There's no way for code to magically understand what you want and exactly how to do it.

If you have an area of bricks you'll need some sort of flag that makes them different than any other bricks you don't want bots to spawn on.

either a specific name, a seperate brickgroup, a designated position, anything

however, just having code figure out that a 2x4 at one place can spawn bots but a 4x6 at another place can't, isn't going to happen.

This is how I'm doing it. For my purposes, I am creating AiConnections which then spawn the bots, but you may not want to do that.

https://bitbucket.org/Greek2me/slayer/src/3326fdd7dd6fd8bfdf13212295e15ae16f07b20e/Dependencies/Bots.cs?at=dev#cl-151

Also: Hole bots must have a spawnbrick defined (can be any brick, multiple bots can use the same one) or they simply won't work.