Garry's Mod Wiki

NPC:SetSchedule

  NPC:SetSchedule( number schedule )

Description

Sets the NPC's current schedule.

Arguments

1 number schedule
The NPC schedule, see SCHED enum.

Example

Function which forces an NPC to walk to an entity.

function NPCMoveTo( npc, ent ) if ( !IsValid( npc ) or !IsValid( ent ) ) then return end npc:SetSaveValue( "m_vecLastPosition", ent:GetPos() ) npc:SetSchedule( SCHED_FORCED_GO ) -- npc:SetSchedule( SCHED_FORCED_GO_RUN ) end