Ir para conteúdo

Featured Replies

Postado

Bom galera, é o seguinte, passei meu servidor (Dbo) de 8.54 para versão 8.60, e nesse processo o Npc Reborn, acabou dando erro, quando você reborna, O certo seria você voltar para o nível 1, Porem isso não está acontecendo, você realmente reborna, passa a utilizar as Outfits Reborn e Attack do mesmo, porem continua no level em que estava.

alguém poderia me ajudar? O problema é que ele não volta para o nível 1, Ele continua no level em que estava na hora de Resetar e da erro na Distro.



SCRIPT DO NPC :


Citar

--[[script made 100% by Nogard and Night Wolf.
You can feel free to edit anything you want, but don't remove the credits]]


local config = {
minlevel = 250, --- level inical para resetar
price = 0, --- preço inicial para resetar
newlevel = 1, --- level após reset
priceByReset = 0, --- preço acrescentado por reset
percent = 99, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
levelbyreset = 0 --- quanto de level vai precisar a mais no próximo reset
}
--- end config
local cfg = {
--[vocation id] = {nova voc, looktype}
[1] = { 201, 137 }, -- GOKU
[10] = { 208, 148 }, -- GOHAN
[18] = { 215, 144 }, -- GOTEN
[24] = { 222, 152 }, -- VEGETA
[33] = { 229, 150 }, -- TRUNKS
[41] = { 236, 162 }, -- CHIBI TRUNKS
[47] = { 243, 173 }, -- PICCOLO
[53] = { 250, 221 }, -- DENDE
[58] = { 257, 60 }, -- BARDOCK
[65] = { 264, 84 }, -- BROOLY
[71] = { 271, 178 }, -- TSUFUL
[77] = { 278, 227 }, -- FREEZA
[85] = { 285, 190 }, -- COOLER
[92] = { 292, 15 }, -- ANDROID 17
[98] = { 299, 15 }, -- ANDROID 18
[104] = { 306, 34 }, -- BUU
[111] = { 313, 118 }, -- CELL
[117] = { 320, 341 }, -- SHIN
[122] = { 327, 102 }, -- PAN
[128] = { 334, 326 }, -- JANEMBA
[135] = { 341, 482 }, -- JENK
[142] = { 348, 500 }, -- TURLES
[500] = { 600, 521 }, -- KING VEGETTA
[506] = { 607, 198 }, -- SHENRON
[512] = { 614, 422 }, -- VEGETTO
[518] = { 621, 506 }, -- KAGOME
[524] = { 628, 547 } -- TAPION
}


function addReset(cid)
resets = getResets(cid)
setPlayerStorageValue(cid, 378378, resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
local hp = getCreatureMaxHealth(cid)
local resethp = hp*(config.percent/100)
setCreatureMaxHealth(cid, resethp)
local differencehp = (hp - resethp)
doCreatureAddHealth(cid, -differencehp)
local mana = getCreatureMaxMana(cid)
local resetmana = mana*(config.percent/100)
setCreatureMaxMana(cid, resetmana)
local differencemana = (mana - resetmana)
doCreatureAddMana(cid, -differencemana)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
return TRUE
end

function getResets(cid)
resets = getPlayerStorageValue(cid, 378378)
if resets < 0 then
resets = 0
end
return resets
end

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

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if (not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

local newPrice = config.price + (getResets(cid) * config.priceByReset)
local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)

if getPlayerLevel(cid) >= 602 then
return doPlayerSendCancel(cid, "Você só pode rebornar level 601-.")
end

if msgcontains(msg, 'reborn') then
if getResets(cid) == resets then
selfSay('Você tem certeza ?', cid)
talkState[talkUser] = 1
else
selfSay('I couldnt acess your bank of acess!', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerMoney(cid) < newPrice then
selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
elseif getPlayerLevel(cid) < newminlevel then
selfSay('The minimum level for reseting is '..newminlevel..'!', cid)
else
local voc = cfg[getPlayerVocation(cid)]
if voc then
doPlayerSetVocation(cid, voc[1])
local outfit = {lookType = voc[2]}
doCreatureChangeOutfit(cid, outfit)
doPlayerRemoveMoney(cid,newPrice)
playerid = getPlayerGUID(cid)
addEvent(addReset, (0.1*1000), cid)
local msg ="---[Reborn: Yes]-- You have Reborned! Você vai ser desconectado em 1 segundo."
if doPlayerPopupFYI(cid, msg) then
end
else
selfSay('Reverta as transformções !', cid)
end
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
talkState[talkUser] = 0
selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
talkState[talkUser] = 0
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Espero que alguém possa me ajudar, obrigado.

Editado por nettoferreira (veja o histórico de edições)

  • Respostas 7
  • Visualizações 2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Christinacsa
    Christinacsa

  • doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")   Não precisa remover o player, pode usar assim:

Posted Images

Postado

--[[Script made 100% by Nogard and Night Wolf.
You can feel free to edit anything you want, but don't remove the credits]]


local config = {
    minlevel = 250, --- level inical para resetar
    price = 0, --- preço inicial para resetar
    newlevel = 1, --- level após reset
    priceByReset = 0, --- preço acrescentado por reset
    percent = 99, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total)
    levelbyreset = 0 --- quanto de level vai precisar a mais no próximo reset
}
--- end config
local cfg = {
    --[vocation id] = {nova voc, looktype}
    [1] = { 201, 137 }, -- GOKU
    [10] = { 208, 148 }, -- GOHAN
    [18] = { 215, 144 }, -- GOTEN
    [24] = { 222, 152 }, -- VEGETA
    [33] = { 229, 150 }, -- TRUNKS
    [41] = { 236, 162 }, -- CHIBI TRUNKS
    [47] = { 243, 173 }, -- PICCOLO
    [53] = { 250, 221 }, -- DENDE
    [58] = { 257, 60 }, -- BARDOCK
    [65] = { 264, 84 }, -- BROOLY
    [71] = { 271, 178 }, -- TSUFUL
    [77] = { 278, 227 }, -- FREEZA
    [85] = { 285, 190 }, -- COOLER
    [92] = { 292, 15 }, -- ANDROID 17
    [98] = { 299, 15 }, -- ANDROID 18
    [104] = { 306, 34 }, -- BUU
    [111] = { 313, 118 }, -- CELL
    [117] = { 320, 341 }, -- SHIN
    [122] = { 327, 102 }, -- PAN
    [128] = { 334, 326 }, -- JANEMBA
    [135] = { 341, 482 }, -- JENK
    [142] = { 348, 500 }, -- TURLES
    [500] = { 600, 521 }, -- KING VEGETTA
    [506] = { 607, 198 }, -- SHENRON
    [512] = { 614, 422 }, -- VEGETTO
    [518] = { 621, 506 }, -- KAGOME
    [524] = { 628, 547 } -- TAPION
}

function getResets(cid)
    local resets = getPlayerStorageValue(cid, 378378)
    if resets < 0 then
        resets = 0
    end
    return resets
end

function addReset(cid)
    local resets = getResets(cid)
    setPlayerStorageValue(cid, 378378, resets+1)
    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    local hp = getCreatureMaxHealth(cid)
    local resethp = hp*(config.percent/100)
    
    local resetlevel = level*(config.resets+1)
    setCreatureMaxHealth(cid, resethp)
    local differencehp = (hp - resethp)
    doCreatureAddHealth(cid, -differencehp)
    local mana = getCreatureMaxMana(cid)
    local resetmana = mana*(config.percent/100)
    setCreatureMaxMana(cid, resetmana)
    local differencemana = (mana - resetmana)
    doCreatureAddMana(cid, -differencemana)
    doPlayerAddLevel(cid, -(getPlayerLevel(cid) - config.newlevel))
    return true
end

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

-- OTServ event handling functions start
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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if (not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
    
    local newPrice = config.price + (getResets(cid) * config.priceByReset)
    local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)
    
    if getPlayerLevel(cid) >= 602 then
        return doPlayerSendCancel(cid, "Você só pode rebornar level 601-.")
    end
    
    if msgcontains(msg, 'reborn') then
        if getResets(cid) == resets then
            selfSay('Você tem certeza ?', cid)
            talkState[talkUser] = 1
        else
            selfSay('I couldnt acess your bank of acess!', cid)
        end
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        if getPlayerMoney(cid) < newPrice then
            selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
        elseif getPlayerLevel(cid) < newminlevel then
            selfSay('The minimum level for reseting is '..newminlevel..'!', cid)
        else
            local voc = cfg[getPlayerVocation(cid)]
            if voc then
                doPlayerSetVocation(cid, voc[1])
                local outfit = {lookType = voc[2]}
                doCreatureChangeOutfit(cid, outfit)
                doPlayerRemoveMoney(cid,newPrice)
                playerid = getPlayerGUID(cid)
                addEvent(addReset, (0.1*1000), cid)
                local msg ="---[Reborn: Yes]-- You have Reborned! Você vai ser desconectado em 1 segundo."
                if doPlayerPopupFYI(cid, msg) then
                end
            else
                selfSay('Reverta as transformções !', cid)
            end
        end
        talkState[talkUser] = 0
    elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
        talkState[talkUser] = 0
        selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
        selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
        talkState[talkUser] = 0
    end
    
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo