Connection ErrorBad RequestThis page went staleSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
This page went stale
Your security token was rejected, usually because the page sat open too long or you signed in elsewhere. Nothing was saved. Reload the page and try again.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
sergejez, there can only be one trigger for a new day, so the script doesn't work. If we remove the experience distribution in several steps and leave only the logic "every day Zehir receives experience proportional to his level," then it can be written like this:
-- table of levels and experience amounts
zehir_lvl_and_exp = {from highest level to lowest, {3,600}, {1,320}};
function NewDay()
if IsHeroAlive("Zehir") == not nil then
local zehir_level = GetHeroLevel("Zehir");
for lvl_and_exp in zehir_lvl_and_exp do
if zehir_level >= lvl_and_exp[1] then
ChangeHeroStat("Zehir", STAT_EXPERIENCE, lvl_and_exp[2]);
break
end
end
end
end
Trigger(NEW_DAY_TRIGGER, "NewDay" );