Zet0rz / nzombies

A GM13 Nazi Zombies style (WIP) gamemode
GNU General Public License v3.0
73 stars 79 forks source link

Custom melee and grenades (HELP) #597

Open sh4d0w59 opened 6 years ago

sh4d0w59 commented 6 years ago

I've been digging around in the files looking for ways to make a grenade or melee weapon from a weapon pack a working special weapon and came across the file to do so, but I can't for the life of me figure out what the numbers and true/false arguments after the weapon class mean.

"nzSpecialWeapons:AddGrenade( "nz_grenade", 4, false, 0.85, false, 0.4 )" "nzSpecialWeapons:AddKnife( "nz_bowie_knife", true, 0.65, 2.5 )"

sh4d0w59 commented 6 years ago

After digging around a bit more I think I've figured out what these numbers and arguments are. These are a lot of assumptions on my part as I don't know much about code. If someone could correct my mistakes, that would be nice.

"nzSpecialWeapons:AddGrenade( "nz_grenade" = this is the weapon class, 4 = this is the max amount of grenades you can carry, false = draw the act/animation in 3rd person???, 0.85 = time in seconds before the primary attack key is activated???, false = use a custom throw function???, 0.4 = time in seconds before the weapon is holstered after the attack key is activated)"

"nzSpecialWeapons:AddKnife( "nz_bowie_knife" = this is the weapon class, true = , 0.65 = time in seconds before the attack is initiated???, 2.5 = time in seconds before the weapon is holstered??? )"

lolleko commented 6 years ago
nzSpecialWeapons:AddKnife( class, drawonequip, attackholstertime, drawholstertime )
nzSpecialWeapons:AddGrenade( class, ammo, drawact, throwtime, throwfunc, holstertime )
nzSpecialWeapons:AddSpecialGrenade( class, ammo, drawact, throwtime, throwfunc, holstertime )
sh4d0w59 commented 6 years ago

Thanks for the help @lolleko . Managed to get some old??? code working from a person who previously attempted to add custom melee and grenades. The thing is, I'm erroring out when I buy the melees off of the wall and when a grenade is thrown for the first time. I'll post the error below and attempt to fix it if I can. If you guys wanna take a crack at it, be my guest.

[TFA Base] lua/weapons/tfa_gun_base/cl_mods.lua:86: bad argument #1 to 'LookupAttachment' (string expected, got table)

  1. LookupAttachment - [C]:-1
    1. unknown - lua/weapons/tfa_gun_base/cl_mods.lua:86

File exists in two addons - possible conflicts! lua/ulib/shared/hook.lua (ULib and TFA Base)

[ERROR] lua/weapons/tfa_gun_base/cl_mods.lua:247: bad argument #1 to 'ipairs' (table expected, got nil)

  1. ipairs - [C]:-1
    1. ViewModelDrawnPost - lua/weapons/tfa_gun_base/cl_mods.lua:247
    2. fn - lua/weapons/tfa_gun_base/cl_mods.lua:278
      1. Call - lua/ulib/shared/hook.lua:109
      2. unknown - gamemodes/base/gamemode/cl_init.lua:605