Today i’ve been struggling with the repositioning of the muzzleflares on my custom SWEP. The whole swep visually is a SWEP creation kit weapon, with two guns on either side (Let’s say its an akimbo weapon or something)
What i’m trying to do is reposition the muzzleflash to fit the weapons on either side, using a switching function after every shot to switch between the two. I haven’t been very successful, and the only results i can get is the muzzleflash originating on the weapon’s muzzle, regardless of what i do.
So, in basic, how can i change the position of the muzzle effect?
if CLIENT then
function SWEP:MuzzleEffect(elname, pos)
local viewm = self.Owner:GetViewModel()
local vm = self.VElements[""…elname…""].modelEnt
local muzzleflash = EffectData()
muzzleflash:SetOrigin(vm:GetPos() + vm:GetForward() * 60) -- testing purposes, usually just vm:GetPos + pos muzzleflash:SetStart(vm:GetPos() + vm:GetForward()* 60) -- same as above muzzleflash:SetEntity( viewm ) -- actual viewmodel muzzleflash:SetAttachment( viewm:LookupAttachment("muzzle") ) -- needed attachment to make this work muzzleflash:SetScale(1) -- a function that seems to be designed to scale the size of the effect, Doesn't do squat if i change it. print(muzzleflash:GetOrigin()) -- Returns more or less what i expect it to (Current Position of the viewmodel + offset of the muzzles of left/right gun) util.Effect("ChopperMuzzleFlash", muzzleflash, true, true) end
This in general has returned the same thing over and over, a muzzleflash on the muzzle of the original ViewModel. I’m unable to edit its position. How can i do this?
Thanks in advance!