Postado Agosto 28, 2023 1 ano .Qual servidor ou website você utiliza como base? TFS 0.4 Bom dia pessoal, gostaria de saber se existe alguma forma de modificar esse script para que ele tambem aumente o dano alem do HP/MP a cada reset. Mostrar conteúdo oculto local config = { minlevel = 500, --- level inical para resetar price = 100000000, --- preço inicial para resetar newlevel = 20, --- level após reset priceByReset = 100000000, --- preço acrescentado por reset percent = 10, ---- porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total) maxresets = 20, levelbyreset = 100 --- quanto de level vai precisar a mais no próximo reset } --- end config function getResets(uid) 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 creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid function addReset(cid) if(npcHandler:isFocused(cid)) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 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) local description = resets+1 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 .."") return true end 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 necessesario 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 sera disconectado 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()) Editado Agosto 28, 2023 1 ano por A.Mokk (veja o histórico de edições)
Postado Agosto 28, 2023 1 ano local config = { minlevel = 500, price = 100000000, newlevel = 20, priceByReset = 100000000, percent = 10, maxresets = 20, levelbyreset = 100, damagePercent = 5, -- Porcentagem de dano adicional após cada resets } function getResets(uid) 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 creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid function addReset(cid) if npcHandler:isFocused(cid) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 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 = hp - resethp doCreatureAddHealth(cid, -differencehp) -- Ajustar MP local mana = getCreatureMaxMana(cid) local resetmana = mana * (config.percent / 100) setCreatureMaxMana(cid, resetmana) local differencemana = mana - resetmana doCreatureAddMana(cid, -differencemana) -- Ajustar dano local damage = getCreatureDamage(cid) local additionalDamage = damage * (config.damagePercent / 100) local newDamage = damage + additionalDamage setCreatureDamage(cid, newDamage) doRemoveCreature(cid) local description = resets + 1 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 .. "") return true end 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()) nao testado!! Se não funcionar, você pode tentar outro aqui https://tibiaking.com/forums/topic/111239-reset-system-otx-2/?tab=comments#comment-573067 Editado Agosto 28, 2023 1 ano por GM Vortex (veja o histórico de edições)
Postado Agosto 29, 2023 1 ano Autor Em 28/08/2023 em 15:04, GM Vortex disse: local config = { minlevel = 500, price = 100000000, newlevel = 20, priceByReset = 100000000, percent = 10, maxresets = 20, levelbyreset = 100, damagePercent = 5, -- Porcentagem de dano adicional após cada resets } function getResets(uid) 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 creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid function addReset(cid) if npcHandler:isFocused(cid) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 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 = hp - resethp doCreatureAddHealth(cid, -differencehp) -- Ajustar MP local mana = getCreatureMaxMana(cid) local resetmana = mana * (config.percent / 100) setCreatureMaxMana(cid, resetmana) local differencemana = mana - resetmana doCreatureAddMana(cid, -differencemana) -- Ajustar dano local damage = getCreatureDamage(cid) local additionalDamage = damage * (config.damagePercent / 100) local newDamage = damage + additionalDamage setCreatureDamage(cid, newDamage) doRemoveCreature(cid) local description = resets + 1 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 .. "") return true end 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()) nao testado!! Se não funcionar, você pode tentar outro aqui https://tibiaking.com/forums/topic/111239-reset-system-otx-2/?tab=comments#comment-573067 Sempre eficiente e prestativo, obrigado mano, irei testar e retorno aqui se funcionar direitinho !
Postado Agosto 29, 2023 1 ano Autor Em 28/08/2023 em 15:04, GM Vortex disse: local config = { minlevel = 500, price = 100000000, newlevel = 20, priceByReset = 100000000, percent = 10, maxresets = 20, levelbyreset = 100, damagePercent = 5, -- Porcentagem de dano adicional após cada resets } function getResets(uid) 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 creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid function addReset(cid) if npcHandler:isFocused(cid) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 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 = hp - resethp doCreatureAddHealth(cid, -differencehp) -- Ajustar MP local mana = getCreatureMaxMana(cid) local resetmana = mana * (config.percent / 100) setCreatureMaxMana(cid, resetmana) local differencemana = mana - resetmana doCreatureAddMana(cid, -differencemana) -- Ajustar dano local damage = getCreatureDamage(cid) local additionalDamage = damage * (config.damagePercent / 100) local newDamage = damage + additionalDamage setCreatureDamage(cid, newDamage) doRemoveCreature(cid) local description = resets + 1 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 .. "") return true end 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()) nao testado!! Se não funcionar, você pode tentar outro aqui https://tibiaking.com/forums/topic/111239-reset-system-otx-2/?tab=comments#comment-573067 Acabei de testar aqui, ao tentar resetar ele nao desconectou como no NPC que mandei acima. Alem disso, o level se manteve mesmo resetando, o HP/MP resetou mas acho que nao acrescentou os 10%, ele abre uma caixa ao resetar falando que ganhou 5% a mais de dano mas tambem nao consegui notar essa diferença... Aparece um erro na distro ao tentar resetar [9:49:37.586] [Error - NpcScript Interface] [9:49:37.588] In a timer event called from: [9:49:37.589] data/npc/scripts/reseter.lua:onCreatureSay [9:49:37.590] Description: [9:49:37.591] data/npc/scripts/reseter.lua:61: attempt to call global 'getCreatureDamage' (a nil value) [9:49:37.595] stack traceback: [9:49:37.596] data/npc/scripts/reseter.lua:61: in function 'addReset' [9:49:37.597] data/npc/scripts/reseter.lua:95: in function <data/npc/scripts/reseter.lua:93> O outro script nao da nenhum erro ao iniciar a distro, mas ao logar ele da o seguinte erro : [10:6:56.230] [Error - CreatureScript Interface] [10:6:56.233] data/creaturescripts/scripts/reset_system.lua:onLogin [10:6:56.235] Description: [10:6:56.238] data/lib/reset.lua:68: attempt to call global 'getPlayerResets' (a nil value) [10:6:56.244] stack traceback: [10:6:56.247] data/lib/reset.lua:68: in function 'getCount' [10:6:56.249] data/lib/reset.lua:80: in function 'getInfo' [10:6:56.255] data/lib/reset.lua:84: in function 'addBonuses' [10:6:56.259] data/creaturescripts/scripts/reset_system.lua:2: in function <data/creaturescripts/scripts/reset_system.lua:1> Com esse acima, nao to conseguindo logar nos char EDIT 3# Consegui abrir os char baixando a sua pasta de libs porem o erro de manter o level ainda continua, notei que ao resetar ele nao ta acrescentando a vida e a mana, o dano eu nem cheguei a testar pois ao abrir com a sua pasta libs, varias outras coisas do ot pararam de pegar dai nem deslogar eu conseguia mas consegui "dar o reset" apesar do level se manter o mesmo. Editado Agosto 29, 2023 1 ano por A.Mokk (veja o histórico de edições)
Postado Agosto 30, 2023 1 ano Em 29/08/2023 em 12:57, A.Mokk disse: Acabei de testar aqui, ao tentar resetar ele nao desconectou como no NPC que mandei acima. Alem disso, o level se manteve mesmo resetando, o HP/MP resetou mas acho que nao acrescentou os 10%, ele abre uma caixa ao resetar falando que ganhou 5% a mais de dano mas tambem nao consegui notar essa diferença... Aparece um erro na distro ao tentar resetar [9:49:37.586] [Error - NpcScript Interface] [9:49:37.588] In a timer event called from: [9:49:37.589] data/npc/scripts/reseter.lua:onCreatureSay [9:49:37.590] Description: [9:49:37.591] data/npc/scripts/reseter.lua:61: attempt to call global 'getCreatureDamage' (a nil value) [9:49:37.595] stack traceback: [9:49:37.596] data/npc/scripts/reseter.lua:61: in function 'addReset' [9:49:37.597] data/npc/scripts/reseter.lua:95: in function <data/npc/scripts/reseter.lua:93> O outro script nao da nenhum erro ao iniciar a distro, mas ao logar ele da o seguinte erro : [10:6:56.230] [Error - CreatureScript Interface] [10:6:56.233] data/creaturescripts/scripts/reset_system.lua:onLogin [10:6:56.235] Description: [10:6:56.238] data/lib/reset.lua:68: attempt to call global 'getPlayerResets' (a nil value) [10:6:56.244] stack traceback: [10:6:56.247] data/lib/reset.lua:68: in function 'getCount' [10:6:56.249] data/lib/reset.lua:80: in function 'getInfo' [10:6:56.255] data/lib/reset.lua:84: in function 'addBonuses' [10:6:56.259] data/creaturescripts/scripts/reset_system.lua:2: in function <data/creaturescripts/scripts/reset_system.lua:1> Com esse acima, nao to conseguindo logar nos char EDIT 3# Consegui abrir os char baixando a sua pasta de libs porem o erro de manter o level ainda continua, notei que ao resetar ele nao ta acrescentando a vida e a mana, o dano eu nem cheguei a testar pois ao abrir com a sua pasta libs, varias outras coisas do ot pararam de pegar dai nem deslogar eu conseguia mas consegui "dar o reset" apesar do level se manter o mesmo. É só substituir nessa parte e fazer o teste. function addReset(cid) if npcHandler:isFocused(cid) then npcHandler:releaseFocus(cid) end talkState[talkUser] = 0 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 = hp - resethp doCreatureAddHealth(cid, -differencehp) -- Ajustar MP local mana = getCreatureMaxMana(cid) local resetmana = mana * (config.percent / 100) setCreatureMaxMana(cid, resetmana) local differencemana = mana - resetmana 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 doRemoveCreature(cid) local description = resets + 1 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 .. "") return true end Se der erro nessa parte "getCreatureDamage", tente fazer uma alteração aqui. local damage = creature.damage local additionalDamage = damage * (config.damagePercent / 100) local newDamage = damage + additionalDamage creature.damage = newDamage Editado Agosto 30, 2023 1 ano por GM Vortex (veja o histórico de edições)
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.