Other players cant speak whit this npc! help pls
Data/npcs/Custom highot.xml
Data/npcs/scripts/Custom.lua
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local TopicState = {}
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler
nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler
nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler
nCreatureSay(cid, type, msg) end
function onPlayerEndTrade(cid) npcHandler
nPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler
nPlayerCloseChannel(cid) end
function onThink() npcHandler
nThink() end
-- OTServ event handling functions end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- Buy
shopModule:addBuyableItem({"FragRemover"}, 2363, 5000000)
-- Sell
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
npcHandler:say("Hello I sell Custom Items of HighOt", cid)
npcHandler:addFocus(cid)
TopicState[cid] = 0
elseif(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
npcHandler:say("Trade", cid, TRUE)
npcHandler:releaseFocus(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good Bye |PLAYERNAME|")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Here the Shop offer!")
npcHandler:setMessage(MESSAGE_ONCLOSESHOP, "Good Bye |PLAYERNAME|")
npcHandler:setMessage(MESSAGE_IDLETIMEOUT, "Good Bye |PLAYERNAME|")
Data/npcs/Custom highot.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Custom HighOt (Seller)" script="Custom.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="114" body="94" legs="0" feet="114" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell Custom Highot Items."/>
<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!"/>
</parameters>
</npc>
Data/npcs/scripts/Custom.lua
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local TopicState = {}
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler
function onCreatureDisappear(cid) npcHandler
function onCreatureSay(cid, type, msg) npcHandler
function onPlayerEndTrade(cid) npcHandler
function onPlayerCloseChannel(cid) npcHandler
function onThink() npcHandler
-- OTServ event handling functions end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
-- Buy
shopModule:addBuyableItem({"FragRemover"}, 2363, 5000000)
-- Sell
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
npcHandler:say("Hello I sell Custom Items of HighOt", cid)
npcHandler:addFocus(cid)
TopicState[cid] = 0
elseif(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
npcHandler:say("Trade", cid, TRUE)
npcHandler:releaseFocus(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good Bye |PLAYERNAME|")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Here the Shop offer!")
npcHandler:setMessage(MESSAGE_ONCLOSESHOP, "Good Bye |PLAYERNAME|")
npcHandler:setMessage(MESSAGE_IDLETIMEOUT, "Good Bye |PLAYERNAME|")