• SetCurrentWeaponProficiency() Not working
    6 replies, posted
[lua]function SWEP:Initialize() if ( SERVER ) then self:SetWeaponHoldType( self.HoldType ) self:SetNPCMinBurst(3) self:SetNPCMaxBurst(6) self:SetNPCFireRate(0.082) self:SetCurrentWeaponProficiency(WEAPON_PROFICIENCY_PERFECT) end end[/lua] WTF When I spawn this in an npc, theres an error and it says that setcurrentweaponproficiency is a nil value...
I think you should use self.Owner:SetCurrentWeaponProficiency(WEAPON_PROFICIENCY_PERFECT) for it to work on the npc not the weapon.
[QUOTE=Willox;23084099]I think you should use self.Owner:SetCurrentWeaponProficiency(WEAPON_PROFICIENCY_PERFECT) for it to work on the npc not the weapon.[/QUOTE] Same error: ...ons\npcweaponsv2\lua\weapons\weapon_lr300\shared.lua:75: attempt to call method 'SetCurrentWeaponProficiency' (a nil value) Should I use if Owner.IsNPC then self.Owner:Set........?
self.Owner:IsNPC() and yes i suppose so, are you testing this on npcs or yourself Edit, the code you posted has line 75 in it right?
[QUOTE=Willox;23085356]self.Owner:IsNPC() and yes i suppose so, are you testing this on npcs or yourself Edit, the code you posted has line 75 in it right?[/QUOTE] Oui. Its basically a swep coded just for npc usage. [editline]10:45PM[/editline] Under what should I put it in? Initialize, Think, or PrimaryAttack? if self.Owner:IsNPC() then self.Owner:SetCurrentWeaponProficiency(WEAPON_PROFICIENCY_PERFECT) end ???
I dont really make sweps but it surely isnt PrimaryAttack or Think, btw you have a space in PROF ICIENCY
Well Think would be excecuted every frame. I think that may be inefficient. I shall go with Initialize. [editline]10:55PM[/editline] Omfg it still says it s nil value. Wtf is wrong with gmod.
Sorry, you need to Log In to post a reply to this thread.