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

Reborn 8.6 script

Death-Pulse

Owner of Death-Pulse
Joined
May 10, 2014
Messages
100
Reaction score
0
I am having issues with my reborn script

When a player reaches 200 reborn is basicly gives them 0/0 mana and hp now i want my reborn to atleast reach 1k because of the stuff that added extra for the higher rebirths so there will be a point of the game..

Everything is the npc script looks fine and it was added when i got the server
0-199 works just fine but then u hit that 200 and u basicly cant use spells u cant do ANYTHING

I need some advice on fixing this issue or atleast some help heres my creature script

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

local reborn = 2500 -- free storage
local spellReborn = {
    [1] = 'Reborn1',
    [5] = 'Reborn5',
    [10] = 'Reborn10',
    [25] = 'Reborn25',
    [50] = 'Reborn50',
    [100] = 'Reborn100',
    [250] = 'Reborn250',
    [500] = 'Reborn500'
}
local level = 717217
local maxReborns =1000
local toLevel = 100

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 greetCallback(cid)
    Topic[cid] = nil
    return true
end

function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    elseif Topic[cid] then
        if msgcontains(msg, 'yes') then
            if getCreatureStorage(cid, reborn) < maxReborns then
                doCreatureSetStorage(cid, reborn, math.max(0, getCreatureStorage(cid, reborn)) + 1)
                for k, v in pairs(spellReborn) do
                    if getCreatureStorage(cid, reborn) == k then
                        doPlayerLearnInstantSpell(cid, v)
                        doSendMagicEffect(getThingPosition(cid), CONST_ME_FIREWORK_RED)
                        break
                    end
                end
               
                local g = getPlayerGUID(cid)
                npcHandler:releaseFocus(cid)
                doRemoveCreature(cid)
                db.executeQuery('UPDATE players SET level=99,experience=15219400 WHERE id=' .. g)
            else
                npcHandler:say('You reached maximum amount of reborns.', cid)
            end
        else
            npcHandler:say('Maybe next time.', cid)
        end
        Topic[cid] = nil
    else
        if msgcontains(msg, 'reborn') then
            if getPlayerLevel(cid) >= level then
                npcHandler:say('Are you sure that you want to make reborn?',cid)
                Topic[cid] = 1
            else
                npcHandler:say('You don\'t have enough level. ['..level..']',cid)
                Topic[cid] = nil
            end
        end
    end
    return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
I diden't really read the code tbh but im pretty sure its the same problem as with all other hexp servers.
What you need to do is check how much hp/mana/exp the player has and if its over 2147483647 you need to return a diffrent value due to that your computer can't handle bigger integers then that.
There are some diffrent fixes one is to just not return any higher value then that, the other is to take the player hp, mana, exp etc and return ex insted of 1000, 1k.
 
Back
Top