Postado Agosto 30, 2023 1 ano Autor Fiz a modificação, segue os erros: Ao resetar voce é enviado para o templo mas o level permanece o mesmo, ao usar magias de healing a vida começa a reduzir ate chegar a 21/31 de HP/MP e nao sobe mais...
Postado Agosto 30, 2023 1 ano local config = { minlevel = 500, price = 100000000, newlevel = 20, priceByReset = 100000000, percent = 10, maxresets = 20, levelbyreset = 100, damagePercent = 5, } function getResets(uid) local resets = getPlayerStorageValue(uid, 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 = {} 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 addReset(cid) if npcHandler:isFocused(cid) then npcHandler:releaseFocus(cid) end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid talkState[talkUser] = 0 local resets = getResets(cid) setPlayerStorageValue(cid, 378378, resets + 1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) -- Ajustar HP local hp = getCreatureMaxHealth(cid) local resethp = hp * (config.percent / 100) setCreatureMaxHealth(cid, resethp) local differencehp = resethp - hp doCreatureAddHealth(cid, differencehp) -- Ajustar MP local mana = getCreatureMaxMana(cid) local resetmana = mana * (config.percent / 100) setCreatureMaxMana(cid, resetmana) local differencemana = resetmana - mana doCreatureAddMana(cid, differencemana) -- Ajustar dano local damage = getCreatureDamage(cid) if damage then local additionalDamage = damage * (config.damagePercent / 100) local newDamage = damage + additionalDamage setCreatureDamage(cid, newDamage) end local description = resets + 1 local playerid = getPlayerGUID(cid) db.query("UPDATE `players` SET `description` = ' [Reset: " .. description .. "]' WHERE `players`.`id`= " .. playerid .. "") db.query("UPDATE `players` SET `level`=" .. config.newlevel .. ",`experience`= 0 WHERE `players`.`id`= " .. playerid .. "") doRemoveCreature(cid) return true 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 talkState[talkUser] = 0 local newPrice = config.price + (getResets(cid) * config.priceByReset) local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset) if msgcontains(msg, 'reset') then if getResets(cid) < config.maxresets then selfSay('Voce gostaria de resetar? Isso vai custar ' .. newPrice .. " gp's!", cid) talkState[talkUser] = 1 else selfSay('Voce ja atingiu o nivel maximo de resets!', cid) end elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if getPlayerMoney(cid) < newPrice then selfSay('E necessario ter ' .. newPrice .. " gp's para resetar!", cid) elseif getPlayerLevel(cid) < newminlevel then selfSay('O level minimo para resetar e ' .. newminlevel .. '!', cid) else doPlayerRemoveMoney(cid, newPrice) playerid = getPlayerGUID(cid) addEvent(function() if isPlayer(cid) then addReset(cid) end end, 3000) local number = getResets(cid) + 1 local msg = "---[Reset: " .. number .. "]-- Voce resetou! Voce ganhou " .. config.damagePercent .. "% de dano adicional. Voce sera desconectado em 3 segundos." doPlayerPopupFYI(cid, msg) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 elseif (msgcontains(msg, 'no')) and isInArray({ 1 }, talkState[talkUser]) == TRUE then talkState[talkUser] = 0 npcHandler:releaseFocus(cid) 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.