This script simply fills in a floating point array with random origins for player spawns. The player spawns are all tested to be assured that the spawns are valid (inside of the map). This process takes a while and test results for some maps on my home PC are listed below.
This process is meant to be run simply once per map which means whoever uses this script should create a way to save and load the origins.
An example of how this script can be used is attached (it is fully functional and requires AMXX 1.8+ (Ham Sandwich)).
A test plugin that I used to test the methods and bad spawns is also attached.
This can also be used to create random power-up/item/rune/etc. spawn locations (Change min/max size in .inc file)
Code:
/* GHW Spawnlist Generator - v1.0
*
* by GHW_Chronic
* 06/2008 - 08/2008
*
* This file is provided as is (no warranties).
*
*
*
*
* //This fills in the array (Float:origins[MAX_ORIGINS][3])
* //Methods: 1=Normal 2=Extensive 3=Exhaustive
* //num_origins - number of origins to find (Max is MAX_ORIGINS)
* genspawnlist(method,num_origins)
*
* //This checks to see if a player is inside the map (Some maps may give broken random spawn points)
* In_Map(id)
*
* //This stops the current search
* save_locations()
*
*
* Tests (Windows - AMD 64-bit 2.6 Ghz Dual-Core Processor):
*
* Map Method # Found Time (sec) # Broken
* de_dust2 1 27 60 0
* de_dust2 2 30 93 0
* de_dust2 3 30 97 0
* de_train 1 20 60 1
* de_train 2 30 70 0
* de_train 3 30 120 0
* de_nuke 1 30 41 0
* de_nuke 2 30 65 0
* de_nuke 3 30 122 0
*
*
*
*/
//Number of origins to find
#define MAX_ORIGINS 30
Methods
#1 - Normal - Searches 2,500,000,000 units3 with a 60 second timeout
#2 - Extensive - Searches 16,000,000,000 units3 with a 120 second timeout
#3 - Exhaustive - Searches 24,000,000,000 units3 with a 300 second timeout
Normal works for most maps yet sometimes Extensive can give better results. Exhaustive seems to give the best results however it takes on average 2-3 times longer than Normal.
Note: Attached below are a few examples of bad spawns not detectable by my algorithm nor the In_Map(id) function.
a question :
I can create internal gun recipient boxen automatically on map neither. after 1 durations be to show yourself and after 1 tense duration is abasic ???