Garry's Mod Wiki

NPC:SetCondition

NPC:SetCondition( number condition )

Description

Sets an NPC condition.

Arguments

1 number condition
The condition index, see Enums/COND.

Example

Freezes an NPC for a period of time.

COND_NPC_UNFREEZE = 68 -- Delete this line when COND_ enums are added 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

Page Links


Special Pages


Wikis

?

Render Time: 24ms

DB GetPage 3
Generate Html 5
SaveChanges 8
Render Body 0
Render Sidebar 6