Could some one give some examples SetWeaponProficiency() or SetCurrentWeaponProficiency().
5 replies, posted
I've been trying to get SetWeaponProficiency() to work, but never seen it used anywhere. Could someone give me some code example snippets of it used in a swep?:rolleyes: Wiki wasn't that much help to me, everytime i tried it i failed.
[lua]function combine( pl, cmd, args )
// make a better combine soldier
local endpos = pl:GetEyeTrace().HitPos + Vector( 0, 0, 72 );
local ang = pl:GetAngles();
local npc = ents.Create( "npc_combine_s" );
npc:SetPos( endpos );
npc:SetAngles( ang );
npc:SetKeyValue( "additionalequipment", ( math.random( 1, 2 ) == 1 ) && "weapon_smg1" || "weapon_ar2" );
npc:SetKeyValue( "NumGrenades", "999999" );
npc:SetKeyValue( "tacticalvariant", "true" );
npc:SetKeyValue( "spawnflags", "256" );
npc:SetKeyValue( "squadname", "combine" );
npc:Spawn();
npc:Activate();
npc:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_PERFECT );
npc:Fire( "StartPatrolling", "", 0.5 );
npc:Fire( "SetSquad", "combine", 0.5 );
end
concommand.Add( "combine", combine );[/lua]
It was posted here ages ago, so I can't remember who posted it. But it does show the use of the function call.
[QUOTE=TheDecryptor;22827044]function combine( pl, cmd, args )
// make a better combine soldier
local endpos = pl:GetEyeTrace().HitPos + Vector( 0, 0, 72 );
local ang = pl:GetAngles();
local npc = ents.Create( "npc_combine_s" );
npc:SetPos( endpos );
npc:SetAngles( ang );
npc:SetKeyValue( "additionalequipment", ( math.random( 1, 2 ) == 1 ) && "weapon_smg1" || "weapon_ar2" );
npc:SetKeyValue( "NumGrenades", "999999" );
npc:SetKeyValue( "tacticalvariant", "true" );
npc:SetKeyValue( "spawnflags", "256" );
npc:SetKeyValue( "squadname", "combine" );
npc:Spawn();
npc:Activate();
npc:SetCurrentWeaponProficiency( WEAPON_PROFICIENCY_PERFECT );
npc:Fire( "StartPatrolling", "", 0.5 );
npc:Fire( "SetSquad", "combine", 0.5 );
end
concommand.Add( "combine", combine );
It was posted here ages ago, so I can't remember who posted it. But it does show the use of the function call.[/QUOTE]
Thanks
[lua]
WEAPON_PROFICIENCY_PERFECT
WEAPON_PROFICIENCY_GOOD
WEAPON_PROFICIENCY_AVERAGE
WEAPON_PROFICIENCY_BAD
[/lua]
I remember theres another one. I don't really think that SetCurrentWeaponProficiency makes too much of an impact and the perfect proficiency still sucks balls.
[QUOTE=Flubadoo;22845549]WEAPON_PROFICIENCY_PERFECT
WEAPON_PROFICIENCY_GOOD
WEAPON_PROFICIENCY_AVERAGE
WEAPON_PROFICIENCY_BAD
I remember theres another one. I don't really think that SetCurrentWeaponProficiency makes too much of an impact and the perfect proficiency still sucks balls.[/QUOTE]
Yeah i know those, i just ask an example of it used in a swep.
Ok.. i was an idiot.. i rant this function on initialize.. only after creating the thread i remembered that Owner doesn't exist on initialize() :/
Sorry, you need to Log In to post a reply to this thread.