Open jaxjaxk opened 7 years ago
Ooohhh okay, very interesting! Looking at the picture though, the error points to CW2 code, not nZombies code. Did you edit CW2? The line numbers don't match up with my CW2 addon. If you think it might be because the weapon calls itself in a stack overflow manner, try to change the code to this:
function ReplacePrimaryFireCooldown(wep)
if wep.NZHasBeenModifiedPrimary then return end
local oldfire = wep.PrimaryAttack
if !oldfire then return end
--print("Weapon fire modified")
wep.PrimaryAttack = function(...)
oldfire(wep, ...)
-- FAS2 weapons have built-in DTap functionality
if wep:IsFAS2() then return end
-- With double tap, reduce the delay for next primary fire to 2/3
if wep.Owner:HasPerk("dtap") or wep.Owner:HasPerk("dtap2") then
local delay = (wep:GetNextPrimaryFire() - CurTime())*0.80
wep:SetNextPrimaryFire(CurTime() + delay)
end
end
wep.NZHasBeenModifiedPrimary = true
end
hook.Add("WeaponEquip", "nzModifyWeaponNextFires", ReplacePrimaryFireCooldown)`
That should make it only happen once per weapon. I don't think it's this that is the problem anyway, oldfire is just the exact function that used to be the weapon's old PrimaryAttack, and calling oldfire(wep, ...)
is the same as wep:oldfire(...)
, and ...
means every single other argument (varargs)
hope this works.
a few things should be known about this problem in case it comes up again. 1) while i can not track down what weapon causes this i know that i am using strange weapons already. naturally this points towards a CW2 weapon. 2) for some reason some people tell me that speed cola does not speed up shotgun reloads 3) i can confirm through multiple instances of this exact error occurring before the lua panic.
god i hope this works because having to check on a server every 6 hours is a pain.
If it still crashes you can try commenting out the hook.Add so this isn't applied. It'll make double tap not work, but if the crash happens again the traceback should have "oldfire" replaced with the actual weapons PrimaryAttack along with a filepath you can use to determine what weapon.
still getting lua panics but this time it is a different error not related to NZ.
whatever it is must either be very serious or happen very quickly as i have garbage collection run at the end of every wave.
after investigating the crashing i found this https://www.dropbox.com/s/54x6sw309g0qz3g/2017-01-04.png?dl=0
the hook in question is
and the line in question is
oldfire(wep, ...)