• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC [fixed] Forgotten Server Oracle!

Mokerhamer

Retired Global Mod
Senator
Joined
Aug 6, 2007
Messages
1,767
Reaction score
36
I know it's an very very very small fix but you need to do to in oreder to get it working in 0.2.5

here it goes


Oracle.xml
Code:
<npc name="The Oracle" script="data/npc/scripts/oracle.lua" autowalk="0" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look typeex="1448" corpse="2212"/>
    <parameters>
 
    </parameters>
</npc>

oracle.lua
Code:
local LEVEL = 8
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
 
function oracle(cid, message, keywords, parameters, node)
    if(cid ~= npcHandler.focus) then
        return false
    end
 
    local cityNode = node:getParent():getParent()
    local vocNode = node:getParent()
 
    local destination = cityNode:getParameters().destination
    local townid = cityNode:getParameters().townid
    local voc = vocNode:getParameters().voc
 
    if(destination ~= nil and voc ~= nil and townid ~= nil) then
        if(getPlayerLevel(cid) < parameters.level) then
            npcHandler:say('You must first reach level ' .. parameters.level .. '!')
        else
            doPlayerSetVocation(cid,voc)
            doPlayerSetTown(cid,townid)
            doTeleportThing(cid,destination,0)
        end
    else
        error('Destination:', destination, 'Vocation:', vocation, 'Townid:', townid)
    end
    npcHandler:resetNpc()
    return true
end
 
 
function greetCallback(cid)
    if(getPlayerLevel(cid) < LEVEL) then
        npcHandler:say('CHILD! COME BACK WHEN YOU HAVE GROWN UP!')
        return false
    else
        return true
    end
end
 
-- Set the greeting callback function
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
-- Set the greeting message.
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Are you prepared to face your destiny?')
 
-- Pre-create the yes/no nodes.
local yesNode = KeywordNode:new({'yes'}, oracle, {level = LEVEL})
local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what vocation do you want to become?'})
 
-- Create the actual keyword structure...
local node1 = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'What city do you wish to live in? Derelin or Drunia?'})
    local node2 = node1:addChildKeyword({'derelin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 3, destination = {x=1330, y=368, z=7}, text = 'The desert city of Derelin, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
        local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
 
    local node2 = node1:addChildKeyword({'drunia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 1, destination = {x=939, y=263, z=7}, text = 'The town of Drunia, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
        local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
 
keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then come back when you are ready.'})
 
-- Make it react to hi/bye etc.
npcHandler:addModule(FocusModule:new())
 
Last edited by a moderator:
Thanks again
you ever with nice works

Yea but i'm going to stop if people keep removing my rep, then i wont release anything i'v load of codes i'm going to release over time.. but it's gone stop if the keep removing rep
 
how to edit?, maybe add custom vocations?


Code:
		local node3 = node2:addChildKeyword({'[COLOR="Red"]VOC[/COLOR]'}, StdModule.say, {npcHandler = npcHandler, voc = [COLOR="Red"]4[/COLOR], onlyFocus = true, text = '[COLOR="Red"]A mighty warrior. Is that your final decision? This decision is irreversible![/COLOR]'})
			node3:addChildKeywordNode(yesNode)
			node3:addChildKeywordNode(noNode)

the red part is what u need to change, but dont forget to add it 2 times
 
thank you =D, how to do that oracle only give you to choose the vocation, because i only want to teleport all players to one town
 
Last edited:
thank you =D, how to do that oracle only give you to choose the vocation, because i only want to teleport all players to one town

it is possible it will take time, but dont u think it's bether just to give them an "choise" only togo to 1 town?
 
Ok, so I added the oracle into my forgotten v0.2.9 and it has a small error..

18:55 The Oracle: Hello PLayer. Are you prepared to face your destiny?
18:55 Player [8]: yes
18:55 The Oracle: What city do you wish to live in? Derelin or Drunia?
18:55 Player [8]: Drunia
18:55 The Oracle: The town of Drunia, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?
18:55 Player [8]: sorcerer
18:55 The Oracle: So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!
18:55 Player [8]: yes
18:55 The Oracle: What city do you wish to live in? Derelin or Drunia?
18:55 Player [8]: ....
 
Perfect, but, if you do & thing could be better,
when player say "yes" to go to the city, you could add the teleport affect.
Im allready ussing.
 
The teleport effect would make this awesome!
 
Last edited:
Back
Top Bottom