Garry's Mod Wiki

NPC:SetExpression

number NPC:SetExpression( string expression )

Description

Sets the NPC's .vcd expression. Similar to Entity:PlayScene except the scene is looped until it's interrupted by default NPC behavior or NPC:ClearExpression.

Arguments

1 string expression
The expression filepath.

Returns

Example

Function which makes the NPC whom the player is looking at repeat an annoying scene.

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

Page Links


Special Pages


Wikis

?

Render Time: 33ms

DB GetPage 4
Generate Html 6
SaveChanges (1) 8
Render Body 0
Render Sidebar 13