• 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!

Lua How Add/AUTO REBIRTH IS AUTOMATIC!

Gaber Zen

Well-Known Member
Joined
Apr 22, 2023
Messages
224
Reaction score
51
Location
Egypt
How do I turn on the Restore Personal Receipt
Player Used Spells like !reset From talkactions, But in Automatic
Because every 1000 levels you need a new appointment
Because the players gain experience above the appointment
i want AUTO REBIRTH IS AUTOMATIC!
Is there someone help me
function onSay(cid, words, param, channel)
if (param:lower() == "info") then
local message = "~~~~~~~~~~Reset Infos ~~~~~~~~~~\n"
local resetsCount = ResetSystem:getCount(cid)
message = message .. "\nNْmero de Resets: " .. resetsCount .. "."

local level = getPlayerLevel(cid)
local vocationInfo = getVocationInfo(getPlayerVocation(cid))
local baseHealth, extraHealth
local baseMana, extraMana
local resetBonus = ResetSystem:getCurrentBonus(cid)
if (resetBonus and vocationInfo) then
baseHealth = vocationInfo.healthGain * level
extraHealth = getCreatureMaxHealth(cid) - baseHealth
baseMana = vocationInfo.manaGain * level
extraMana = getCreatureMaxMana(cid) - baseMana
else
baseHealth, extraHealth = getCreatureMaxHealth(cid), 0
baseMana, extraMana = getCreatureMaxMana(cid), 0
end

message = message .. "\nVida normal: " .. baseHealth .. " + " .. extraHealth .. "."
message = message .. "\nMana normal: " .. baseMana .. " + " .. extraMana .. "."
message = message .. "\nExp Stage Bonْs: " .. getExperienceStage(level) .. "x + " .. ((resetBonus and resetBonus.experiencePercent) or "0") .. "%."
message = message .. "\nDamage Bonْs: " .. ((resetBonus and resetBonus.damagePercent) or "0") .. "%."
message = message .. "\nProximo Reset: Lv" .. (resetsCount < ResetSystem.max_count and ((resetsCount + 1) * ResetSystem.needed_level_per_reset) or "0") .. "."
doShowTextDialog(cid, 8983, message)
else

local resetsCount = ResetSystem:getCount(cid)
if (resetsCount >= ResetSystem.max_count) then
doPlayerSendCancel(cid, "Você jل atingiu o nيvel mلximo de resets.")
return true
end

local levelNeeded = (resetsCount + 1) * ResetSystem.needed_level_per_reset
if (levelNeeded > getPlayerLevel(cid)) then
doPlayerSendCancel(cid, "Você precisa ser level " .. levelNeeded .. " ou maior.")
return true
end

ResetSystem:execute(cid)
end
return true
end
 
Last edited:
after 1000 level player get (reset) like 1000 reset/2000 reset/3000 reset/4000 reset 5000 reset to up 717000 is 717 reset max, everytime up level 1k up reset
01:41 Você efetuou seu 1° reset.
+2.5% de dano
+5% de vida e mana
+10% de EXP
01:41 Você efetuou seu 2° reset.
+5% de dano
+10% de vida e mana
+20% de EXP
player reset, no logout, no temple, he is stay in place
Back level 100 with out hp/mp
i use Tfs 1.2
tibia Clinet 8.60
i want AUTO Reset IS AUTOMATIC!
ResetSystem = {
storage = 14335,

back_to_level = 100,
needed_level_per_reset = 1000,
max_count = 1000,

bonus_per_reset = {
experiencePercent = 10,
damagePercent = 2.5,
healthAndManaGainPercent = 5
}
}

function ResetSystem:getCount(pid)
return math.max(0, (tonumber(getCreatureStorage(pid, self.storage)) or 0))
end

function ResetSystem:setCount(pid, count)
doCreatureSetStorage(pid, self.storage, count)
db.executeQuery("UPDATE players SET reset = '"..count.."' WHERE id = '"..getPlayerGUID(pid).."';")
end

function ResetSystem:addCount(pid)
db.executeQuery("UPDATE players SET reset = '".. (self:getCount(pid) + 1) .."' WHERE id = '"..getPlayerGUID(pid).."';")
self:setCount(pid, self:getCount(pid) + 1)
end

function ResetSystem:getCurrentBonus(pid)
local resets = math.min(self:getCount(pid), self.max_count)
if (resets > 0) then
local currentBonus = {}
for bonus, value in pairs(self.bonus_per_reset) do
currentBonus[bonus] = value * resets
end
return currentBonus
end
return nil
end

function ResetSystem:applyBonuses(pid)
local bonus = self:getCurrentBonus(pid)
if (bonus and bonus.damagePercent) then
setPlayerDamageMultiplier(pid, 1.0 + (bonus.damagePercent / 100.0))
else
setPlayerDamageMultiplier(pid, 1.0)
end
end

function ResetSystem:updateHealthAndMana(pid)
local bonus = self:getCurrentBonus(pid)
if (bonus and bonus.healthAndManaGainPercent) then
local vocationInfo = getVocationInfo(getPlayerVocation(pid))
if (vocationInfo) then
local oldMaxHealth = getCreatureMaxHealth(pid)
local oldMaxMana = getCreatureMaxMana(pid)

local level = getPlayerLevel(pid)
local totalHealth = (vocationInfo.healthGain * level)
local totalMana = (vocationInfo.manaGain * level)

local newMaxHealth = math.floor(totalHealth + (totalHealth * (bonus.healthAndManaGainPercent / 100)))
local newMaxMana = math.floor(totalMana + (totalMana * (bonus.healthAndManaGainPercent / 100)))
setCreatureMaxHealth(pid, newMaxHealth)
setCreatureMaxMana(pid, newMaxMana)

if (newMaxHealth > oldMaxHealth) then
doCreatureAddHealth(pid, newMaxHealth - oldMaxHealth)
elseif (newMaxHealth < oldMaxHealth) then
doCreatureAddHealth(pid, 1) -- evita barra bugada
end

if (newMaxMana > oldMaxMana) then
doCreatureAddMana(pid, newMaxMana - oldMaxMana)
elseif (newMaxMana < oldMaxMana) then
doCreatureAddMana(pid, 1)
end
end
end
end

function ResetSystem:execute(pid)
self:addCount(pid)
local playerLevel = getPlayerLevel(pid)
if (playerLevel > self.back_to_level) then
doPlayerAddExperience(pid, getExperienceForLevel(self.back_to_level) - getPlayerExperience(pid))
playerLevel = self.back_to_level
end

self:applyBonuses(pid)
self:updateHealthAndMana(pid)
local bonus = self:getCurrentBonus(pid)
if (bonus) then
local message = "Você efetuou seu " .. self:getCount(pid) .. "° reset."
if (bonus.damagePercent) then
message = message .. "\n+" .. bonus.damagePercent .. "% de dano"
end

if (bonus.healthAndManaGainPercent) then
message = message .. "\n+" .. bonus.healthAndManaGainPercent .. "% de vida e mana"
local vocationInfo = getVocationInfo(getPlayerVocation(pid))
if (vocationInfo) then
local healthAndManaMultiplier = 1.0 + (bonus.healthAndManaGainPercent / 100.0)
local healthBonusSum = (vocationInfo.healthGain * playerLevel) * healthAndManaMultiplier
local manaBonusSum = (vocationInfo.manaGain * playerLevel) * healthAndManaMultiplier
setCreatureMaxHealth(pid, healthBonusSum)
setCreatureMaxMana(pid, manaBonusSum)
doCreatureAddHealth(pid, healthBonusSum)
doCreatureAddMana(pid, manaBonusSum)
end
end

if (bonus.experiencePercent) then
message = message .. "\n+" .. bonus.experiencePercent .. "% de EXP"
end

doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, message)
end
end
 
Last edited:
after 1000 level player get (reset) like 1000 reset/2000 reset/3000 reset/4000 reset 5000 reset to up 717000 is 717 reset max, everytime up level 1k up reset
01:41 Você efetuou seu 1° reset.
+2.5% de dano
+5% de vida e mana
+10% de EXP
01:41 Você efetuou seu 2° reset.
+5% de dano
+10% de vida e mana
+20% de EXP
player reset, no logout, no temple, he is stay in place
Back level 100 with out hp/mp
i use Tfs 1.2
tibia Clinet 8.60
i want AUTO Reset IS AUTOMATIC!
I think this automatic reset system is a bit complicated because it is TFS 1.2 8.6, if it were 1.5 nekiro then yes, maybe someone can help you... why not use npc to reset?
I also use tfs 1.2 downgrage... I only use npc that has worked better and these links hug!
 
I`m have npc/commands.
Need to Auto, player get more exp then reset, everytime player up level get more Power % from Reset
i can`t stop exp, but auto will be stop that, player have 50 reset and get 300k+/ supposed Reset 50=50k.
Some ots Add auto Reset You can check High-exp >in otservlist
 
Last edited:
how i can add auto rebith?
anyone help?
try to use google translate and write precisely what you want.

Don't do things like "How can I add Auto Rebith?", even if it sounds easy in your mind, we can't help without knowing what you want precisely, after all, we can imagine 1.000 ways to do this, but that form may not be the one you want
 
I described the problem fully with the script
Every time I exceed 1000 levels, you take a reset
ok, but for exemple

You are level 999, then gets 1000, then reset? ok, if yes, reset to level 1? or dont?

Then, you want to add the following bonus:
+2.5% de dano
+5% de vida e mana
+10% de EXP

and reset after reset, the bonus is used as the basis of the top described x the number of resets, 3 resets = 3x 2.5% damage
 

mano368

ResetSystem = {
storage = 14335,
back_to_level = 100,
needed_level_per_reset = 1000,
max_count = 1000,
bonus_per_reset = {
experiencePercent = 10,
damagePercent = 2.5,
healthAndManaGainPercent = 5

Join my server To can Test please
Ip:angel-high.ddns.net
 
Last edited:
Modify the player.lua to reset to level 1, everytime it reach 1000.
Lua:
local config = {
heal = true,
save = true,
effect = false,
save_exhaust_time = 10, -- in minutes
hp_increase = 10, -- amount of max health increase on level up
mp_increase = 10 -- amount of max mana increase on level up
}

save_exhaust = save_exhaust or {}

function onAdvance(player, skill, oldLevel, newLevel)
if skill ~= SKILL_LEVEL or newLevel <= oldLevel then
return true
end

if config.effect then
    player:getPosition():sendMagicEffect(math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
    player:say('LEVEL UP!', TALKTYPE_MONSTER_SAY)
end

if config.heal then
    player:addHealth(player:getMaxHealth())
    player:addMana(player:getMaxMana())
end

if config.save then
    local time = os.date()
    if not save_exhaust[player.uid] or save_exhaust[player.uid] <= time then
        player:save()
        save_exhaust[player.uid] = time + (config.save_exhaust_time * 60)
    end
end

if newLevel >= 1000 then
    player:setLevel(1)
    player:setMaxHealth(player:getMaxHealth() + config.hp_increase)
    player:setMaxMana(player:getMaxMana() + config.mp_increase)
end

return true
end
 
So use the code I sent in your topic!
It will check everytime the player advance level,
if player reach level 1000+, will set player level 1 with hp and mana base + extra hp and mana.
 
Back
Top