• Spawning a Half Life 2 Floor Turret
    1 replies, posted
Hey I am trying to make a T weapon for TTT that will simply be a Turret that does not shoot at T's only innos and detectives. I can spawn a turret via [CODE] ent.create npc_turret_floor [/CODE] I was just wondering how I could spawn it by pulling the trigger on a gun? I have already tried [CODE] function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end LocalPlayer():ConCommand("ent.create npc_turret_floor") self:TakePrimaryAmmo(1) end [/CODE] and [CODE] function SWEP:PrimaryAttack() if not self:CanPrimaryAttack() then return end ents.create("npc_turret_floor") self:TakePrimaryAmmo(1) end [/CODE] Both of those peices of code gave me a LUA error at line 60 complaining about it returning a nil value. Here are the lines which the error occurred at. [CODE] LocalPlayer():ConCommand("ent.create npc_turret_floor") ents.create("npc_turret_floor") [/CODE] Thanks for any help you can provide. -Dr.Gusta Upland High TTT Server
Check out the gmod Lua wiki for spawning entities and such. It's your best friend. As for the targeting system, that will be a little more complicated. You're going to have to familiarize yourself with Lua before attempting to do that.
Sorry, you need to Log In to post a reply to this thread.