• How to set custom spawn points on a workshop map?
    7 replies, posted
Title says it all. I'm making a custom deathmatch server on the map called gm_bigisland off of the workshop. The problem is that 85% of the time a player spawns in the "spawn area" which gets camped by snipers. If you know how I can fix this please help me. Thanks in advance.
I finally got Garry's gma extractor to work so I have the actual map file, but I'm not sure where to go from there.
[CODE]hook.Add( "PlayerSpawn", "SomeUniqueName", function(ply) SetPos( ply.SpawnPoint ) end)[/CODE] Note that ply.SpawnPoint is a variable you'll have to define. You don't need to do anything specific to the map itself (Except define your spawn positions, but you knew that).
[QUOTE=Mossman1223;42027241][CODE]hook.Add( "PlayerSpawn", "SomeUniqueName", function(ply) SetPos( ply.SpawnPoint ) end)[/CODE] Note that ply.SpawnPoint is a variable you'll have to define. You don't need to do anything specific to the map itself (Except define your spawn positions, but you knew that).[/QUOTE] I'm sorry, but can you explain a little more please. I want to spawn off of x,y,z coordinates. example: (Vector(-5560.655762, -2297.068848, 823.798035)
[lua] hook.Add( "PlayerSpawn", "SomeUniqueName", function(ply) ply:SetPos( Vector(-5560.655762, -2297.068848, 823.798035) ) end) [/lua]
ply.spawnpoint is a variable called spawnpoint attached to the player entity. it would have been defined in a way such as ply.spawnpoint = Vector(number,number,number) at some earlier time. You can simply use ply:SetPos(Vector(x,y,z)) inside the playerspawn hook. If you do not understand hooks you should say so.
There's actually a better hook for this that PlayerSpawn. that's actually meant to do this. This controls where players spawn. I made mine so that if a point doesn't exist, it creates it ( a POINT entity ), then it selects a random spawn point on the map ( controlled by my map config system which stores spawn points based on teams, etc around the map ), then it sets the spawn point entity to the random position / angle, then it returns that point entity. The player then spawns at that location. [url]http://wiki.garrysmod.com/page/GM/PlayerSelectSpawn[/url]
[QUOTE=crazyscouter;42028125][lua] hook.Add( "PlayerSpawn", "SomeUniqueName", function(ply) ply:SetPos( Vector(-5560.655762, -2297.068848, 823.798035) ) end) [/lua][/QUOTE] This is working, I'll just get a bunch of different positions and use math.random to call a certain position. Thanks for the help everyone, much appreciated!
Sorry, you need to Log In to post a reply to this thread.