• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[TFS 1.5]reset level, life and mana, when acquiring vocation evolution

Shoorkill

Member
Joined
Dec 17, 2018
Messages
126
Reaction score
21
hello, I need this script to do a "reset" on the character, when he conquers the new vocation he returns to level 8 with life and initial mana in the case of life=185, mana=40... can someone help me?

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if(msgcontains(msg, 'deus')) then
selfSay('Ora,ora vejo que tem se empenhado!', cid)
selfSay('Posso te evoluir a Deus?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 500
local cost = 5000000
------/CONFIGS-------
-----LOCALS-----
local id = getPlayerGUID(cid)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
local storage = getPlayerStorageValue(cid, 85989)
local skillPoints = getPlayerStorageValue(cid, 23001)
local maxRebirth = 1 --Change this for the number of rebirths
local new = (getPlayerVocation(cid)+4)

----/LOCALS-----
if(getPlayerLevel(cid) >= level) then
if getPlayerStorageValue(cid, 85989) < maxRebirth then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
if(isInArray({9, 10, 11, 12}, vocation)) then
local player = Player(cid)
doPlayerSetVocation(cid, new)
doSendMagicEffect(getCreaturePos(cid), 49)
player:setStorageValue(85989, storage == -1 and 1 or storage + 1)
player:setStorageValue(23001, skillPoints == -1 and 1 or skillPoints + 1)
addReset(cid)
Game.broadcastMessage("Player: " .. name .. " se tornou um Deus!", MESSAGE_STATUS_WARNING)
doRemoveCreature(cid)
else
selfSay('Voce precisa evoulir a valan primeiro.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce nao tem dinheiro.Voce precisa pagar 5kk pela sua evolucao.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce ja e um Deus player.', cid)
talkState[talkUser] = 0
end
else
selfSay('Somente personagens level 500+ pode se tornar Deus.', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
selfSay('Tudo bem,volte mais tarde.', cid)
talkState[talkUser] = 0
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
hello, I need this script to do a "reset" on the character, when he conquers the new vocation he returns to level 8 with life and initial mana in the case of life=185, mana=40... can someone help me?

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if(msgcontains(msg, 'deus')) then
selfSay('Ora,ora vejo que tem se empenhado!', cid)
selfSay('Posso te evoluir a Deus?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 500
local cost = 5000000
------/CONFIGS-------
-----LOCALS-----
local id = getPlayerGUID(cid)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
local storage = getPlayerStorageValue(cid, 85989)
local skillPoints = getPlayerStorageValue(cid, 23001)
local maxRebirth = 1 --Change this for the number of rebirths
local new = (getPlayerVocation(cid)+4)

----/LOCALS-----
if(getPlayerLevel(cid) >= level) then
if getPlayerStorageValue(cid, 85989) < maxRebirth then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
if(isInArray({9, 10, 11, 12}, vocation)) then
local player = Player(cid)
doPlayerSetVocation(cid, new)
doSendMagicEffect(getCreaturePos(cid), 49)
player:setStorageValue(85989, storage == -1 and 1 or storage + 1)
player:setStorageValue(23001, skillPoints == -1 and 1 or skillPoints + 1)
addReset(cid)
Game.broadcastMessage("Player: " .. name .. " se tornou um Deus!", MESSAGE_STATUS_WARNING)
doRemoveCreature(cid)
else
selfSay('Voce precisa evoulir a valan primeiro.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce nao tem dinheiro.Voce precisa pagar 5kk pela sua evolucao.', cid)
talkState[talkUser] = 0
end
else
selfSay('Voce ja e um Deus player.', cid)
talkState[talkUser] = 0
end
else
selfSay('Somente personagens level 500+ pode se tornar Deus.', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
selfSay('Tudo bem,volte mais tarde.', cid)
talkState[talkUser] = 0
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If you want an NPC to reset the player and restore their life, mana, level 8, etc., you need to have this part of the database.

Lua:
db.query("UPDATE `players` SET `level` = 8, `experience` = 4200, `healthmax` = 185, `health` = 185, `manamax` = 90, `mana` = 90, `cap` = 470 WHERE `id` = " .. id)
db.query("UPDATE `players` SET `name` = '" .. name .. "' WHERE `id` = '" .. id .. "';")
Note that TFS 1.5 does not have "addReset" functionality.

The ready-to-use script, however, does not include an NPC for changing vocations. First, the player needs to perform a reset to restore mana, health and back to starting level 8. Then the player can teleport to a specific area and click on a chest to receive an item. This item can be used to change the player's vocation. It's a simple and effective process.
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)
    npcHandler:onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
    npcHandler:onCreatureDisappear(cid)
end

function onCreatureSay(cid, type, msg)
    npcHandler:onCreatureSay(cid, type, msg)
end

function onThink()
    npcHandler:onThink()
end

function creatureSayCallback(cid, type, msg)
    if (not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    if (msgcontains(msg, 'deus')) then
        selfSay('Ora, ora! Vejo que tem se empenhado.', cid)
        selfSay('Posso resetá-lo para restaurar sua vida e mana, além de retornar ao nível 8. Em seguida, posso levá-lo a uma área onde você poderá clicar em um baú e usar um item para trocar sua vocação?', cid)
        talkState[talkUser] = 1
    elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        -- Configurações
        local level = 500
        local cost = 5000000
        local maxRebirth = 1

        -- Variáveis locais
        local id = getPlayerGUID(cid)
        local name = getCreatureName(cid)
        local vocation = getPlayerVocation(cid)
        local storage = getPlayerStorageValue(cid, 85988)
        local skillPoints = getPlayerStorageValue(cid, 23000)

        if (getPlayerLevel(cid) >= level) then
            if (getPlayerStorageValue(cid, 85988) < maxRebirth) then
                if (doPlayerRemoveMoney(cid, cost) == TRUE) then
                    if (isInArray({5, 6, 7, 8}, vocation)) then --- aqui somente as vocações podem falar com o NPC para realizar o reset.
                        local player = Player(cid)
                        player:setStorageValue(85988, storage == -1 and 1 or storage + 1)
                        player:setStorageValue(23000, skillPoints == -1 and 1 or skillPoints + 1)
                        db.query('UPDATE players SET rebirths = rebirths + ' .. 1 .. ' WHERE id = ' .. getPlayerGUID(cid))
                        Game.broadcastMessage("O jogador " .. name .. " se tornou um Deus!", MESSAGE_STATUS_WARNING)
                        doRemoveCreature(cid)
                        db.query("UPDATE `players` SET `level` = 8, `experience` = 4200, `healthmax` = 185, `health` = 185, `manamax` = 90, `mana` = 90, `cap` = 470 WHERE `id` = " .. id)
                        db.query("UPDATE `players` SET `name` = '" .. name .. "' WHERE `id` = '" .. id .. "';")
                     
                        -- Teleportar o jogador para outro lugar
                        doTeleportThing(cid, {x = 123, y = 456, z = 7}) -- Substitua as coordenadas pelos valores do local desejado
                     
                    else
                        selfSay('Você precisa evoluir para Valan primeiro.', cid)
                        talkState[talkUser] = 0
                    end
                else
                    selfSay('Você não tem dinheiro suficiente. Você precisa pagar 5kk pela sua evolução.', cid)
                    talkState[talkUser] = 0
                end
            else
                selfSay('Você já é um Deus.', cid)
                talkState[talkUser] = 0
            end
        else
            selfSay('Somente personagens de nível 500+ podem se tornar Deus.', cid)
            talkState[talkUser] = 0
        end
    elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then
        selfSay('Tudo bem, volte mais tarde.', cid)
        talkState[talkUser] = 0
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Back
Top