Project Zomboid

Project Zomboid

Insurgent - Black Ops Profession
dragonregure Dec 21, 2024 @ 6:17pm
Unstoppable Cooldown
I have to share this here to (hopefully) answer everyone asking, "How long is the cooldown for 'Unstoppable'?"

After reviewing the code, it seems the cooldown resets under the following conditions:
  • Your character reaches 3 dawns: This means you must wait at least 3 mornings for the cooldown to refresh.
  • If your character reaches a dawn while 'Bleeding' or with body parts below 90 health: This part is unclear, but it seems the cooldown counter will not decrease under these conditions.

I hope the mod's creator adds a cooldown setting or at least includes this information in the FAQ. I've read through all the comments but couldn't find an answer to this.

Here’s the relevant code:
function UndyingTrait.OnDawn() local players = IsoPlayer.getPlayers() for i=0,players:size()-1 do local player = players:get(i) if player and player:isLocalPlayer() and not player:isDead() and player:HasTrait("Undying") then UndyingTrait.ResetCooldown(player) end end end function UndyingTrait.ResetCooldown(player) local playerdata = player:getModData(); if not playerdata.willResistDeath then for i = 0, player:getBodyDamage():getBodyParts():size() - 1 do if player:getBodyDamage():getBodyParts():get(i):getHealth() < 90 then return; elseif player:getBodyDamage():getBodyParts():get(i):bleeding() then return; end end if playerdata.undyingCooldown > 0 then playerdata.undyingCooldown = playerdata.undyingCooldown - 1 else playerdata.willResistDeath = true; end end end function UndyingTrait.RegisterEvents() Events.OnNewGame.Add(UndyingTrait.OnNewGame) Events.OnGameStart.Add(UndyingTrait.OnGameStart) Events.OnPlayerUpdate.Add(UndyingTrait.OnPlayerUpdate) Events.OnDawn.Add(UndyingTrait.OnDawn) end