• 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 don't answer to "Hi"

CristianXtreme

Active Member
Joined
Apr 14, 2016
Messages
76
Reaction score
45
Hi! My NPC don't answer to "Hi"... Just when you say "Hi" the NPC turns to look at you but he dont say anything... I saw when you walk away from him it says "Good bye then." but not anymore... Just it says that...

.XML
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Muten Roshi" script="roshi.lua" walkinterval="500" floorchange="0" access="5">
<health now="100" max="100"/>
<look type="66" head="0" body="0" legs="0" feet="0" addons="0"/>
<voices>
<voice text="Hello |PLAYERNAME|, I can bring you to any place on my boat or teach you the basics..." interval2="100" margin="1" yell="no"/>
</voices>
<parameters>
<parameter key="message_farewell" value="Good bye." />
<parameter key="message_walkaway" value="Good bye then." />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="travel; information;" />
<parameter key="keyword_reply1" value="Do you want me take you to {West City} or {Namek}?" />
<parameter key="keyword_reply2" value="Ok, wait a momment..." />
<parameter key="message_greet" value="Welcome, |PLAYERNAME|! I\'m Roshi the Turtle Master! I\'m here to help you. If you need to {travel} or learn some {information} I can help you."/>
</parameters>
</npc>

.LUA
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- 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
-- OTServ event handling functions end


-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'West City'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to go to West City?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost =0, destination = {x=33311, y=31989, z=15} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Ok, tell me when you\'re ready.'})

local travelNode = keywordHandler:addKeyword({'Namek'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do want to go to Namek for 250 Zenis?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost =250, destination = {x=33025, y=31553, z=10} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Ok, tell me when you\'re ready.'})



npcHandler:addModule(FocusModule:new())

BUMP! Help?

BUMP! I know there is a lot of people that knows how to fix this... Why don't I get an answer? :(
 
Last edited by a moderator:
The fact you are not receiving any help, it may be due to not following Support board rules correctly.

Create the following file in data/npc/ (if not created yet):

Muten Roshi.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Muten Roshi" script="Muten Roshi.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="66" head="0" body="0" legs="0" feet="0" addons="0"/>
</npc>

Create the following file in data/npc/scripts/ (if not created yet):

Muten Roshi.lua
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 voices = { {text = 'Sail today to West City or Namek!'} }
npcHandler:addModule(VoiceModule:new(voices))

-- Travel
local function addTravelKeyword(keyword, cost, destination, action)
    local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want to go to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', 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 = 'Ok, tell me when you\'re ready.', reset = true})
end

addTravelKeyword('west city', 0, Position(33311, 31989, 15))
addTravelKeyword('Namek', 250, Position(33025, 31553, 10))

-- Basic
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want me take you to {West City} or {Namek}?'})
keywordHandler:addKeyword({'information'}, StdModule.say, {npcHandler = npcHandler, text = 'Information requested'})

npcHandler:setMessage(MESSAGE_GREET, 'Welcome |PLAYERNAME|. I\'m Roshi the Turtle Master! I\'m here to help you. If you need to {travel} or learn some {information} I can help you?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
The fact you are not receiving any help, it may be due to not following Support board rules correctly.

Create the following file in data/npc/ (if not created yet):

Muten Roshi.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Muten Roshi" script="Muten Roshi.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="66" head="0" body="0" legs="0" feet="0" addons="0"/>
</npc>

Create the following file in data/npc/scripts/ (if not created yet):

Muten Roshi.lua
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 voices = { {text = 'Sail today to West City or Namek!'} }
npcHandler:addModule(VoiceModule:new(voices))

-- Travel
local function addTravelKeyword(keyword, cost, destination, action)
    local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want to go to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', 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 = 'Ok, tell me when you\'re ready.', reset = true})
end

addTravelKeyword('west city', 0, Position(33311, 31989, 15))
addTravelKeyword('Namek', 250, Position(33025, 31553, 10))

-- Basic
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, text = 'Do you want me take you to {West City} or {Namek}?'})
keywordHandler:addKeyword({'information'}, StdModule.say, {npcHandler = npcHandler, text = 'Information requested'})

npcHandler:setMessage(MESSAGE_GREET, 'Welcome |PLAYERNAME|. I\'m Roshi the Turtle Master! I\'m here to help you. If you need to {travel} or learn some {information} I can help you?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Is making some errors on the console... Can we speak via skype or something like that? I want to know if you know how to handle with source files (This problem seems to be with sources with one line called MessageNpcFromStartBlock or something like that). I will send you a PM to talk via skype!

Regards!
 
ERROR: ProtocolGame parse message exception (14 bytes unread, last opcode is 170, prev opcode is 109)
Which TFS are you using? And which client version? Correct me if I'm wrong, but it's unusual to see a protocol error here. Protocol errors usually mean that something is not right in the communication between client and server, or that either of them doesn't know how to interpret the packets they received, which could be an indicator that you're attempting to use a feature which is not supported by your server/client.
 
Which TFS are you using? And which client version? Correct me if I'm wrong, but it's unusual to see a protocol error here. Protocol errors usually mean that something is not right in the communication between client and server, or that either of them doesn't know how to interpret the packets they received, which could be an indicator that you're attempting to use a feature which is not supported by your server/client.
TFS 1.1 and OTClient 9.86
 
Back
Top