Hello I'am using a new system to advance in skills/magic level, fast explained you for leveling you get points, you spend points in the skill you want to advance (works the same as /addskill command), however if you spend points in magic level, it doesn't adds you 1 exact magic level, and if you use the points on skills you can only get a max of 69 (yeah 69 lol), how I can fix this? any help is appreciated!
Heres my script (I doubt is the script because /addskill command works the same)
Forget about skills I solved it but magic level is still a problem.
Heres my script (I doubt is the script because /addskill command works the same)
Code:
local VocPoints = {
[1] = 3,
[2] = 3,
[3] = 3,
[4] = 3,
[5] = 3,
[6] = 3,
[7] = 3,
[8] = 3,
[9] = 3,
}
function onSay(cid, words, param)
if not (VocPoints[getPlayerVocation(cid)]) then
return false
end
local param = param:lower()
local p2 = string.explode(param, ",")
if (getPlayerStorageValue(cid, 14574) < 0) then
setPlayerStorageValue(cid, 14574, 0)
end
local skillids = {
["shielding"] = 5,
["one-handed"] = 2,
["dual"] = 3,
["two-handed"] = 1,
["sneaking"] = 6,
["distance"] = 4
}
local attributes = {
["health"] = {np = 1, vl = 10, nm = "Hit Points"}, -- Precisa usar 2 points para adicionar 10 de hp
["mana"] = {np = 1, vl = 10, nm = "Mana Points"},
["magic"] = {np = 1, vl = 1, nm = "Magic Level"},
["shielding"] = {np = 1, vl = 1, nm = "Shielding Skill"},
["one-handed"] = {np = 1, vl = 1, nm = "One-Handed Skill"},
["dual"] = {np = 1, vl = 1, nm = "Dual Skill"},
["two-handed"] = {np = 1, vl = 1, nm = "Two-Handed Skill"},
["distance"] = {np = 1, vl = 1, nm = "Distance Skill"},
["sneaking"] = {np = 1, vl = 1, nm = "Sneaking Skill"},
}
if (param == "check") then
doPlayerPopupFYI(cid, "Skill Points\n\nAvailable points: ".. getPlayerStorageValue(cid, 14574) .."\npoints per level: ".. VocPoints
[getPlayerVocation(cid)])
elseif (p2[1] and p2[1] == "add") and (attributes[p2[2]]) and (tonumber(p2[3])) then
if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * attributes[p2[2]].np) then
doPlayerSendCancel(cid, "You do not have enough points!")
return doSendMagicEffect(getThingPos(cid), 2)
end
if (p2[2] == "health") then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + attributes[p2[2]].vl * tonumber(p2[3]))
doCreatureAddHealth(cid, attributes[p2[2]].vl * tonumber(p2[3]))
elseif (p2[2] == "mana") then
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + attributes[p2[2]].vl * tonumber(p2[3]))
doCreatureAddMana(cid, attributes[p2[2]].vl * tonumber(p2[3]))
elseif (p2[2] == "magic") then
doPlayerAddMagLevel(cid, getPlayerMagLevel(cid) + attributes[p2[2]].vl * tonumber(p2[3]))
elseif(skillids[p2[2]]) then
for a = 1, tonumber(p2[3]) do
doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)
end
end
doSendMagicEffect(getThingPos(cid), 29)
doSendMagicEffect(getThingPos(cid), 30)
doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * attributes[p2[2]].np, 180)
setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * attributes[p2[2]].np)
else
local msgx = ""
for i, v in pairs(attributes) do
local add = (v.np > 1) and "s" or ""
msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"
end
doPlayerPopupFYI(cid, "Skill Points\n\nSkills:\n\n".. msgx .. "\nExample: ".. words .." add, health, 5\n\nPuntos disponibles: ".. getPlayerStorageValue(cid, 14574))
end
return true
end
Forget about skills I solved it but magic level is still a problem.
Last edited: