Revision Difference
NPC:SetExpression#565291
<function name="SetExpression" parent="NPC" type="classfunc">
<description>Sets the NPC's .vcd expression. Similar to <page>Entity:PlayScene</page> except the scene is looped until it's interrupted by default NPC behavior or <page>NPC:ClearExpression</page>.</description>
<realm>Server</realm>
<args>
<arg name="expression" type="string">The expression filepath.</arg>
<arg name="m_iszExpressionScene" type="string">The expression filepath.</arg>
</args>
<rets>
<ret name="" type="number"></ret>⤶
<ret name="flDuration" type="number">Default duration of assigned expression, in seconds.</ret>⤶
</rets>
</function>
<example>
<description>Function which makes the NPC whom the player is looking at repeat an annoying scene.</description>
<code>
function GrenadesScene(ply)
if(!IsValid(ply)) then return end
local npc = ply:GetEyeTrace().Entity
if(IsValid(npc) && npc:IsNPC()) then
npc:SetExpression("scenes/streetwar/sniper/ba_nag_grenade0"..math.random(1, 5)..".vcd")
end
end
</code>
</example>