Hello! I wanted to make the NPC Lorek being able to travel to banuta/chor etc without having the task points. I am using canary if that information is any important for that.
local internalNpcName = "Lorek"
local npcType = Game.createNpcType(internalNpcName)
local npcConfig = {}
npcConfig.name = internalNpcName
npcConfig.description = internalNpcName
npcConfig.health = 100
npcConfig.maxHealth = npcConfig.health
npcConfig.walkInterval = 2000
npcConfig.walkRadius = 2
npcConfig.outfit = {
lookType = 132,
lookHead = 19,
lookBody = 10,
lookLegs = 38,
lookFeet = 95,
lookAddons = 0,
}
npcConfig.flags = {
floorchange = false,
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
npcType.onThink = function(npc, interval)
npcHandlernThink(npc, interval)
end
npcType.onAppear = function(npc, creature)
npcHandlernAppear(npc, creature)
end
npcType.onDisappear = function(npc, creature)
npcHandlernDisappear(npc, creature)
end
npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandlernMove(npc, creature, fromPosition, toPosition)
end
npcType.onSay = function(npc, creature, type, message)
npcHandlernSay(npc, creature, type, message)
end
npcType.onCloseChannel = function(npc, creature)
npcHandlernCloseChannel(npc, creature)
end
-- Travel
local function addTravelKeyword(keyword, text, cost, destination)
local travelKeyword = keywordHandler:addKeyword({ keyword }, StdModule.say, { npcHandler = npcHandler, text = "Do you seek a passage to " .. (text or keyword:titleCase()) .. " for |TRAVELCOST|?", cost = cost }, function(player)
return player:getPawAndFurRank() >= 3
end or nil)
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("west", "the west end of Port Hope", 7, Position(32558, 32780, 7))
addTravelKeyword("centre", "the centre of Port Hope", 7, Position(32628, 32771, 7))
addTravelKeyword("darama", nil, 30, Position(32987, 32729, 7))
addTravelKeyword("center", "the centre of Port Hope", 0, Position(32628, 32771, 7))
addTravelKeyword("chor", nil, 30, Position(32968, 32799, 7), true)
addTravelKeyword("banuta", nil, 30, Position(32826, 32631, 7), true)
addTravelKeyword("mountain", nil, 30, Position(32987, 32729, 7), true)
addTravelKeyword("mountain pass", nil, 30, Position(32987, 32729, 7), true)
-- Basic
keywordHandler:addKeyword({ "ferumbras" }, StdModule.say, { npcHandler = npcHandler, text = "I heard he is some scary magician or so." })
keywordHandler:addKeyword({ "passage" }, StdModule.say, { npcHandler = npcHandler, text = "I can travel you to west, centre, darama, chor or banuta." })
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)
-- npcType registering the npcConfig table
npcType:register(npcConfig)