I’m trying to make a custom gamemode. I already set up multiple spawnpoints that players randomly spawn on, but anyone from any team could spawn at any point. I want to segregate the spawn points by teams (so certain players always spawn at certain points, or a select group of points, and the other team has their own points). Does anyone know how to do this? I found some references to the Team.SetSpawnPoint function, but I’m not sure how to implement it, and all of my attempts have failed.
I should note that I’m working in the HL2 engine, and thus only have info_player_starts available. How would I differentiate between which ones a player on team 2 or whatever can spawn at? I did read something about searching for spawnpoints at certain entities. For instance, I found this piece of code;
team.SetSpawnPoint( TEAM_TERRORIST, “info_player_terrorist” );
team.SetSpawnPoint( TEAM_COUNTERTERRORIST, “info_player_counterterrorist” );
That goes in the init, I believe. Anyways they’re clearly defining spawn entities here. Does this mean that I could tie a spawn point to another entity, like a logic relay or a prop? I haven’t gotten that to work so far, but I’m wondering if it’s at least possible.
Just to be thorough, I should also note that I tried this piece of code too;
if ply:Team() == TEAM_0 then
local points = ents.FindByClass(“info_player_start”)
And I set up a similar function for the other team, and told it to find a different entity class for spawning. Didn’t work. Everyone could still spawn at every spawn point that was set around a player_start, and nothing else.
Anyways, does anyone know how this is done? Also, how would I check to see if a spawn point is blocked?