ond
Veteran OT User
As the title implies, I need some help making a lua function that will return the mana needed for the next magic level.
Server: OTHire (Based on OTServ, Legacy)
Edit:
This solution works:
Server: OTHire (Based on OTServ, Legacy)
Edit:
This solution works:
Lua:
function onSay(cid, param, words)
local data = {
[1] = 1.1,
[2] = 1.1,
[3] = 1.4,
[4] = 3.0,
}
local voc = data[getPlayerVocation(cid)]
if not voc or not voc + 4 then
return false
end
local magicLevel = getPlayerMagLevel(cid)
local mana = math.ceil(((1600 * math.pow(voc, magicLevel)) - getPlayerManaSpent(cid)) / getConfigValue('rate_mag'))
doPlayerSendTextMessage(cid, 17, "Mana required for magic level " .. magicLevel + 1 .. ": " .. mana)
return false
end
Last edited: