Reload Function Help...

Im making a weapon, it can switch between smg and pistol mode ( The model can I mean ) and when I reload the model alwayse switches back to pistol form. How do I keep it in smg mode.
Model Anims…

draw ACT_VM_DRAW
fire ACT_VM_PRIMARYATTACK
holster ACT_VM_HOLSTER
idle01 ACT_VM_IDLE
pistol2smg ACT_VM_PULLBACK_HIGH
reload ACT_VM_RELOAD
smg2pistol ACT_VM_PULLBACK_LOW
smg_draw ACT_VM_HAULBACK
smg_fire ACT_VM_SECONDARYATTACK
smg_holster ACT_HL2MP_ALYXGUN_SMG_HOLSTER
smg_idle01 ACT_VM_HITLEFT
smg_reload ACT_VM_FIDGET

Please help me…

Completely override the reload function to use the correct animations? If you’re already doing that maybe you could give more details on what you’re doing.

This is the reload part right now.

function SWEP:Reload()
if self:DefaultReload( ACT_VM_RELOAD ) then
if(SERVER) then
self.Owner:SetFOV( 0, 0.25 )
Zoom = 0
end
self:EmitSound(Sound(“weapons/smg3/smg1_reload.wav”))
end
end

Im not shure what else to say. =S



SWEP.NextReload = 0  
SWEP.ReloadTime = 5   

function SWEP:Reload()  
if self.NextReload > CurTime() then return end  
self.NextReload = CurTime() + self.ReloadTime  
self.Weapon:EmitSound( "weapons/smg3/smg1_reload.wav" )  
self.Weapon:DefaultReload( ACT_VM_RELOAD )  
end 


All I can offer at the moment :frown:

Depending of which mode the weapon is on, you would send the corresponding animation to the model using this :

Define “smg mode” and “pistol mode”, as these could mean you’re talking about the way the player holds the weapon in third person. If that is the case, that’s a completely different subject.

It actually has to do with that too, it’s a weapon that as a model that can transform from pistol to smg and back. So he will have to change the third person animation at that point too.

Hmm, well that seems much more complicated than it needs to be. You’ll probably end up having to override the translate animation hook. Also, refer to this and see if that helps.

I feel sad, my reload script was of no use :crying:

Admit the fact that the code came from another thread ;3

Which comes from another, which comes from another, which was inspired by another who took example on garry’s example swep which is based on his swep base for Garry’s Mod which means :

All your scripts are belong to Garry! :ninja:

Yes Sir :slight_smile:

[lua]
function SWEP:Reload( )
if self.PistolForm then
self:DefaultReload( ACT_VM_RELOAD )
else
self:DefaultReload( ACT_VM_FIDGET )
end
end
[/lua]

Something like that?

We’ll never know until he posts -_-

Sorry.

Maby, where would I put in a emit sound without screwing it up?

If you only have one reload sound, then before the if. If you have specific sounds for each form, put it after each animation.

Muhaha I’ve made it work, but I changed you script a little.

[lua] function SWEP:Reload( )
if(Zoom == 0) then
if(SERVER) then
self.Weapon:DefaultReload( ACT_VM_RELOAD )
end
self:EmitSound(“weapons/pistol/pistol_reload.wav”)
Zoom = 0
else
if(SERVER) then
self.Weapon:DefaultReload( ACT_VM_FIDGET )
end
self:EmitSound(“weapons/pistol/pistol_reload.wav”)
Zoom = 1
end
end
[/lua]

Thanks for helping my out. =D

[lua]function SWEP:Reload( )
self:EmitSound(“weapons/pistol/pistol_reload.wav”)
if (CLIENT) then return end
if(Zoom == 0) then
self.Weapon:DefaultReload( ACT_VM_RELOAD )
else
self.Weapon:DefaultReload( ACT_VM_FIDGET )
Zoom = 1
end
end[/lua]
if Zoom == 1 if it doesn’t == 0 then remove the Zoom = 1.

Alright