Witam mam pytanie jak zrobi? ?eby capitan cookie teleportowa? wsz?dzie nie tylko do liberty bay. I ?eby npc wymieni? miasta do kt?rych chcesz teleportowa? si?. Oto skrypt do Capitana Cookie.
A skrypt boat_yalahar2.lua wygl?da tak.
Code:
<?xml version="1.0" encoding="UTF-8" ?>
- <npc name="Captain Cookie" script="data/npc/scripts/TP/boat_yalahar2.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100" />
<look type="96" head="0" body="0" legs="0" feet="0" addons="0" />
- <parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|." />
<parameter key="message_farewell" value="Good bye." />
<parameter key="message_walkaway" value="Farewell then.." />
</parameters>
</npc>
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({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail back to Liberty Bay for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32299, y=32896, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
keywordHandler:addKeyword({'yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I travelled here, hoping to find the cockaigne. Imagine my disappointment when I discovered I was wrong.'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())