To com um erro aqui no script, o que acontece. O player upa o level ele ganha o points e tal, na hora de usar só ta funcionando a mana/life pra adicionar. Quando eu tento usar nos skills não funcionam, eu não entendo mt, porém a mana e o life ele puxa uma função exata para cada, já os skills não. Porém não dá erro no distro. Alguem se habilita?
Creaturescript
local function addSkills(player, skillId)
player:addSkillTries(skillId, math.ceil(player:getVocation():getRequiredSkillTries(skill, player:getSkillLevel(skill) + 1) / configManager.getNumber(configKeys.RATE_SKILL)))
return false
end
local skillids = {
["shield"] = SKILL_SHIELD,
["sword"] = SKILL_SWORD,
["axe"] = SKILL_AXE,
["club"] = SKILL_CLUB,
["fist"] = SKILL_FIST,
["dist"] = SKILL_DISTANCE
}
local attributes = {
["health"] = {reqPoints = 1, increaseBy = 2, name = "Hit Points"},
["mana"] = {reqPoints = 1, increaseBy = 2, name = "Mana Points"},
["magic"] = {reqPoints = 15, increaseBy = 1, name = "Magic Level"},
["shielding"] = {reqPoints = 15, increaseBy = 1, name = "Shielding Skill"},
["sword"] = {reqPoints = 15, increaseBy = 1, name = "Sword Skill"},
["axe"] = {reqPoints = 15, increaseBy = 1, name = "Axe Skill"},
["club"] = {reqPoints = 15, increaseBy = 1, name = "Club Skill"},
["fist"] = {reqPoints = 15, increaseBy = 1, name = "Fist Skill"},
["distance"] = {reqPoints = 15, increaseBy = 1, name = "Distance Skill"},
}
function onModalWindow(player, modalWindowId, buttonId, choiceId)
local SKILL_POINTS = 45200 --- Change here the storage value used to save the skill points
local points = player:getStorageValue(SKILL_POINTS)
local function sendCancel()
player:sendTextMessage(MESSAGE_INFO_DESCR, "You do not have the required amount of Skill Points!")
end
local function doAddHealth(param, attributes)
player:setMaxHealth(player:getMaxHealth() + attributes["health"].increaseBy*param)
player:addHealth(attributes["health"].increaseBy*param)
player:setStorageValue(SKILL_POINTS, points - attributes["health"].reqPoints*param)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have gained " ..attributes["health"].increaseBy.. " " ..attributes["health"].name.. "!")
return true
end
local function doAddMana(param, attributes)
player:setMaxMana(player:getMaxMana() + attributes["mana"].increaseBy*param)
player:addMana(attributes["mana"].increaseBy*param)
player:setStorageValue(SKILL_POINTS, points - attributes["mana"].reqPoints*param)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have gained " ..attributes["mana"].increaseBy.. " " ..attributes["mana"].name.. "!")
return true
end
if (not modalWindowId == 1) or (buttonId == 4) then
return false
end
if choiceId == 1 then
if buttonId == 1 then
if points >= attributes["health"].reqPoints then
doAddHealth(1, attributes)
else
sendCancel()
end
end
if buttonId == 2 then
if points >= attributes["health"].reqPoints*2 then
doAddHealth(2, attributes)
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["health"].reqPoints*5 then
doAddHealth(5, attributes)
else
sendCancel()
end
end
end
if choiceId == 2 then
if buttonId == 1 then
if points >= attributes["mana"].reqPoints then
doAddMana(1, attributes)
else
sendCancel()
end
end
if buttonId == 2 then
if points >= attributes["mana"].reqPoints*2 then
doAddMana(2, attributes)
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["mana"].reqPoints*5 then
doAddMana(5, attributes)
else
sendCancel()
end
end
end
if choiceId == 3 then
if buttonId == 1 then
if points >= attributes["magic"].reqPoints then
player:addManaSpent(math.ceil(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) / configManager.getNumber(configKeys.RATE_MAGIC)))
player:setStorageValue(SKILL_POINTS, points - attributes["magic"].reqPoints)
else
sendCancel()
end
end
if buttonId == 2 then
if points >= attributes["magic"].reqPoints*2 then
for i = 1,2 do
player:addManaSpent(math.ceil(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) / configManager.getNumber(configKeys.RATE_MAGIC)))
player:setStorageValue(SKILL_POINTS, points - attributes["magic"].reqPoints)
end
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["magic"].reqPoints*5 then
for i = 1,5 do
player:addManaSpent(math.ceil(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel() + 1) / configManager.getNumber(configKeys.RATE_MAGIC)))
player:setStorageValue(SKILL_POINTS, points - attributes["magic"].reqPoints)
end
else
sendCancel()
end
end
end
if choiceId == 4 then
if buttonId == 1 then
if points >= attributes["sword"].reqPoints then
addSkills(player, skillids["sword"])
end
end
if buttonId == 2 then
if points >= attributes["sword"].reqPoints*2 then
for i = 1,2 do
addSkills(player, skillids["sword"])
end
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["sword"].reqPoints*5 then
for i = 1,5 do
addSkills(player, skillids["sword"])
end
else
sendCancel()
end
end
end
if choiceId == 5 then
if buttonId == 1 then
if points >= attributes["axe"].reqPoints then
addSkills(player, skillids["axe"])
end
else
sendCancel()
end
if buttonId == 2 then
if points >= attributes["axe"].reqPoints*2 then
for i = 1,2 do
addSkills(player, skillids["axe"])
end
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["axe"].reqPoints*5 then
for i = 1,5 do
addSkills(player, skillids["axe"])
end
else
sendCancel()
end
end
end
if choiceId == 6 then
if buttonId == 1 then
if points >= attributes["club"].reqPoints then
addSkills(player, skillids["club"])
end
else
sendCancel()
end
if buttonId == 2 then
if points >= attributes["club"].reqPoints*2 then
for i = 1,2 do
addSkills(player, skillids["club"])
end
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["club"].reqPoints*5 then
for i = 1,5 do
addSkills(player, skillids["club"])
end
else
sendCancel()
end
end
end
if choiceId == 7 then
if buttonId == 1 then
if points >= attributes["shielding"].reqPoints then
addSkills(player, skillids["shield"])
end
else
sendCancel()
end
if buttonId == 2 then
if points >= attributes["shielding"].reqPoints*2 then
for i = 1,2 do
addSkills(player, skillids["shield"])
end
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["shielding"].reqPoints*5 then
for i = 1,5 do
addSkills(player, skillids["shield"])
end
else
sendCancel()
end
end
end
if choiceId == 8 then
if buttonId == 1 then
if points >= attributes["distance"].reqPoints then
addSkills(player, skillids["dist"])
end
else
sendCancel()
end
if buttonId == 2 then
if points >= attributes["distance"].reqPoints*2 then
for i = 1,2 do
addSkills(player, skillids["dist"])
end
else
sendCancel()
end
end
if buttonId == 3 then
if points >= attributes["distance"].reqPoints*5 then
for i = 1,5 do
addSkills(player, skillids["dist"])
end
else
sendCancel()
end
end
end
end
local SkillPoints = {
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
[5] = 1,
[6] = 1,
[7] = 1,
[8] = 1,
}
function onAdvance(player, skill, oldlevel, newlevel)
local cid = player:getId()
if not (SkillPoints[getPlayerVocation(cid)]) then
return true
end
if (skill == 8) then
if (getPlayerStorageValue(cid, 14573) < newlevel) then
if (getPlayerStorageValue(cid, 14574) < 0) then
setPlayerStorageValue(cid, 14574, 0)
setPlayerStorageValue(cid, 14573, 0)
end
setPlayerStorageValue(cid, 14573, newlevel)
setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) + (newlevel - oldlevel) * (SkillPoints[getPlayerVocation(cid)]))
doCreatureSay(cid, '+1 Skill Point!', TALKTYPE_MONSTER_SAY)
end
end
return true
end
Pergunta
espalha 1
To com um erro aqui no script, o que acontece. O player upa o level ele ganha o points e tal, na hora de usar só ta funcionando a mana/life pra adicionar. Quando eu tento usar nos skills não funcionam, eu não entendo mt, porém a mana e o life ele puxa uma função exata para cada, já os skills não. Porém não dá erro no distro. Alguem se habilita?
Creaturescript
TAGS
Talkactions;
Editado por espalhaLink para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados