Swep that shoots physgun beam?

Hey all. Imma just cut to the chase:
Is there a way to make a swep shoot the physgun beam?
Im sure it’s possible some way through LUA, but I’m new to it, and am not sure where to go with this.
Also, if there is a way to make it shoot a laser instead (that is reskinnable), that’s good too.
Thanks!

Do you just want it to fire lasers.

You put Lua in capitals, but not SWEP? :aaaaa:

Most people look at the section name “LUA scripting”, and well, go figure.

Just… the laser? Like a laser pointer?

Well, preferably the physgun beam specifically, but yes, if it shoots a steady beam (which I can skin to look like the physgun beam), that’s fine.

[editline]12:03PM[/editline]

Eh. My fingers do what they want. XP

And these lasers (on impact) will do what?

Set an NPC or prop on fire.

bump So…anyone know a way to have the physgun beam appear when shooting through LUA scripting? I honestly wouldn’t care if I had that happen and then just make bullets set shit on fire without the tracers so it just looks like the beam is doing the damage. :stuck_out_tongue:

Nevermind.

Just the beam.

I think what he means is for the weapon to shoot a laser that looks like the phygun beam and on impact ignite the target.

Well, I know that wiremod has a laser pointer that comes with it, if you wanted to check it out.

Here is the code the laser pointer uses:
[lua]
local LASER = Material(‘cable/redlaser’)

function SWEP:Initialize()
local ply = LocalPlayer()
self.VM = ply:GetViewModel()
local attachmentIndex = self.VM:LookupAttachment(“muzzle”)
if attachmentIndex == 0 then attachmentIndex = self.VM:LookupAttachment(“1”) end
self.Attach = attachmentIndex
end

function SWEP:ViewModelDrawn()
render.SetMaterial( LASER )
render.DrawBeam(self.VM:GetAttachment(self.Attach).Pos, self.Owner:GetEyeTrace().HitPos, 2, 0, 12.5, Color(255, 0, 0, 255))
end
[/lua]

I would, but Wiremod is giving me problems. I think I put something in my Gmod directory that’s conflicted with it, or I downloaded a crap version.

[editline]06:15PM[/editline]

Now is there a way to tie this in with a Swep script to give it the beam effect and still have it function as a swep?

That is exactly what that does, just change the material.

Well, yeah, but the thing is, I found a reskin for the physgun beam that I’d like to use for it. If it’s too much of a pain to use the physgun beam, then I’d use a laser instead, but I’d need a way to change the way it looks. Is there even a way to skin a laser?

[editline]07:23PM[/editline]

Aight, I’ll give it a shot. Ty.