Garry's Mod Wiki

NPC:SetCondition

void 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: 37ms

Session 0
DB GetPage 3
Generate Html 3
SaveChanges 9
Render Body 0
Render Sidebar 19