Hi everyone , I have a little issue coding the idle_empty and idle
I currently using this.
[CODE]function SWEP:SetupDataTables()
self:NetworkVar( "Float", 1, "NextIdle" )
end
local vm, CT, aim, cone, vel, CT, tr
local td = {}
function SWEP:UpdateNextIdle()
local vm = self.Owner:GetViewModel()
self:SetNextIdle( CurTime() + self:SequenceDuration() )
end
function SWEP:Think()
if self.IndividualThink then
self:IndividualThink()
end
local vm = self.Owner:GetViewModel()
local curtime = CurTime()
local idletime = self:GetNextIdle()
if ( idletime > 0 && CurTime() > idletime ) then
self:SetNextIdle( CurTime() + self:SequenceDuration() )
if ( self.Weapon:Clip1() <= 0 ) then
self:SendWeaponAnim(ACT_VM_IDLE_EMPTY)
else
self:SendWeaponAnim(ACT_VM_IDLE)
end
self:UpdateNextIdle()
return true
end
end[/CODE]
And the issue is this one [URL="http://i.imgur.com/yGSiYOW.webm"]http://i.imgur.com/yGSiYOW.webm[/URL]
Set the weapon reload time as the same as the reload animation.
Just set it a bit less
[QUOTE=geferon;49139602]Set the weapon reload time as the same as the reload animation.
Just set it a bit less[/QUOTE]
Nope the issue is located in the idle not in the reload.
Hostia.
Un español mas.
Segun el codigo lo que pasa es que al acabar la animacion de la recarga, este pone la animacion del idle sin municion porque la municion sigue en 0 cuando acaba y pues pone esa animacion de sin municion.
Lo que tienes que hacer es como ya dije bajar un poquitin l tiempo de recarga
[QUOTE=geferon;49139812]Hostia.
Un español mas.
Segun el codigo lo que pasa es que al acabar la animacion de la recarga, este pone la animacion del idle sin municion porque la municion sigue en 0 cuando acaba y pues pone esa animacion de sin municion.
Lo que tienes que hacer es como ya dije bajar un poquitin l tiempo de recarga[/QUOTE]
Dame un ejemplo de como hacerlo , habia pensado en hacer un check en el think para verificar el idle.
o quizas un return a idle sin empty
Lo que compruebas en lo del idle es cuanta municion tienes, osea que depende de en cuanto tiempo pase de 0 de municion a cuanto sea.
Por lo cual deberias reducir el reloadDelay.
No necesitas ninguna comprobacion, solo eso.
Estas haciendo un arma o modificandola?
[editline]18th November 2015[/editline]
Simplemente pon todo el codigo del arma aqui y te digo que cambiar
[QUOTE=geferon;49139979]Lo que compruebas en lo del idle es cuanta municion tienes, osea que depende de en cuanto tiempo pase de 0 de municion a cuanto sea.
Por lo cual deberias reducir el reloadDelay.
No necesitas ninguna comprobacion, solo eso.
Estas haciendo un arma o modificandola?
[editline]18th November 2015[/editline]
Simplemente pon todo el codigo del arma aqui y te digo que cambiar[/QUOTE][code]function SWEP:Reload()
CT = CurTime()
if self.ReloadDelay or CT < self.ReloadWait or self.dt.State == SWB_ACTION or self.ShotgunReloadState != 0 then
return
end
mag = self:Clip1()
if (self.Chamberable and mag >= self.Primary.ClipSize + 1) or (not self.Chamberable and mag >= self.Primary.ClipSize) or self.Owner:GetAmmoCount(self.Primary.Ammo) == 0 then
return
end
if self.dt.State != SWB_RUNNING then
self.dt.State = SWB_IDLE
end
if self.ShotgunReload then
self.ShotgunReloadState = 1
self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START)
self:SetNextIdle( CurTime() + self:SequenceDuration() )
self.ReloadDelay = CT + self.ReloadStartWait
else
if self.Chamberable then
if mag == 0 then
self.Primary.ClipSize = self.Primary.ClipSize_Orig
else
self.Primary.ClipSize = self.Primary.ClipSize_Orig + 1
end
end
if ( self.Weapon:Clip1() <= 0 ) then
self:DefaultReload(ACT_VM_RELOAD_EMPTY)
else
self:DefaultReload(ACT_VM_RELOAD)
end
self:SetNextIdle( CurTime() + self:SequenceDuration() )
self.Owner:SetAnimation(PLAYER_RELOAD)
end
end[/code]
Me referia a la parte de configuraciones.
Porque esa parte esta bien.
La parte en la que pones:
Weapon.Primary.ClipSize, etc
[QUOTE=geferon;49140129]Me referia a la parte de configuraciones.
Porque esa parte esta bien.
La parte en la que pones:
Weapon.Primary.ClipSize, etc[/QUOTE]
[CODE]SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = 7
SWEP.Primary.DefaultClip = 70
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = ".45"
SWEP.FireDelay = 0.145
SWEP.FireSound = Sound("Weapon_M1911A1.Fire")
SWEP.Recoil = 0.956
SWEP.HipSpread = 0.04
SWEP.AimSpread = 0.009
SWEP.VelocitySensitivity = 1.3
SWEP.MaxSpreadInc = 0.06
SWEP.SpreadPerShot = 0.01
SWEP.SpreadCooldown = 0.15
SWEP.Shots = 1
SWEP.Damage = 32
SWEP.DeployTime = 1[/CODE]
El codigo lo tengo adaptado para que cuando terminen los frames no uso ningun SWEP.Reloadtime ni ReloadDelay
Cuando terminen los frames?
[editline]18th November 2015[/editline]
Tienes el codigo?
[QUOTE=geferon;49140176]Cuando terminen los frames?
[editline]18th November 2015[/editline]
Tienes el codigo?[/QUOTE]
Esta arriba en el function reload
[QUOTE=geferon;49141438]Despues del
[CODE]self:SetNextIdle( CurTime() + self:SequenceDuration() )[/CODE]
pon
[CODE]self.ReloadDelay = CurTime() + self:SequenceDuration()[/CODE][/QUOTE]
No hace nada , al recargar no dispara más.
Quitalo.
Si eso agregame a steam y mañana por la tarde te lo digo.
y si puedew pon aqui todo el codigo y le echare un vistazo.
Someone can help to fix the idle issue please ?
Make sure that you are also resetting NextIdle in PrimaryAttack and SecondaryAttack.
(Asegúrate que estás restableciendo NextIdle en PrimaryAttack y SecondaryAttack.)
[code]function SWEP:SetupDataTables()
self:NetworkVar( "Float", 0, "NextIdle" )
end
local vm, CT, aim, cone, vel, CT, tr
local td = {}
function SWEP:UpdateNextIdle()
self:SetNextIdle( CurTime() + self:SequenceDuration() )
end
function SWEP:Think()
if self.IndividualThink then
self:IndividualThink()
end
local idletime = self:GetNextIdle()
if ( CurTime() > idletime ) then
if ( self.Weapon:Clip1() <= 0 ) then
self:SendWeaponAnim(ACT_VM_IDLE_EMPTY)
else
self:SendWeaponAnim(ACT_VM_IDLE)
end
self:UpdateNextIdle()
return true
end
end
function SWEP:Reload()
CT = CurTime()
if self.ReloadDelay or CT < self.ReloadWait or self.dt.State == SWB_ACTION or self.ShotgunReloadState != 0 then
return
end
mag = self:Clip1()
if (self.Chamberable and mag >= self.Primary.ClipSize + 1) or (not self.Chamberable and mag >= self.Primary.ClipSize) or self.Owner:GetAmmoCount(self.Primary.Ammo) == 0 then
return
end
if self.dt.State != SWB_RUNNING then
self.dt.State = SWB_IDLE
end
if self.ShotgunReload then
self.ShotgunReloadState = 1
self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START)
self:SetNextIdle( CurTime() + self:SequenceDuration() )
self.ReloadDelay = CT + self.ReloadStartWait
else
if self.Chamberable then
if mag == 0 then
self.Primary.ClipSize = self.Primary.ClipSize_Orig
else
self.Primary.ClipSize = self.Primary.ClipSize_Orig + 1
end
end
if ( self.Weapon:Clip1() <= 0 ) then
self:DefaultReload(ACT_VM_RELOAD_EMPTY)
else
self:DefaultReload(ACT_VM_RELOAD)
end
self:SetNextIdle( CurTime() + self:SequenceDuration() )
self.Owner:SetAnimation(PLAYER_RELOAD)
end
end[/code]
[QUOTE=code_gs;49142601]Make sure that you are also resetting NextIdle in PrimaryAttack and SecondaryAttack.
(Asegúrate que estás restableciendo NextIdle en PrimaryAttack y SecondaryAttack.)
[code]function SWEP:SetupDataTables()
self:NetworkVar( "Float", 0, "NextIdle" )
end
local vm, CT, aim, cone, vel, CT, tr
local td = {}
function SWEP:UpdateNextIdle()
self:SetNextIdle( CurTime() + self:SequenceDuration() )
end
function SWEP:Think()
if self.IndividualThink then
self:IndividualThink()
end
local idletime = self:GetNextIdle()
if ( CurTime() > idletime ) then
if ( self.Weapon:Clip1() <= 0 ) then
self:SendWeaponAnim(ACT_VM_IDLE_EMPTY)
else
self:SendWeaponAnim(ACT_VM_IDLE)
end
self:UpdateNextIdle()
return true
end
end
function SWEP:Reload()
CT = CurTime()
if self.ReloadDelay or CT < self.ReloadWait or self.dt.State == SWB_ACTION or self.ShotgunReloadState != 0 then
return
end
mag = self:Clip1()
if (self.Chamberable and mag >= self.Primary.ClipSize + 1) or (not self.Chamberable and mag >= self.Primary.ClipSize) or self.Owner:GetAmmoCount(self.Primary.Ammo) == 0 then
return
end
if self.dt.State != SWB_RUNNING then
self.dt.State = SWB_IDLE
end
if self.ShotgunReload then
self.ShotgunReloadState = 1
self:SendWeaponAnim(ACT_SHOTGUN_RELOAD_START)
self:SetNextIdle( CurTime() + self:SequenceDuration() )
self.ReloadDelay = CT + self.ReloadStartWait
else
if self.Chamberable then
if mag == 0 then
self.Primary.ClipSize = self.Primary.ClipSize_Orig
else
self.Primary.ClipSize = self.Primary.ClipSize_Orig + 1
end
end
if ( self.Weapon:Clip1() <= 0 ) then
self:DefaultReload(ACT_VM_RELOAD_EMPTY)
else
self:DefaultReload(ACT_VM_RELOAD)
end
self:SetNextIdle( CurTime() + self:SequenceDuration() )
self.Owner:SetAnimation(PLAYER_RELOAD)
end
end[/code][/QUOTE]
Thank you for the help(And for the spanish traslation I can understand English don't worry about spanish). I've already done the reset on SecondaryAttack and PrimaryAttack.
But the issue persist.
Are you sure the weapon model you're using even supports idle animations?
[QUOTE=code_gs;49142819]Are you sure the weapon model you're using even supports idle animations?[/QUOTE]
Extracted from .qc
$sequence "idle" "v_m1911a1_anims\idle.smd" {
fps 30
activity "ACT_VM_IDLE" 1
loop
snap
}
$sequence "idle_empty" "v_m1911a1_anims\idle_empty.smd" {
fps 30
activity "ACT_VM_IDLE_EMPTY" 1
snap
loop
}
bump
bump
Sorry, you need to Log In to post a reply to this thread.