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?
[QUOTE=decyg;23225823]Do you just want it to fire lasers.[/QUOTE]
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]
[QUOTE=PredatorKing;23225830]You put Lua in capitals, but not SWEP? :aaaaa:[/QUOTE]
Eh. My fingers do what they want. XP
And these lasers (on impact) will do what?
[QUOTE=decyg;23230594]And these lasers (on impact) will do what?[/QUOTE]
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. :P
Nevermind.
[QUOTE=Clevin;23284442]Do you want it to do everything a physgun can...?
Or just have the laser?[/QUOTE]
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]
[QUOTE=Clevin;23285085]Well, I know that wiremod has a laser pointer that comes with it, if you wanted to check it out.[/QUOTE]
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]
[QUOTE=Drew P. Richard;23285142]Here is the code the laser pointer uses:
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
[/QUOTE]
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.
[QUOTE=minicunga;23284813]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.[/QUOTE]
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]
[QUOTE=Drew P. Richard;23287243]That is exactly what that does, just change the material.[/QUOTE]
Aight, I'll give it a shot. Ty.
Sorry, you need to Log In to post a reply to this thread.