Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
-- Checks and fixes zombies stuck in turnalerted animation (runs every ~1 second)
local function CheckZombieAnimationState()
if not (isClient() or isServer()) then return end -- Skip in single-player
local cell = getCell()
local zombies = cell:getZombieList()
if not zombies then return end -- Early exit if no zombies
local size = zombies:size() -- Cache size to avoid repeated calls
for i = 0, size - 1 do
local zombie = zombies:get(i)
if zombie and not zombie:getVariableBoolean("Bandit") then
local modData = zombie:getModData() -- Cache mod data
local currentState = zombie:getActionStateName()
local stuckTime = modData.stuckTime or 0
if currentState == "turnalerted" then
stuckTime = stuckTime + 1
modData.stuckTime = stuckTime
-- Reset zombie if stuck in turnalerted for ~5 seconds (300 ticks at 60 FPS)
if stuckTime > 300 then
modData.stuckTime = 0
zombie:setActionStateName("idle")
zombie:setTurnDelta(0)
zombie:setTurnAlertedValues(0, 0)
zombie:resetModelNextFrame()
end
else
modData.stuckTime = 0
end
end
end
end
-- Run CheckZombieAnimationState every 60 ticks (~1 second at 60 FPS)
local tickCounter = 0
Events.OnTick.Add(function()
tickCounter = tickCounter + 1
if tickCounter >= 60 then
CheckZombieAnimationState()
tickCounter = 0 -- Reset counter
end
end)
optimized?