Garry's Mod Wiki

Revision Difference

NPC:SetMovementActivity#518793

<function name="SetMovementActivity" parent="NPC" type="classfunc"> <description>Sets the activity the NPC uses when it moves.</description> <realm>Server</realm> <args> <arg name="activity" type="number">The movement activity, see <page>ACT</page>.</arg> <arg name="activity" type="number">The movement activity, see <page>Enums/ACT</page>.</arg> </args> </function> <example> <description>Makes all NPCs walk instead of run.</description> <code> function GM:Think() for _, npc in pairs(ents.FindByClass("npc_*")) do if(IsValid(npc) && npc:IsNPC() && npc:GetMovementActivity() != ACT_WALK) then npc:SetMovementActivity(ACT_WALK) end end end </code> </example>