• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

I have problem whit this npc

Bazi

Member
Joined
Oct 24, 2011
Messages
270
Reaction score
8
Location
Germany
Other players cant speak whit this npc! help pls

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:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end
function onThink() npcHandler:onThink() 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|")
 
Here
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local TopicState = {}

-- 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 onPlayerEndTrade(cid) npcHandlernPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandlernPlayerCloseChannel(cid) end
function onThink() npcHandlernThink() 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|")
 
Back
Top