Garry's Mod Wiki

NPC:SetCondition

  NPC:SetCondition( number condition )

Description

Sets an NPC condition.

Arguments

1 number condition
The condition index, see COND enum.

Example

Freezes an NPC for a period of time.

function FreezeNPCTemporarily(npc, delay) if(!IsValid(npc)) then return end delay = delay or 1 npc:SetSchedule(SCHED_NPC_FREEZE) timer.Simple(delay, function() if(IsValid(npc)) then npc:SetCondition(COND.NPC_UNFREEZE) end end) end