Skip to Content

bz_getSpawnPointWithin()

Available since 2.4.20

Get a random position within a bz_CustomZoneObject that is safe for a player to spawn at.

The following considerations are taken into account when this function determines a "spawn point":

  • The point is within the world boundaries (max height too)
  • The point does not collide with map objects
  • The point has enough vertical clearance for a tank to spawn at

If a "spawn point" could not be determined within the given zone, this function will return false. If this function returns false, you cannot trust the points set to randomPos; they will simply be the last random position that was tested before this function gave up.

This function respects the _spawnMaxCompTime BZDB setting when trying to calculate a random spawn position.

Usage

bool bz_getSpawnPointWithin(bz_CustomZoneObject* obj, float randomPos[3])
Parameters
bz_CustomZoneObject* obj

The bz_CustomZoneObject that will be used as a bounding box to determine a spawn point.

float randomPos[3]

The pointer to the random spawn position (X, Y, and Z) within obj.

Returns

bool - True when a spawn point was able to be found within the given parameters.

Other Spawn Management Functions

Back to bzfs API Functions

This content is maintained on GitHub. We welcome any feedback and improvements!

Give us Feedback Edit this Page