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

Help rebirth

Death-Pulse

Owner of Death-Pulse
Joined
May 10, 2014
Messages
100
Reaction score
0
Useing 0.3.6 8.6

My players only see level 0 rebirths with onlook and the !reborn and they arnt 0 rebirth

Heres my scripts

Npc
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Para Reborn" script="reborn.lua" walkinterval="0" floorchange="0">
    <health now="100" max="100"/>
    <look typeex="1449"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to {reborn}?!"/>
        <parameter key="message_farewell" value="Cya later!"/>
    </parameters>
</npc>

SCRIPTS OF NPC

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 = 175
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())

Creaturescripts
Code:
  <event type="look" name="rebirth" event="script" value="rebirth.lua"/>

-------

local storage = 2500 -- same as in rebirth npc

function onLook(cid, thing, position, lookDistance)
    if not isPlayer(thing.uid) then
        return true
    end

    doPlayerSetSpecialDescription(thing.uid, '. Done rebirths: ' .. math.max(0, getCreatureStorage(thing.uid, storage)))
    return true
end

Talkaction

Code:
<talkaction log="yes" words="!reborn;/reborn;!reborns" access="0" event="script" value="rebirth.lua"/>

-------
local storage = 2500 -- same as in rebirth.lua

function onSay(cid, words, param)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You done ' .. math.max(0, getCreatureStorage(cid, storage)) .. ' rebirths.')  
    return true
end

Login
Code:
    registerCreatureEvent(cid, "rebirth")
 
Well ok it works. When someone rebirths it shows it. But its not their rebirth. I have someone thats rebirth 160 and it shows he done 18 because i just added it how can i make it get everyones current rebirths
 
Last edited:
Back
Top