• 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!

NPC Travel ( need help )

kirbywar3

New Member
Joined
Nov 8, 2010
Messages
7
Reaction score
0
Hello all, I wish someone can help me with the NPC's travel so they just teleport the player if he is inside the boat.
For example, if the player is of pz it can not be teleported.
now, grateful
sorry for my English ...

edit:

PLEEEEEEEEEASE SOMEOOOONE help me ;( not working

thanks it works

function greetCallback(cid)
if(isPlayerPzLocked(cid)) then
selfSay("Go away with these blood!", cid)
return false
else
return true
end
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)

rep ++ u :&
 
Last edited:
Try that after the 'elseifs' and before the 'ends'

Lua:
elseif msgcontains(msg, 'hi') and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then 
  selfSay('Come back when you have those bloody swords off!')
  talk_start = 0
 
don't work :(
look the script
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

elseif msgcontains(msg, 'hi') and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
selfSay('Come back when you have those bloody swords off!')
talk_start = 0

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'fish'}, 2667, 5, 'fish')


-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Edron for 20 gold coins ?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 20, destination = {x=33175, y=31764, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, premium = true, reset = true, text = 'Next time maybe.'})


local travelNode = keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Eremo island for 20 gold coins ?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 20, destination = {x=33318, y=31882, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, premium = true, reset = true, text = 'Next time maybe.'})


keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can travel you to {eremo} island and {edron} city, where you want go ?'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
 
Last edited:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)


-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'fish'}, 2667, 5, 'fish')


-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!

local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Edron for 20 gold coins ?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 20, destination = {x=33175, y=31764, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, premium = true, reset = true, text = 'Next time maybe.'})


local travelNode = keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Eremo island for 20 gold coins ?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 20, destination = {x=33318, y=31882, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, premium = true, reset = true, text = 'Next time maybe.'})


keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can travel you to {eremo} island and {edron} city, where you want go ?'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())


elseif msgcontains(msg, 'hi') and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
selfSay('Come back when you have those bloody swords off!')
talk_start = 0

Try now
 
errorq.gif


look, :(

i need it soo much, please help ;\
 
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
 
 
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
 
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
 
shopModule:addBuyableItem({'fish'}, 2667, 5, 'fish')
 
 
-- OTServ event handling functions end
 
 
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
 
local travelNode = keywordHandler:addKeyword({'edron'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Edron for 20 gold coins ?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 20, destination = {x=33175, y=31764, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, premium = true, reset = true, text = 'Next time maybe.'})
 
 
local travelNode = keywordHandler:addKeyword({'eremo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Eremo island for 20 gold coins ?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 20, destination = {x=33318, y=31882, z=7} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, premium = true, reset = true, text = 'Next time maybe.'})
 
 
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can travel you to {eremo} island and {edron} city, where you want go ?'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
 
 
if msgcontains(msg, 'hi') and getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
selfSay('Come back when you have those bloody swords off!')
talk_start = 0
end
 
easy...

Wrong, wrong, everything wrong! :blink:
PHP:
function greetCallback(cid)
    if(isPlayerPzLocked(cid)) then
        selfSay("Go away with these blood!", cid)
        return false
    else
        return true
    end
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
Add it at end of NPC .lua file (any, not only travel) :peace:
 
Back
Top