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

The Oracle Need some Help

vincent1

New Member
Joined
Aug 19, 2013
Messages
44
Reaction score
2
hi.... i edited Theoracle.lua script with this:
But when i log in to the game, all the npc will reacte to this script...

Code:
local LEVEL = 8

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState = {}
local vocation = {}
local rook = {x=227, y=84, z=4}

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)
    if(getPlayerLevel(cid) < LEVEL) then
        npcHandler:say('CHILD! COME BACK WHEN YOU HAVE GROWN UP!', cid)
        return false
    elseif getPlayerVocation(cid) > 0 then
                npcHandler:say("YOU ALREADY HAVE A VOCATION!", cid)
                return false
        else
                local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
                talkState[talkUser] = 0
        return true
    end
end

function creatureSayCallback(cid, type, msg)

        if(not npcHandler:isFocused(cid)) then
                return false
        end
    
        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
        if msgcontains(msg, 'yes') and talkState[talkUser] == 0 then
                if isPremium(cid) == TRUE then
                        npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
                else
                        npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
                end
                talkState[talkUser] = 2
        elseif talkState[talkUser] == 0 then
                npcHandler:unGreet(cid)

        elseif msgcontains(msg, 'sorcerer') and talkState[talkUser] == 2 then
                npcHandler:say("A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
                talkState[talkUser] = 3
                vocation[talkUser] = 1
        elseif msgcontains(msg, 'druid') and talkState[talkUser] == 2 then
                npcHandler:say("A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
                talkState[talkUser] = 3
                vocation[talkUser] = 2
        elseif msgcontains(msg, 'paladin') and talkState[talkUser] == 2 then
                npcHandler:say("A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
                talkState[talkUser] = 3
                vocation[talkUser] = 3
        elseif msgcontains(msg, 'knight') and talkState[talkUser] == 2 then
                npcHandler:say("A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
                talkState[talkUser] = 3
                vocation[talkUser] = 4
        elseif talkState[talkUser] == 2 then
                npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
                talkState[talkUser] = 2
        elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
                npcHandler:say("SO BE IT!", cid)
                talkState[talkUser] = 0
                doPlayerSetVocation(cid, vocation[talkUser])
                npcHandler:releaseFocus(cid)
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
                doTeleportThing(cid, rook)
                doSendMagicEffect(rook, CONST_ME_TELEPORT)
        elseif talkState[talkUser] == 3 then
                npcHandler:unGreet(cid)
        end
        return TRUE
end

npcHandler:setMessage(MESSAGE_GREET, '|PLAYERNAME|, ARE YOU PREPARED TO FACE YOUR DESTINY?')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!')
npcHandler:setMessage(MESSAGE_FAREWELL, 'COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!')

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top