DukeeH
Active Member
- Joined
- Dec 6, 2010
- Messages
- 550
- Solutions
- 3
- Reaction score
- 39
Hello,
I've made this function as a Rebirth:
Using TFS 0.3.7/OTX2.
But I was having problems that a guy rebirthed to level 17.
(I couldnt reproduce, I've tested it 20 times and it all worked okay to level 8.)
But then I've tried adding that until to see if it helps with level part, don't know if it's right, but I think worked.
But now a guy rebirth with wrong max hp (more than it should).
On my tests it worked normally.
How can i make sure that it don't fail?
I've test like 20 times and it worked, but sometimes the doPlayerAddLevel or the setCreatureMaxHealthbreaks.
Could you help me, or guide me in the right direction?
I've made this function as a Rebirth:
Using TFS 0.3.7/OTX2.
Lua:
function resetPlayer(cid)
if isSorcerer(cid) or isDruid(cid) then
HpBonus = 350
ManaBonus = 500
else
HpBonus = 500
ManaBonus = 350
end
doPlayerRemoveMoney(cid, 100000000)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
local ResetHp = 185 + (getCreatureStorage(cid, HpStorage)*HpBonus)
local ResetMana = 35 + (getCreatureStorage(cid, ManaStorage)*ManaBonus)
repeat
doPlayerAddLevel(cid, -(getPlayerLevel(cid) - 8))
setCreatureMaxHealth(cid, ResetHp)
setCreatureMaxMana(cid, ResetMana)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid), false)
doCreatureAddMana(cid, getCreatureMaxMana(cid), false)
until getPlayerLevel(cid) == 8
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Agora você tem " .. getCreatureStorage(cid, ResetsStorage) .. " " .. (getCreatureStorage(cid, ResetsStorage) == 1 and "reset" or "resets") .. ".\n\nReset Stats:\nHealth: +" .. getCreatureStorage(cid, HpStorage)*HpBonus .. " (" .. getCreatureStorage(cid, HpStorage) .. "x)\nMana: +" .. getCreatureStorage(cid, ManaStorage)*ManaBonus .. " (" .. getCreatureStorage(cid, ManaStorage) .. "x)\nDodge: " .. getPlayerStorageValue(cid, 48902) .. " (" .. getCreatureStorage(cid, DodgeStorage) .. "x)\nCritical: " .. getPlayerStorageValue(cid, 48901) .. " (" .. getCreatureStorage(cid, CriticalStorage) .. "x)\nPoints: " .. getAccountPoints(cid) .. " (" .. getCreatureStorage(cid, PointsStorage) .. "x).")
return true
end
But I was having problems that a guy rebirthed to level 17.
(I couldnt reproduce, I've tested it 20 times and it all worked okay to level 8.)
But then I've tried adding that until to see if it helps with level part, don't know if it's right, but I think worked.
But now a guy rebirth with wrong max hp (more than it should).
On my tests it worked normally.
How can i make sure that it don't fail?
I've test like 20 times and it worked, but sometimes the doPlayerAddLevel or the setCreatureMaxHealthbreaks.
Could you help me, or guide me in the right direction?