Garry's Mod Wiki

Revision Difference

ENTITY:SelectSchedule#551954

<function name="SelectSchedule" parent="ENTITY" type="hook"> <ishook>yes</ishook> <description>Set the schedule we should be playing right now. <note>This hook only exists for **ai** type SENTs</note>⤶ <note>This hook only exists for `ai` type [SENTs](Scripted_Entities).</note>⤶ </description> <realm>Server</realm> <args> <arg name="iNPCState" type="number"></arg> </args> </function> <example> <description>Creates a new schedule and assigns it to a scripted NPC.</description> <code> 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 </code> <output>The scripted NPC will run around when spawned.</output> </example>