Garry's Mod Wiki

Revision Difference

NPC:SetCurrentWeaponProficiency#565181

<function name="SetCurrentWeaponProficiency" parent="NPC" type="classfunc"> <description>Sets the weapon proficiency of an NPC (how skilled an NPC is with its current weapon).</description> <realm>Server</realm> <args> <arg name="proficiency" type="number">The proficiency for the NPC's current weapon. See <page>Enums/WEAPON_PROFICIENCY</page>.</arg> </args> </function> <example> <description>Makes all NPCs suck at using their current weapons.</description> <code> for i, npc in ipairs( ents.FindByClass( "npc_*" ) ) do npc:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_POOR )⤶ for _, v in ents.Iterator() do if ( v:IsNPC() ) then⤶ npc:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_POOR )⤶ end⤶ end </code> </example>