• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Oracle (without voc and town chose)

merfus

Member
Joined
Dec 27, 2011
Messages
214
Reaction score
5
Location
Poland
Hi i need a NPC (Oracle?) Who just send player to other Town and set new temple ID when he write to him.

Player > Hi
NPC > Hi, do you want to leave rookgard?
Player > Yes (NPC now sens player to other town and change him temple)
 
just edit this boat npc script
data/npc/bluebear.lua
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="bluebear" script="data/npc/scripts/Carlinboat.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="19" body="69" legs="107" feet="50" addons="0"/>
<voices>
<voice text="Passages to {Carlin}." interval2="100" margin="1" yell="no"/>
</voices>
<parameters>
<parameter key="message_farewell" value="Good bye. Recommend us if you were satisfied with our service." />
<parameter key="message_walkaway" value="Good bye. Recommend us if you were satisfied with our service." />
 <parameter key="module_keywords" value="1" />
 <parameter key="keywords" value="name;thais;darashia;" />
 <parameter key="keyword_reply1" value="My name is Captain Bluebear from the Royal Tibia Line." />
 <parameter key="keyword_reply2" value="This is Thais. Where do you want to go?" />
 <parameter key="keyword_reply3" value="I'm not sailing there. This route is afflicted by a ghost ship! However, I heard that Captain Fearless sails there from Venore." />
 <parameter key="message_greet" value="Welcome on board, |PLAYERNAME|. Where may I sail you today?"/>
</parameters>
</npc>
data/npc/scripts/Carlinboat.lua
Code:
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
        
        
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
        local travelNode = keywordHandler:addKeyword({'carlin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Carlin for free?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32387, y=31820, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

        keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Where do you want to go? To Carlin?.'})
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
		keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
       

        npcHandler:addModule(FocusModule:new())
 
i do it better ;d

if someone need:

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local temple = {x=1031,y=1022,z=7} -- temple position
 
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 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, "leave")) then
            doPlayerSetTown(cid, 2) -- new town
            doTeleportThing (cid, temple, TRUE)
			npcHandler:say("Welcome! It's You're new Home", cid)
        end

 

return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top