danielouz
New Member
- Joined
- Dec 27, 2014
- Messages
- 28
- Reaction score
- 1
Hello,
I'm looking for a simple code to add to my boat npc. I am a very bad scripter and tried to add it by myself but it didn't work
If player says hi then outfit, npc respond he need 5x of an item and he will give outfit
if player have 5x of an item he will receive an outfit
my boat npc script looks like this (if its going to help)
I'm looking for a simple code to add to my boat npc. I am a very bad scripter and tried to add it by myself but it didn't work
If player says hi then outfit, npc respond he need 5x of an item and he will give outfit
if player have 5x of an item he will receive an outfit
my boat npc script looks like this (if its going to help)
Code:
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
local voices = { {text = 'ARRRRRRRRRR...'} }
npcHandler:addModule(VoiceModule:new(voices))
-- Travel
local function addTravelKeyword(keyword, cost, destination, action)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'})
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, cost = cost, discount = 'postman', destination = destination}, nil, action)
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'Then no.', reset = true})
end
addTravelKeyword('buccaner', 500, Position(840, 285, 6))
addTravelKeyword('meriana', 500, Position(853, 257, 7))
addTravelKeyword('nargor', 500, Position(891, 315, 7))
addTravelKeyword('back', 500, Position(734, 460, 6))
-- Kick
--keywordHandler:addKeyword({'kick'}, StdModule.kick, {npcHandler = npcHandler, destination = {Position(32320, 32219, 6), Position(32321, 32210, 6)}})
-- Basic
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = 'My name is Captain Jones!'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I am a pirate!'})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this sailing-ship.'})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Buccaner\'s Refuge}, {Meriana}, {Nargor} or go {back}?'})
keywordHandler:addKeyword({'route'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Buccaner\'s Refuge}, {Meriana}, {Nargor} or go {back}?'})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Buccaner\'s Refuge}, {Meriana}, {Nargor} or go {back}?'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Buccaner\'s Refuge}, {Meriana}, {Nargor} or go {back}?'})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Buccaner\'s Refuge}, {Meriana}, {Nargor} or go {back}?'})
keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Buccaner\'s Refuge}, {Meriana}, {Nargor} or go {back}?'})
npcHandler:setMessage(MESSAGE_GREET, 'Arrrr..., Welcome on board, |PLAYERNAME|. Where can I {sail} you today?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Arrrr..., Good bye.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')
npcHandler:addModule(FocusModule:new())