Well im using a system to show what is the experience multiplier that the char is receiving but it only works if tow cases are set, more that, the code wont show..
im using this code to show the info needed
After using !exp command if the char meets the requirement for 2 it shows on screen but if 3 it skip, and if no option it gives an error..
the example is.. a Char with vip time, premium and stamina above 40hrs ..
i get this error
BUT if i remove pp > 0 letting only the rest like in here
the system will work, console will show now errors and in game screen i'll receive the info
i also made changes in player.lua to fit with my needs but the same.. this time i get no errors but it doesnt counts the xp in right way. If the player is premium and with stamina above 40hrs it will receive the right xp but if the char is vip, is premium and stamina above 40hrs system will not count the line and will delivery the base xp..
is this a system thing that doesnt accept more than two cases or what?
im using this code to show the info needed
Code:
function onSay(player, words, param)
local p = player
local s = function(p, lv)
local k = Game.getExperienceStage(lv)
local st = p:getStamina()
local pv = p:getVipDays()
local pp = p:getPremiumDays()
if pv > 0 and st > 2400 then
return k*(1.5+1.2) .. " (vip exp and stamina bonus) "
elseif pv > 0 and st < 840 then
return k*(0.5+0.2) .. " (penalty for stamina too low) "
elseif pp > 0 and pv == 0 and st > 2400 then
return k*1.5 .. " (stamina bonus) "
elseif pv == 0 and st < 840 then
return k*0.5 .. " (stamina penalty) "
elseif pp > 0 and pv == 0 and st > 841 and st < 2399 then
return k .. " (normal) "
elseif pp > 0 and pv > 0 and st > 841 and st < 2399 then
return k*1.2 .. " (vip bonus) "
elseif pp == 0 and pv > 0 and st > 841 and st < 2399 then
return k*1.2 .. " (vip bonus) "
elseif st < 1 then
return 0 .. " (out of stamina) "
-- else
-- return k .. "(aqui)"
end
end
if words == "!exp" then
local lv = p:getLevel()
p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. ((50 * lv^3) - (150 * lv^2) + (400 * lv)) / 3 - p:getExperience() .. " experience more, for " .. lv+1 .. " level.")
p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Current rate: x" .. s(p, lv))
return false
end
p:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have to spend " .. math.ceil((p:getVocation():getRequiredManaSpent(p:getBaseMagicLevel() + 1) - p:getManaSpent()) / configManager.getNumber(configKeys.RATE_MAGIC)) .. " mana more, for next magic level.")
return false
end
After using !exp command if the char meets the requirement for 2 it shows on screen but if 3 it skip, and if no option it gives an error..
the example is.. a Char with vip time, premium and stamina above 40hrs ..
if pp > 0 and pv > 0 and st > 2400 then
return k*(1.5+1.2) .. " (vip exp and stamina bonus) "
return k*(1.5+1.2) .. " (vip exp and stamina bonus) "
i get this error
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/expmana.lua:onSay
data/talkactions/scripts/expmana.lua:32: attempt to concatenate a nil value
stack traceback:
[C]: in function '__concat'
data/talkactions/scripts/expmana.lua:32: in function <data/talkactions/scripts/expmana.lua:1>
BUT if i remove pp > 0 letting only the rest like in here
Code:
if pv > 0 and st > 2400 then
return k*(1.5+1.2) .. " (vip exp and stamina bonus) "
the system will work, console will show now errors and in game screen i'll receive the info
Code:
22:39 Current rate: x18.9 (vip exp and stamina bonus)
i also made changes in player.lua to fit with my needs but the same.. this time i get no errors but it doesnt counts the xp in right way. If the player is premium and with stamina above 40hrs it will receive the right xp but if the char is vip, is premium and stamina above 40hrs system will not count the line and will delivery the base xp..
Code:
-- Stamina modifier
if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
useStamina(self)
local staminaMinutes = self:getStamina()
if staminaMinutes > 2400 and self:isPremium() then
exp = exp * 1.5
elseif staminaMinutes <= 840 then
exp = exp * 0.5
elseif staminaMinutes > 2400 and self:isPremium() and self:isVip() then
exp = exp * (1.5 + 1.2)
elseif staminaMinutes <= 840 and self:isVip() then
exp = exp * (0.5 + 0.2)
elseif staminaMinutes < 2399 and staminaMinutes > 841 and self:isVip() then
exp = exp * 1.2
end
end
return exp
end
is this a system thing that doesnt accept more than two cases or what?