NPC/SetMovementActivity

From Garry's Mod
Jump to: navigation, search
 NPC:SetMovementActivity( )

Contents

Description

Sets the activity the NPC uses when it moves.

Arguments

number activity

The movement activity, see ACT_ Enums.

Examples

Example

Makes all NPCs walk instead of run.

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


Personal tools
Navigation