Garry's Mod Wiki

Revision Difference

NPC:MoveOrder#527948

<function name="MoveOrder" parent="NPC" type="classfunc"> <description> Makes the NPC walk toward the given position. The NPC will return to the player after amount of time set by **player_squad_autosummon_time** <page>ConVar</page>. Only works on Citizens (npc_citizen) and is a part of the Half-Life 2 squad system. The NPC **must** be in the player's squad for this to work. </description> <realm>Server</realm> <args> <arg name="position" type="Vector">The target position for the NPC to walk to.</arg> </args> </function> <example> <description>A console command that makes all Citizens on the map (if they are in the player's squad) try to go to where the player is looking at.</description> <code> concommand.Add( "movenpcs", function( ply ) for id, npc in pairs( ents.FindByClass( "npc_citizen" ) ) do for id, npc in ipairs( ents.FindByClass( "npc_citizen" ) ) do npc:MoveOrder( ply:GetEyeTrace().HitPos ) end end ) </code> </example>