Proper Poison Damage While Resting - no more cheating!
Posted: Sun Sep 08, 2013 4:35 am
Proper Poison Damage While Resting
no more cheating!
I always felt it was cheap that if you got poisoned you could just rest away the poison and heal faster than the poison hurts you. With this code that is no longer the case, making it much more realistic and plausible, forcing you to actually use some antidote potions and have a little more immersive tension and urgency in the case of getting poisoned.
add a script entity lua item, name it poisonScript, containing the following code:
While resting, any champion who is poisoned will take extra damage over time (although the damage amount will be reduced by percentage according to their poison resistance)
The final part to make this work is left to you:
You'll need a Universal Timer set up in your dungeon (every mod should have one!), and have it run the above function every 1 second (which is sped up during resting). For example, if your universal timer is set up to tick every 1/5 of a second, then have it run the poison function poisonScript.extraPoison() once every 5 ticks.
no more cheating!
I always felt it was cheap that if you got poisoned you could just rest away the poison and heal faster than the poison hurts you. With this code that is no longer the case, making it much more realistic and plausible, forcing you to actually use some antidote potions and have a little more immersive tension and urgency in the case of getting poisoned.
add a script entity lua item, name it poisonScript, containing the following code:
Code: Select all
function extraPoison()
if not party:isResting() then return end
if poisonTick < 2 then poisonTick = poisonTick + 1 return end
poisonTick = 0
for i=1,4 do
local champ = party:getChampion(i)
if champ:hasCondition("poison") then
local amt = champ:getCondition("poison")
local resist = champ:getResistance("poison")
pr.nt(champ:getName(),amt,"resist"..resist)
champ:damage(amt/3*(1-((resist+0.1)/100)), "poison")
end
end
end
poisonTick = 0
The final part to make this work is left to you:
You'll need a Universal Timer set up in your dungeon (every mod should have one!), and have it run the above function every 1 second (which is sped up during resting). For example, if your universal timer is set up to tick every 1/5 of a second, then have it run the poison function poisonScript.extraPoison() once every 5 ticks.