Criei esse topico pq estou tentando fazer um comando ou npc que consiga trocar a vocação do player para uma vocação nova que criei, mas queria resetar, vida, mana, ml, skills e o storage 378378 (resets), mas ele cobra o dinheiro, troca a classe mas não remove os skills e ml =/
Meu servidor é 1.4 TFS 10.98
i am using TFS 1.4 on tibia 10.98, trying to create one talkaction or npc for change the vocation for the new vocation, i create this npc, for restart the follows attributes: Health, Mana, Skills, Magic level and the storage 378378, while charging a fee and demanding a value on storage. It didn't work as expected, it didn't remove magiclevel, skills, life and mana, it just charged value and storage. And when the user did not have the necessary, he does not say the proposed message
Any can help me ?):
Meu servidor é 1.4 TFS 10.98
i am using TFS 1.4 on tibia 10.98, trying to create one talkaction or npc for change the vocation for the new vocation, i create this npc, for restart the follows attributes: Health, Mana, Skills, Magic level and the storage 378378, while charging a fee and demanding a value on storage. It didn't work as expected, it didn't remove magiclevel, skills, life and mana, it just charged value and storage. And when the user did not have the necessary, he does not say the proposed message
Any can help me ?):
Lua:
function onSay(cid, words, param, channel)
local player = Player(cid)
local cost = 10000 -- o custo em gold coins do serviço
local resetsNeeded = 10 -- o número de resets necessários para a troca de vocação
local newVocationId = 9 -- o ID da nova vocação que você criou
if not player then
return false
end
-- Verifique se o jogador tem o número necessário de resets
if player:getStorageValue(378378) < resetsNeeded then
player:sendCancelMessage("Você precisa de " .. resetsNeeded .. " resets para realizar esta troca de vocação.")
return false
end
-- Verifique se o jogador tem gold coins suficientes para pagar pelo serviço
if player:getMoney() < cost then
player:sendCancelMessage("Você precisa de " .. cost .. " gold coins para realizar esta troca de vocação.")
return false
end
-- Remova os gold coins e resets do jogador
player:removeMoney(cost)
player:setStorageValue(378378, player:getStorageValue(378378) - resetsNeeded)
-- Altere a vocação do jogador para a nova vocação
player:setVocation(Vocation(newVocationId))
-- Configure as estatísticas do jogador
player:setStorageValue(PlayerStorageKeys.promotion, 0)
player:setMagicLevel(0)
player:setSkill(SKILL_FIST, 10)
player:setSkill(SKILL_CLUB, 10)
player:setSkill(SKILL_SWORD, 10)
player:setSkill(SKILL_AXE, 10)
player:setSkill(SKILL_DISTANCE, 10)
player:setMaxHealth(180)
player:setMaxMana(80)
player:setMaxCapacity(1000)
-- Envie uma mensagem ao jogador confirmando a troca de vocação
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Você trocou de vocação com sucesso!")
return true
end