peteralto
Member
- Joined
- Nov 1, 2020
- Messages
- 93
- Solutions
- 1
- Reaction score
- 19
Hey guys.
For me to travel by boat I need to follow these steps: HI - CITY - YES.
But I would like it to be possible to also use: CITY - YES without 'HI'.
Example of a NPC file:
For me to travel by boat I need to follow these steps: HI - CITY - YES.
But I would like it to be possible to also use: CITY - YES without 'HI'.
Example of a NPC file:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
-- Travel
local function addTravelKeyword(keyword, cost, destination)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to the ' .. keyword .. ' end for |TRAVELCOST|?', cost = cost})
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, cost = cost, destination = destination})
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Maybe another time.', reset = true})
end
addTravelKeyword('east', 7, Position(32679, 32777, 7))
addTravelKeyword('west', 7, Position(32558, 32780, 7))
-- Basic
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'I can bring you to the {East} of Port Hope or to the {West} of the town. Where would you like to go?'})
npcHandler:addModule(FocusModule:new())