Is there a way I can setup a table with the guns I want spawning and make it so those guns randomly spawn anywhere as long as it isn't in a wall or in the air?
In which gamemode?
In my custom gamemode
Don't feel like spoon feeding but here's a start:
[url]http://wiki.garrysmod.com/page/ents/Create[/url]
[url]http://wiki.garrysmod.com/page/table/Random[/url]
[url]http://wiki.garrysmod.com/page/timer/Create[/url]
Well, I know that code, man, you helped me sooo much
[QUOTE=The Noodler;50587896]
[url]http://wiki.garrysmod.com/page/timer/Create[/url][/QUOTE]
Timer? You shouldn't be feeding him at all.
[code]
SpawnPoints = {
Vector(0,0,0),
Vector(10,0,0),
Vector(20,0,0)
}
Weapons = {
"weapon_frag",
"weapon_crowbar",
"weapon_smg",
}
Delay = 60 // Seconds
-------------------------------
sw_cooldown = CurTime()
function SpawnWeapons()
if sw_cooldown < CurTime() then
for k,v in pairs(SpawnPoints) do
local wep = ents.Create(table.Random(Weapons))
wep:SetPos(v)
wep:Spawn()
end
sw_cooldown = CurTime() + Delay
end
end
[/code]
Look at [URL="https://facepunch.com/showthread.php?t=1524060"]his gamemode[/URL], it's not going to matter at this point..
[QUOTE=The Noodler;50590545]Look at [URL="https://facepunch.com/showthread.php?t=1524060"]his gamemode[/URL], it's not going to matter at this point..[/QUOTE]
You're a bad coder. Don't make other people suffer from your ignorance.
[QUOTE=L0rdTyler;50590553]You're a bad coder. Don't make other people suffer from your ignorance.[/QUOTE]
Seems like you're projecting a little buddy, he has a basic gamemode, a basic sense of lua, so I gave him the most most basic way to do what he wanted. Sorry that this triggered you <3
[QUOTE=The Noodler;50590545]Look at [URL="https://facepunch.com/showthread.php?t=1524060"]his gamemode[/URL], it's not going to matter at this point..[/QUOTE]
Well, we all start somewhere
[editline]25th June 2016[/editline]
[QUOTE=L0rdTyler;50590443]Timer? You shouldn't be feeding him at all.
[code]
SpawnPoints = {
Vector(0,0,0),
Vector(10,0,0),
Vector(20,0,0)
}
Weapons = {
"weapon_frag",
"weapon_crowbar",
"weapon_smg",
}
Delay = 60 // Seconds
-------------------------------
sw_cooldown = CurTime()
function SpawnWeapons()
if sw_cooldown < CurTime() then
for k,v in pairs(SpawnPoints) do
local wep = ents.Create(table.Random(Weapons))
wep:SetPos(v)
wep:Spawn()
end
sw_cooldown = CurTime() + Delay
end
end
[/code][/QUOTE]
Thanks for the help, I'm glad you aren't ignorant like The Noodler
Im sorry to revive this but this is stupid, I tried to be friendly, but Noodle had to fuck it up
[IMG]http://i.imgur.com/aCXUdAQ.png[/IMG]
[editline]26th June 2016[/editline]
It doesn't make me ignorant if I rate a post "Winner", here is the definition if you need to know it: [url]http://www.merriam-webster.com/dictionary/ignorant[/url]
If you have specific locations per map that these weapons should spawn in, make a table of the vectors and loop through them and spawn an entity with a random class from another table you make of weapon classes. If you want procedural spawning regardless of maps, you will need to make some logic to find potential valid spawnpoints. I believe Homicide does this, try to take a look at its code.
[QUOTE=Zet0r;50598161]If you have specific locations per map that these weapons should spawn in, make a table of the vectors and loop through them and spawn an entity with a random class from another table you make of weapon classes. If you want procedural spawning regardless of maps, you will need to make some logic to find potential valid spawnpoints. I believe Homicide does this, try to take a look at its code.[/QUOTE]
Its solved don't worry, I was just making a point
Sorry, you need to Log In to post a reply to this thread.