Page 1 of 1

Proper Poison Damage While Resting - no more cheating!

Posted: Sun Sep 08, 2013 4:35 am
by Komag
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:

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
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.

Re: Proper Poison Damage While Resting - no more cheating!

Posted: Sun Sep 08, 2013 5:51 am
by Asteroth
Everyone who experienced poison in Eye of the Beholder is shuddering...

Re: Proper Poison Damage While Resting - no more cheating!

Posted: Sun Sep 08, 2013 2:43 pm
by badhabit
Komag wrote:Proper Poison Damage While Resting
no more cheating! <snip>

great! added it to the other scripts under [Patch] community made fixes

Re: Proper Poison Damage While Resting - no more cheating!

Posted: Sun Sep 08, 2013 3:56 pm
by Dr.Disaster
Nice work.

Yet won't preventing the Rest of poisoned characters do the same if not a better job? Depending on a characters max health adding such a script could almost instantly kill a poisoned character anyway due to increased time and poison damage applied, so ...

Re: Proper Poison Damage While Resting - no more cheating!

Posted: Sun Sep 08, 2013 4:26 pm
by Komag
Your concern is important to me as well, so I tested it on a wide variety of health levels and vitality, poison resistance, etc, and I tried to balance it as well as I could. The amount of poison the game inflicts is already scaled to champion's health/vitality somewhat, so that helps. I'll be doing more lengthy playtesting next week as well.

I'm wary of the idea of preventing rest overall because if only one champion is poisoned it could still make sense to have the party rest for a bit for their benefit (health/energy regain), then feed that one poisoned person a health potion

Re: Proper Poison Damage While Resting - no more cheating!

Posted: Tue Sep 10, 2013 4:10 pm
by bongobeat
Hello,
thanks for this job!
I m gonna use it to improve difficulty. That's true it's easy to sleep while poisoned to get cure of poison, the potion start to be of no use!

Re: Proper Poison Damage While Resting - no more cheating!

Posted: Tue Sep 10, 2013 4:33 pm
by bongobeat
I just test it, but I have some trouble.
the script gives me an error message.
do you have any idea to avoid this?
Image
the timer linked to the script
Image

another thing:
I ve read that a timer running in a level will not run at the same time on another level. Should these timer and script be implemented on each level?

Re: Proper Poison Damage While Resting - no more cheating!

Posted: Tue Sep 10, 2013 5:44 pm
by Diarmuid
bongobeat wrote: another thing:
I ve read that a timer running in a level will not run at the same time on another level. Should these timer and script be implemented on each level?
The "pr.nt" is a Komag custom print function. Just replace it with print and it'll work. As for timers, yes, you need an "universal Timer". Here's my implementation, set to run at 1/4s but you can adjust it with the timerInterval variable. There's also a handy isTick(numberOfTicks) function that can automatically execute calls at different intervals. For example, if isTick(8) would run every 2s (1/4s x 8).

Code: Select all

timerInterval = 0.25;
timerTick = 0;

function setUniversalTimers()
	levels = getMaxLevels()
	for i = 1, levels do
		spawn("timer", i, 0, 0, 0, "universalTimer_"..i)
			:setTimerInterval(timerInterval)
			:addConnector("activate", "universalTimer", "universalTimer")
			:activate()
	end
end

setUniversalTimers();

function isTick(tickNumber)

	if timerTick%tickNumber == 0 then return true; else return false; end
end

function universalTimer(sourceTimer)

	if sourceTimer.level == party.level then
		timerTick = timerTick + 1
	
		-- Place your function calls here:
		
		if isTick(5) then
			print("Every 5 ticks!") 
		end
		
		if isTick(9) then
			print("Every 9 ticks!") 
		end		
		
	end
	
end



Re: Proper Poison Damage While Resting - no more cheating!

Posted: Thu Sep 12, 2013 10:46 am
by bongobeat
hi,
thanks for your help!
this is deadly!