Glidarn
Member
Found another problem, been looking for the correct query but didnt find it
http://img3.imageshack.us/i/houselists.png/
http://img3.imageshack.us/i/houselists.png/
Last edited:
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 t = {
{'Thais', {x=32310, y=32210, z=6}},
{'Goroma', {x=31993, y=32564, z=6}},
{'Calassa', {x=31747, y=32720, z=12}},
{'Venore', {x=32952, y=32022, z=6}},
{'Darashia', {x=33289, y=32480, z=6}},
{'Ankrahmun', {x=33092, y=32883, z=6}},
{'Yalahar', {x=601, y=669, z=6}},
{'passage', 'I can take you to Yalahar, Thais, Venore, Ankrahmun, Darashia and Goroma.'},
{'job', 'I am the captain of this ship.'},
{'travel', 'I can only offer you a trip to Yalahar, Thais, Venore, Ankrahmun, Darashia and Goroma.'}
}
for i = 1, #t do
local v = t[i]
if type(v[2]) == 'table' then
local k = keywordHandler:addKeyword({v[1]:lower()}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to ' .. v[1] .. ' for 0 gold coins?'})
k:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = v[2]})
k:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
else
keywordHandler:addKeyword({v[1]}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = v[2]})
end
end
t = nil
npcHandler:addModule(FocusModule:new())
function onSay(cid, words, param, channel)
local func = doCreateMonster
if(words:sub(2, 2) == "n") then
func = doCreateNpc
end
local pid = cid
local t = string.explode(param, ",")
if(t[2]) then
pid = getPlayerByNameWildcard(t[2])
if(not pid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
return true
end
end
local position = getCreaturePosition(pid)
local effect = CONST_ME_MAGIC_RED
local ret = func(t[1], position, false)
if(tonumber(ret) == nil) then
effect = CONST_ME_POFF
doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
end
doSendMagicEffect(position, effect)
return true
end