Garry's Mod Wiki

Garry's Mod Wiki

  ENTITY:SelectSchedule()

Description

Set the schedule we should be playing right now. Allows the NPC to start either a Lua schedule or an engine schedule. Despite sharing the same name as CAI_BaseNPC::SelectSchedule(), this isn't hooked to that function; this is called by Lua's ENTITY:RunAI, doesn't return an engine function, returning an engine function doesn't help and doesn't make the NPC start an engine schedule. To alter initial engine schedule, it is recommended to use ENTITY:TranslateSchedule.

This is a helper function only available if your SENT is based on base_ai

Example

Creates a new schedule and assigns it to a scripted NPC.

local schdTest = ai_schedule.New( "Test Schedule" ) schdTest:EngTask( "TASK_GET_PATH_TO_RANDOM_NODE", 128 ) schdTest:EngTask( "TASK_RUN_PATH", 0 ) schdTest:EngTask( "TASK_WAIT_FOR_MOVEMENT", 0 ) function ENT:SelectSchedule() self:StartSchedule( schdTest ) end
Output: The scripted NPC will run around when spawned.

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...