Revision Difference
NPC:SetMovementActivity#527933
<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>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)⤶
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
end
</code>
</example>