• SWEP spawn entities?
    5 replies, posted
Ya, I am really noob, but how do I make a SWEP that spawns entities?
Like shoot them away from the player? Or spawn them at the cursor? Or above the player? Tell more, if you only want to shoot props, it should bee easy to find at garrysmod.org
[url]http://wiki.garrysmod.com/?title=ENT.Initialize[/url] Also, Since your new it seem's, [url]http://wiki.garrysmod.com/[/url] is your best friend. Use the search part.
[QUOTE=darksoul47;20576899][URL]http://wiki.garrysmod.com/?title=ENT.Initialize[/URL][/QUOTE] I don't think you understand lua. [URL]http://wiki.garrysmod.com/?title=Ents.Create[/URL] If you just want to spawn them where you're looking, use a trace ([URL]http://wiki.garrysmod.com/?title=Util.TraceLine[/URL]), and make sure you set angles ([URL]http://wiki.garrysmod.com/?title=Entity.SetAngles[/URL]) to the HitNormal. If you want to shoot them, spawn them in front of you, then apply a force in the direction the player is looking ([URL]http://wiki.garrysmod.com/?title=Player.GetAimVector[/URL]). Also, I may be wrong about needing to do the trace. I don't do SWEPs, look in the SWEP library for more help ([URL]http://wiki.garrysmod.com/?title=Weapon_Hooks[/URL]) or ([URL]http://wiki.garrysmod.com/?title=SWEP[/URL]). If that's out of your league, look around for some other SWEP that acts something like yours, and take a look at the code in it for some help. Judging from the fact that you said you're a noob, [URL]http://wiki.garrysmod.com/?title=Lua_Tutorial_Series[/URL] is probably best.
[QUOTE=Morcam;20602440]I don't think you understand lua. [URL]http://wiki.garrysmod.com/?title=Ents.Create[/URL] If you just want to spawn them where you're looking, use a trace ([URL]http://wiki.garrysmod.com/?title=Util.TraceLine[/URL]), and make sure you set angles ([URL]http://wiki.garrysmod.com/?title=Entity.SetAngles[/URL]) to the HitNormal. If you want to shoot them, spawn them in front of you, then apply a force in the direction the player is looking ([URL]http://wiki.garrysmod.com/?title=Player.GetAimVector[/URL]). Also, I may be wrong about needing to do the trace. I don't do SWEPs, look in the SWEP library for more help ([URL]http://wiki.garrysmod.com/?title=Weapon_Hooks[/URL]) or ([URL]http://wiki.garrysmod.com/?title=SWEP[/URL]). If that's out of your league, look around for some other SWEP that acts something like yours, and take a look at the code in it for some help. Judging from the fact that you said you're a noob, [URL]http://wiki.garrysmod.com/?title=Lua_Tutorial_Series[/URL] is probably best.[/QUOTE] I'm not the best at it, you don't have to be an asshole. I was trying to be helpful..
[QUOTE=darksoul47;20602951]I'm not the best at it, you don't have to be an asshole. I was trying to be helpful..[/QUOTE] I'm not being an asshole, you just don't understand lua. It's not an insult. It's like saying you don't understand chinese.
Sorry, you need to Log In to post a reply to this thread.