Jump to content

Question

Bom eu tenho um npc de mission aqui, ele é igual a um outro, que você pega os items, faz as missões entrega-os para o npc, e ele te da acesso a uma porta.

Só que esse npc não tá respondendo, alguém pode me ajudar?

 

Script.

 local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- 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 onThink()					  npcHandler:onThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if (not npcHandler:isFocused(cid)) then
	return false
end
	if msgcontains(msg, 'castle') and getPlayerStorageValue(cid, 60083) == -1 and getPlayerStorageValue(cid, 60081) == -1 then
			npcHandler:say('This castle was built for Prince Kober, but since the {vampires} appeared, it just isnt the same.', cid)
			talk_state = 5
	elseif msgcontains(msg, 'vampires') and talk_state == 5 then

npcHandler:say('The legend says they built giant {caves} under this castle.', cid)
  talk_state = 6
elseif msgcontains(msg, 'caves') and talk_state == 6 then
npcHandler:say('Yes, dark, forgotten caves. I can let you go there, but you have to do me a {favour} first.', cid)
talk_state = 7
elseif msgcontains(msg, 'favour') and talk_state == 7 then
npcHandler:say('I was traveling past the {western steppes}. I found some ancient ruins, so I went to the caves. I saw so much evil, and I met Medusa. She stole something {precious} of mine.', cid)	
		 talk_state = 8
elseif msgcontains(msg, 'western steppes') then
npcHandler:say('It is big plain, west of Intiri. You can find lots of dry grass, insect swarms and sandcrawlers there. Search for my {precious} in the serpents cave, in the middle of it.', cid)
doPlayerSetStorageValue(cid,60081, 1)
talk_state = 0
elseif msgcontains(msg, 'precious') then
npcHandler:say('My old diary. I would really appreciate it if you found it. I will reward you. You can ask me about {western steppes}, if you still do not know where to search for my diary.', cid)
doPlayerSetStorageValue(cid,60081, 1)	  
talk_state = 0
		  elseif (msgcontains(msg, 'diary') or msgcontains(msg, 'reward') or msgcontains(msg, 'castle')) and getPlayerItemCount(cid,1961) < 1 and getPlayerStorageValue(cid, 60083) == -1 then
npcHandler:say('You havw not found my diary yet.', cid)
		elseif getPlayerStorageValue(cid, 60081) == 1 and getPlayerStorageValue(cid, 60083) == -1 and (msgcontains(msg, 'diary') or msgcontains(msg, 'castle') or msgcontains(msg, 'reward')) then
if getPlayerItemCount(cid,1961) >= 1 then
	if doPlayerRemoveItem(cid,1961,1) then
			npcHandler:say('Oh thank you so much! Alright, you can pass the doors to caves now.', cid)
doPlayerSetStorageValue(cid,60083, 1)

			talk_state = 0
		end
end
	------------------------------------------------ confirm no ------------------------------------------------

-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Link to comment
https://xtibia.com/forum/topic/190896-npc-de-mission-n%C3%A3o-responde/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Olá, bom existe alguns motivos por ele não estar respondendo qdo o player diz "hi"

Pode ser por que o diretório dele não esta compativel com o script, exemplo você criou o npc tal na pasta "data/npc" certo ai você abrio o arquivo do npc que você criou, que é o arquivo.xml ai você pode conferir para ver se esta linha: script="exemplo.lua" esta igual a onde esta o script da pasta "data/npc/scripts" caso esteja corretamente, revise o script ou copie o npc igual ao que você

disse, que troca la os iten's e abre a porta, e só renomeie o nome dele e veja se a pasta do seu script está correta.

  • 0

@Tiag017

 

Esse script já veio no Server, e o diretorio está certinho.

 

<npc name="Omar" script="omar.lua" walkinterval="2000" floorchange="0">
<health now="150" max="150"/>
<look type="68" corpse="2212"/>
<parameters>
 <parameter key="message_greet" value="Hello |PLAYERNAME|. This is a nice {castle}, isnt it?"/>
</parameters>
</npc>

 

Eu já tentei refazer-lo o script, usando a storage ect, mais buguei foi tudo. :/

Guest
This topic is now closed to further replies.
×
×
  • Create New...