-- Pre‑cache the scream sound to avoid hitches util.PrecacheSound(CONFIG.ScreamSound) util.PrecacheSound(CONFIG.FootstepSound) end
-- Make sure the physics hull is appropriate for the model self:SetHullSizeNormal() self:SetCollisionBounds(Vector(-16, -16, 0), Vector(16, 16, 72))
-- Optional: push the player a little local push = (self.CurrentTarget:GetPos() - self:GetPos()):GetNormalized() * 200 self.CurrentTarget:SetVelocity(push) end
-- Internal state self.NextAttack = 0 self.CurrentTarget = nil end
-- ========================================================= -- CONFIGURATION – tweak these values to suit your map / playstyle -- ========================================================= local CONFIG = Model = "models/props_junk/watermelon01.mdl", -- default placeholder model Speed = 200, -- units per second (walk speed) Acceleration = 600, -- how fast it reaches full speed TurnRate = 8, -- how quickly it can turn (higher = snappier) ChaseRadius = 3000, -- max distance at which it will start chasing a player LoseRadius = 3500, -- distance at which it gives up the chase AttackDistance = 60, -- distance considered a “catch” AttackCooldown = 2, -- seconds between successive attacks ScreamSound = "npc/fast_zombie/idle1.wav", -- replace with your own scream file FootstepSound = "npc/metropolice/gear1.wav", -- replace if you want footstep sounds
-- Simple damage packet (feel free to replace with a more complex system) local dmg = DamageInfo() dmg:SetAttacker(self) dmg:SetInflictor(self) dmg:SetDamage(30) -- damage per hit dmg:SetDamageType(DMG_SLASH) -- any type you like self.CurrentTarget:TakeDamageInfo(dmg)
-- Play the scream (both server & client) self:EmitSound(CONFIG.ScreamSound, 85, 100, 1, CHAN_AUTO)
coroutine.yield() end end
-- ----------------------------------------------------------------- -- Helper: Find the nearest viable player -- ----------------------------------------------------------------- function ENT:FindClosestPlayer() local nearest = nil local nearestDist = CONFIG.ChaseRadius