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

OTX 3.7 Rebirth with Onlook

athenso

Average Coder
Joined
May 31, 2011
Messages
155
Solutions
3
Reaction score
23
NPC Script:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local function greetCallback(cid)
    local player = Player(cid)
    local msg = 'Be welcome, ' .. player:getName() .. '.'
    local level = player:getLevel()
    local req = 399
    npcHandler:say(msg,cid)
    npcHandler:addFocus(cid)
    return false
end
local function rebirth(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
  
    local player = Player(cid)
    local level = player:getLevel()
    local req = 399
    local creature = Player(cid)
    local guid = player:getGuid()
    if level > req then
        player:setStorageValue(85987, player:getStorageValue(85987) == -1 and 1 or player:getStorageValue(85987) + 1)
        creature:remove()
        db.query("UPDATE `players` SET `level` = 8, `experience` = 4200 WHERE `id` = " .. guid)
               
    else
        npcHandler:say('You are not level 400, BEGONE!', cid)
        keywordHandler:moveUp(2)
    end
    return true
end

keywordHandler:addKeyword({'rebirth'}, rebirth, {})
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:addModule(FocusModule:new())


Npc File:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Wiseman" script="wiseman.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100" />
    <look type="512" head="114" body="19" legs="95" feet="77" addons="3"/>
</npc>

Those are the files needed to do the rebirth in my server. I have seen people request an Onlook event/function. I made on for that :)


Events folder -> Scripts -> player.lua

Under function Player: onLook(thing, position, distance) add
Code:
-- Reborn look by Athenso
     if thing:isCreature() and thing:isPlayer() then
     local reborn = thing:getStorageValue(85987)
        if reborn <= 0 then
            description = string.format("%s\n [Rebirths Done]: %s", description, 0)
        else
        description = string.format("%s\n [Rebirths Done]: %s", description, reborn)
    end
end

Your welcome
 
Should also work on TFS 1.0+. I can't edit the original post
 
OTX its sucks , its better TFS 1.2 or 1.3
Have you gone over the sources for OTX? Probably not because then you would be saying that OTX its source looks very much similar to TFS 1.2/3 but has all this extra code and features and also TFS is maintained by otland and its members whereas OTX is maintained by a number of different people and affiliations. It's code is also interchangeable with any of its other distributions which range from 8.6 to 11.49.

So to just say it sucks without giving any real reason is kind of childish.
 
Otx is a fuking copy Code

If you don't like it, don't use it. This script should still be useable on TFS 1.0+ as I used core functions to execute everything. Don't flame the source. This is a script thread not a source thread.
 
Back
Top