Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Erik's Panic Mode v1.0.0 --
- local PanicDuration = math.random(10, 20) -- Duration of panic in seconds
- local MinJumpInterval = math.random(0.01, 0.1) -- Minimum time interval for jumping actions
- local MaxJumpInterval = math.random(0.25, 0.5) -- Maximum time interval for jumping actions
- local MinMoveInterval = 0.1 -- Minimum time interval for random movements
- local MaxMoveInterval = 2.0 -- Maximum time interval for random movements
- local ForgiveDuration = 10 -- Duration of wandering after panic is over
- local NPC = script.Parent
- local FollowScript = NPC:WaitForChild("FollowScript")
- local WanderScript = NPC:WaitForChild("WanderScript")
- local Humanoid = NPC:WaitForChild("Humanoid")
- local isPanic = false
- local lastHealth = Humanoid.Health
- local function DisableFollowScript()
- FollowScript.Disabled = true
- end
- local function EnableFollowScript()
- FollowScript.Disabled = false
- end
- local function EnableWanderScript()
- WanderScript.Disabled = false
- end
- local function EnableScripts()
- EnableFollowScript()
- EnableWanderScript()
- end
- local function PanicActions()
- while isPanic do
- -- Jump at random intervals
- local jumpInterval = math.random(MinJumpInterval, MaxJumpInterval)
- Humanoid.Jump = true
- wait(jumpInterval)
- Humanoid.Jump = false
- -- Simulate random panicking movements
- local randomDirection = Vector3.new(math.random() - 0.5, 0, math.random() - 0.5).Unit
- Humanoid:Move(randomDirection * 10) -- Move in a random direction
- -- Wait at random intervals
- local moveInterval = math.random(MinMoveInterval, MaxMoveInterval)
- local endTime = tick() + moveInterval
- while tick() < endTime and isPanic do
- wait(0.1)
- end
- Humanoid:Move(Vector3.new()) -- Stop moving
- end
- end
- local function Forgive()
- -- Disable follow script during forgiveness
- DisableFollowScript()
- -- Wait for forgiveness duration
- wait(ForgiveDuration)
- -- Enable wander script and resume following after forgiveness
- EnableWanderScript()
- EnableFollowScript()
- end
- Humanoid.HealthChanged:Connect(function()
- if Humanoid.Health < lastHealth then
- if not isPanic then
- isPanic = true
- Humanoid:Move(Vector3.new()) -- Stop moving
- -- Disable follow script
- DisableFollowScript()
- -- Start panicking actions in a coroutine
- coroutine.wrap(PanicActions)()
- wait(PanicDuration)
- isPanic = false
- -- Start forgiveness process
- coroutine.wrap(Forgive)()
- end
- end
- lastHealth = Humanoid.Health
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement