• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Creating Captain Kurt for Desinty Island

Schwarzbeere

BraveOnline Developer
Joined
Feb 16, 2017
Messages
68
Reaction score
3
Location
Germany
Just got erros.. :'(
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic, Town = {}, {}
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 function creatureSayCallback (cid, type, msg)
    if not npcHandler:isFocused(cid) then
    return false
    end
   
    local player = Player(cid)
    if msgcontains(msg, "hello") or msgcontains(msg, "hi")
        if player:getVocation(cid) == 0 then
            npc Handler:say({
            "Well hello there! Can't sail you anywhere without a {vocation}, though. Y'should talk to the four vocation {masters} first."
            }, cid)
            npcHandler.topic[cid] = 0
        else
            then npc Handler:say({
            "Harrr, a new adventurer! Can't wait to get off this lousy island and head for adventure, eh?"
            }, cid)
            npcHandler.topic[cid] = 1
        end
   
    elseif npcHandler.topic[cid] = 1
         local function addTravelKeyword(keyword, cost, destination, action)
            local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want to live in ' .. keyword:titleCase() .. '?', cost = cost})
                    travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, cost = cost, destination = destination}, nil, action)
                    travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
    end
end

addTravelKeyword('carlin', 0, Position(32387, 31820, 6))
addTravelKeyword('ab\'dendriel', 0, Position(32734, 31668, 6))
addTravelKeyword('edron', 0, Position(33175, 31764, 6))
addTravelKeyword('venore', 0, Position(32954, 32022, 6))
-- addTravelKeyword('port hope', 160, Position(32527, 32784, 6))
-- addTravelKeyword('roshamuul', 210, Position(33494, 32567, 7))
-- addTravelKeyword('svargrond', 180, Position(32341, 31108, 6))
-- addTravelKeyword('liberty bay', 180, Position(32285, 32892, 6))
-- addTravelKeyword('yalahar', 200, Position(32816, 31272, 6))
npcHandler:setMessage(MESSAGE_GREET, 'Welcome on board, |PLAYERNAME|. Where can I {sail} you today?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye. Recommend us if you were satisfied with our service.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')

npcHandler:addModule(FocusModule:new())
 
If you have errors, always post the errors, screenshot or even copy and paste will do but put the errors in code tags.
 
Back
Top