Well, easy to make but never saw one before so..
(data/npc/rizla.xml)
(data/npc/scripts/carpet.lua)
Not tested but well, enjoy.
Outfit is basic.
------------
Someone asked me this:
"This is only for one location right?
Able to say it so people can add various locations instead of a yes/no thing, like you can say "place1" or "place2" "
And here is the answer,
Yeah that would be possible also,
Just add another line and change the carpet to the name of the place like "Engima City" then change the cooördinates.
(data/npc/rizla.xml)
Code:
<npc name="Rizla" script="data/npc/scripts/carpet" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="129" head="114" body="119" legs="114" feet="114" lookaddon="3" corpse="2212"/>
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="message_greet" value="|PLAYERNAME|, How are you? Do wish to fly with me? Just say carpet!" />
</parameters>
</npc>
(data/npc/scripts/carpet.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({'carpet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to fly with me?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 8, cost = 50, destination = {x=100, y=1000, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'How should I know where the carpet takes us?'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
Not tested but well, enjoy.
Outfit is basic.
------------
Someone asked me this:
"This is only for one location right?
Able to say it so people can add various locations instead of a yes/no thing, like you can say "place1" or "place2" "
And here is the answer,
Yeah that would be possible also,
Just add another line and change the carpet to the name of the place like "Engima City" then change the cooördinates.
Code:
local travelNode = keywordHandler:addKeyword({'carpet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to fly with me?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 8, cost = 50, destination = {x=100, y=1000, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then not.'})