Here is a simple example for a hunger system wich deals damage to champions if the food bar falls to 0.
Code: Select all
defineObject{
name = "party",
baseObject = "party",
components = {
{
class = "Timer",
name = "foodtimer",
timerInterval = 10.0, -- check every 10 seconds for food / deals damage
triggerOnStart = true,
onActivate = function(self)
for i = 1, 4, 1 do
local food = party.party:getChampion(i):getFood()
if food == 0 then
local h = party.party:getChampion(i):getMaxHealth()
local dmg = (h/24) -- the champion has 4 minutes to life
party.party:getChampion(i):damage(dmg, "physical")
end
end
end
}
}
}