Garry's Mod Wiki

NPC:SetMovementActivity

  NPC:SetMovementActivity( number activity )

Description

Sets the activity the NPC uses when it moves.

Arguments

1 number activity
The movement activity, see ACT enum.

Example

Makes all NPCs walk instead of run.

function GM:Think() for i, npc in ipairs( ents.FindByClass( "npc_*" ) ) do if IsValid( npc ) and npc:IsNPC() and npc:GetMovementActivity() ~= ACT_WALK then npc:SetMovementActivity( ACT_WALK ) end end end