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

Lua Hairycles NPC - Help

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,775
Solutions
25
Reaction score
483
Location
Sweden
Edit:

Had problem with Hairycles NPC. If someone need it you can send me a PM.
 
Last edited:
i think you should create 1 line checking function like:
Code:
if (msgcontains(msg, "mission")) and (v == 15) and (getPlayerStorageValue(cid, 298) == 1) and (getPlayerItemCount(cid, 4843) ~= 0) then

Also local Topic = 0 should be in function greetCallback(cid)
 
No, no erros, the script is just fail and probably needs to be somewhat re-written but need some help :ppP BUMP
 
Well I'd start with making
else
npcHandler:say("You have storage " .. storage .. " in blabla and storage " .. storage2 .. " in blabla2")

this way you know if it matches something in your script.. and if he don't even say that you know that there is a problem before that.. =)
 
This is what happends, you start the first mission and the npc idles out, you say mission without finishing the mission, npc says nothing, you say mission after you've finished the mission, the npc doesn't respond. BUMP
 
Well you have done some misstakes in the script, like you made elseif topic == 1 in two different places.. it won't check the second time. but I've fixed those and made more structure to the script.. I've probably missed something but try this
Lua:
dofile(getDataDir() .. 'global/greeting.lua')
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = 0
 
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
 
function greetCallback(cid)
	if getPlayerStorageValue(cid, 293) == 11 then
		npcHandler:say("Be greeted, friend of the ape people. If you want to trade, just ask for my offers. If you are injured, ask for healing.")
	else
 
		npcHandler:say("Oh! Hello! Hello! Did not notice!")
	end
	return true
end
 
local function message1(pid)
selfSay("I wish I could speak for all when me call you true friend but my people need time to get accustomed to change ...", pid)
addEvent(message2, 5000, pid)
end
 
local function message2(pid)
selfSay("Let us hope one day whole Banuta will greet you as a friend. Perhaps you want to check me offers for special friends.", pid)
setPlayerStorageValue(cid, 293, 18)
end
 
local function message3(pid)
selfSay("Our raiders brought it from human settlement, it's called cough syrup. Go ask healer there for it.", pid)
setPlayerStorageValue(cid, 293, 3)
end
 
local function message4(pid)
selfSay("Me saw a stone with lizard signs and other signs at once. If you read signs and tell Hairycles, me will know how to read signs ...", pid)
addEvent(message5, 5000, pid)
end
 
local function message5(pid)
selfSay("You go east to big desert. In desert there city. East of city under sand hidden tomb is. You will have to dig until you find it, so take shovel ...", pid)
addEvent(message6, 5000, pid)
end
 
local function message6(pid)
selfSay("Go down in tomb until come to big level and then go down another. There you find a stone with signs between two huge red stones ...", pid)
addEvent(message7, 5000, pid)
end
 
local function message7(pid)
selfSay("Read it and return to me. Are you up to that challenge?", pid)
Topic = 8
end
 
local function message8(pid)
selfSay("You can help more. To create charm of life me need mighty token of life! Best is egg of a regenerating beast as a hydra is ...", pid)
addEvent(message9, 5000, pid)
end
 
local function message9(pid)
selfSay("Bring me egg of hydra please. You may fight it in lair of Hydra at little lake south east of our lovely city Banuta! You think you can do?", pid)
Topic = 10
end
 
local function message10(pid)
selfSay("Hidden under Fibula is a secret dungeon. There you will find witches' cap. Are you willing to go there for good ape people?", pid)
Topic = 12
end
 
local function message11(pid)
selfSay("Some of my people try to mimic lizards to become strong. Like lizards did before, this cult drinks strange fluid that lizards left when fled ...", pid)
addEvent(message12, 5000, pid)
end
 
local function message12(pid)
selfSay("Under the city still the underground temple of lizards is. There you find casks with red fluid. Take crowbar and destroy three of them to stop this madness. Are you willing to do that?", pid)
Topic = 13
end
 
local function message13(pid)
selfSay("Since you have proven a friend of the ape people I will grant you permission to enter the forbidden land ...", pid)
addEvent(message14, 5000, pid)
end
 
local function message14(pid)
selfSay("To enter the forbidden land in the north-east of the jungle, look for a cave in the mountains east of it. There you will find the blind prophet ...", pid)
addEvent(message15, 5000, pid)
end
 
local function message15(pid)
selfSay("Tell him Hairycles you sent and he will grant you entrance ...", pid)
addEvent(message16, 3000, pid)
end
 
local function message16(pid)
selfSay("Forbidden land is home of Bong. Holy giant ape big as mountain. Don't annoy him in any way but look for a hair of holy ape ...", pid)
addEvent(message17, 3000, pid)
end
 
local function message17(pid)
selfSay("You might find at places he has been, should be easy to see them since Bong is big ...", pid)
addEvent(message18, 4000, pid)
end
 
local function message18(pid)
selfSay("Return a hair of the holy ape to me. Will you do this for Hairycles?", pid)
Topic = 14
end
 
local function message19(pid)
selfSay("Me still can sense the evil presence there. We did not dare to go deeper and fight creatures of evil there ...", pid)
addEvent(message20, 4000, pid)
end
 
local function message20(pid)
selfSay("You may go there, fight the evil and find the monument of the serpent god and destroy it with hammer me give to you ...", pid)
addEvent(message21, 4000, pid)
end
 
local function message21(pid)
selfSay("Only then my people will be safe. Please tell Hairycles, will you go there?", pid)
Topic = 16
end
 
local function message22(pid)
selfSay("Me sure to make cure so strong to drive away all plague. But to create great cure me need powerful components ...", pid)
addEvent(message23, 4000, pid)
end
 
local function message23(pid)
selfSay("Me need whisper moss. Whisper moss growing south of human settlement is. Problem is, evil little dworcs harvest all whisper moss immediately ...", pid)
addEvent(message24, 4000, pid)
end
 
local function message24(pid)
selfSay("Me know they hoard some in their underground lair. My people raided dworcs often before humans came. So we know the moss is hidden in east of upper level of dworc lair ...", pid)
addEvent(message25, 4000, pid)
end
 
local function message25(pid)
selfSay("You go there and take good moss from evil dworcs. Talk with me about mission when having moss.", pid)
setPlayerStorageValue(pid, 293, 1)
end
 
local function message26(pid)
selfSay("I think curse on little one was only a try. We have to be prepared for big strike ...", pid)
addEvent(message27, 3000, pid)
end
 
local function message27(pid)
selfSay("Me need papers of lizard magician! For sure you find it in his hut in their dwelling. It's south east of jungle. Go look there please! Are you willing to go?", pid)
Topic = 6
end
 
function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	end
local pid = cid
local v = getPlayerStorageValue(cid, 293)
if msgcontains(msg, "mission") then	
	if v < 1 then
		selfSay("These are dire times for our people. Problems plenty are in this times. But me people not grant trust easy. Are you willing to prove you friend of ape people?",cid)
		Topic = 1
	elseif v == 2 then
		selfSay("Whisper moss strong is, but me need liquid that humans have to make it work ...",cid)
		addEvent(message3, 5000, pid)
	elseif v == 1 then
		if getPlayerStorageValue(cid, 294) == 1 and getPlayerItemCount(cid, 4838)>0 then
			selfSay("Oh, you brought me whisper moss? Good hairless ape you are! Can me take it?", cid)
		Topic = 3
		else
			selfSay("Please hurry. Bring me whisper moss from dworc lair. Make sure it is from dworc lair! Take it yourself only! If you need to hear background of all again, ask Hairycles for background.", cid)
		end
	elseif v == 3 then
		if getPlayerItemCount(cid, 4839)>0 then
		selfSay("You brought me that cough syrup from human healer me asked for?", cid)
		Topic = 4
		else
		selfSay("You don't have the cough syrap... get out of here!", cid)
		end
	elseif v == 4 then
		selfSay("Little ape should be healthy soon. Me so happy is. Thank you again! But me suspect we in more trouble than we thought. Will you help us again?",cid)
		Topic = 5
	elseif v == 5 then
		if getPlayerItemCount(cid, 4842)> 0 then
		selfSay("You got scroll from lizard village in south east?",cid)
		Topic = 7
		else 
		selfSay("You forgot the scroll from lizard village in south east..",cid)
		end
	elseif v == 6 then
		selfSay("Ah yes that scroll. Sadly me not could read it yet. But the holy banana me insight gave! In dreams Hairycles saw where to find solution ...",cid)
		addEvent(message4, 5000, pid)
	elseif v == 7 then
		if getPlayerStorageValue(cid, 296) == 1 then
		selfSay("Ah yes, you read the signs in tomb? Good! May me look into your mind to see what you saw?",cid)
		Topic = 9
		else
		selfSay("You still don't know signs on stone, go and look for it in tomb east in desert.",cid)
		end
	elseif v == 8 then
		selfSay("So much there is to do for Hairycles to prepare charm that will protect all ape people ...",cid)
		addEvent(message8, 5000, pid)
	elseif v == 9 then
		if getPlayerItemCount(cid, 4850) > 0 then
		selfSay("You bring Hairycles egg of hydra?", cid)
		Topic = 11
		else
		selfSay("You didn't bring Hairycles egg of hydra..", cid)
		end	
	elseif v == 10 then
		selfSay("Last ingredient for charm of life is thing to lure magic. Only thing me know like that is mushroom called witches' cap. Me was told it be found in isle called Fibula, where humans live ...",cid)
		addEvent(message10, 5000, pid)
	elseif v == 11 then
		if getPlayerItemCount(cid, 4840)> 0 then
		selfSay("You brought Hairycles witches' cap from Fibula?",cid)
		Topic = 18
		else
		selfSay("You didn't bring Hairycles witches' cap from Fibula..",cid)
		end
	elseif v == 12 then
		selfSay("Mighty life charm is protecting us now! But my people are still in danger. Danger from within ...",cid)
		addEvent(message11, 5000, pid)
	elseif v == 13 then
		if getPlayerStorageValue(cid, 297) > 2 then
		selfSay("You do please Hairycles again, friend. Me hope madness will not spread further now. Perhaps you are ready for other mission.",cid)
		else
		selfSay("Please destroy three casks in the complex beneath Banuta, so my people will come to senses again.",cid)
		end
	elseif v == 14 then
		selfSay("Now that the false cult was stopped, we need to strengthen the spirit of my people. We need a symbol of our faith that ape people can see and touch ...",cid)
		addEvent(message13, 5000, pid)
	elseif v == 15 then
		if getPlayerStorageValue(cid, 298) == 1 and getPlayerItemCount(cid, 4843)> 0 then
		selfSay("You brought hair of holy ape?",cid)
		Topic = 15
		else
		selfSay("Get a hair of holy ape from forbidden land in east. Speak with blind prophet in cave.",cid)
		end
	elseif v == 16 then
		selfSay("You have proven yourself a friend, me will grant you permission to enter the deepest catacombs under Banuta which we have sealed in the past ...",cid)
		addEvent(message19, 5000, pid)
	elseif v == 17 
		if getPlayerStorageValue(cid, 299) == 1 then
		selfSay("Finally my people are safe! You have done incredible good for ape people and one day even me brethren will recognise that ...",cid)
		addEvent(message1, 5000, pid)
		else
		selfSay("Finish your mission..",cid)
		end
	elseif v == 17 and getPlayerStorageValue(cid, 299) == 0 then
		selfSay("Me know its much me asked for but go into the deepest catacombs under Banuta and destroy the monument of the serpent god.",cid)
	elseif v == 18 then
		selfSay("No more missions await you right now, friend. Perhaps you want to check me offers for special friends.",cid)
	end 
elseif Topic == 1 then
	if msgcontains(msg, "yes") then
		selfSay("o become friend of ape people a long and difficult way is. We do not trust easy but help is needed. Will you listen to story of Hairycles?",cid)
		Topic = 2
	else
		selfSay("Hairycles sad is now. But perhaps you will change mind one day.",cid)
	end 
elseif Topic == 2 then
	if msgcontains(msg, "yes") then
		selfSay("So listen, little ape was struck by plague. Hairycles not does know what plague it is. That is strange. Hairycles should know. But Hairycles learnt lots and lots ...",cid)
		addEvent(message22, 5000, pid)
	else
		selfSay("Hairycles thought better of you.",cid)
	end 
elseif Topic == 3 then
	if msgcontains(msg, "yes") then
		if getPlayerItemCount(cid, 4838) ~= 0 then
			selfSay("Ah yes! That's it. Thank you for bringing mighty whisper moss to Hairycles. It will help but still much is to be done. Just ask for other mission if you ready.",cid)
			setPlayerStorageValue(cid, 293, 2)
			doPlayerRemoveItem(cid, 4838, 1)
		else
			selfSay("Stupid, you no have the moss me need. Go get it. It's somewhere in dworc lair. If you lost it, they might restocked it meanwhile. If you need to hear background of all again, ask Hairycles for background.",cid)
		end
	else
		selfSay("Strange being you are! Our people need help!",cid)
	end 
elseif Topic == 4 then
	if msgcontains(msg, "yes") then
		if getPlayerItemCount(cid, 4839) ~= 0 then
			selfSay("You so good! Brought syrup to me! Thank you, will prepare cure now. Just ask for mission if you want help again.",cid)
			setPlayerStorageValue(cid, 293, 4)
			doPlayerRemoveItem(cid, 4839, 1)
		else
			selfSay("No no, not right syrup you have. Go get other, get right health syrup.",cid)
		end
	else
		selfSay("Please hurry, urgent it is!",cid)
	end 
elseif Topic == 5 then
	if msgcontains(msg, "yes") then
		selfSay("So listen, please. Plague was not ordinary plague. That's why Hairycles could not heal at first. It is new curse of evil lizard people ...",cid)
		addEvent(message26, 4000, pid)
	else
		selfSay("Me sad. Me expected better from you!",cid)
	end 
elseif Topic == 6 then
	if msgcontains(msg, "yes") then
		selfSay("Good thing that is! Report about your mission when have scroll.",cid)
		setPlayerStorageValue(cid, 293, 5)
	else
		selfSay("Me sad. Me expected better from you!",cid)
	end 
elseif Topic == 7 then
	if msgcontains(msg, "yes") then
		if getPlayerItemCount(cid, 4842) ~= 0 then
			if getPlayerStorageValue(cid, 295) == 1 then
				selfSay("You brought scroll with lizard text? Good! I will see what text tells me! Come back when ready for other mission.",cid)
				setPlayerStorageValue(cid, 296, 1)
				doPlayerRemoveItem(cid, 4842, 1)
				npcHandler:releaseFocus()
			else
				selfSay("No! That not scroll me looking for. Silly hairless ape you are. Go to village of lizards and get it there on your own!",cid)
			end
		else
			selfSay("Oh, you seem to have lost scroll? That's bad news. If you lost it, only way to get other is to kill holy serpents. But you can't go there so you must ask adventurers who can.",cid)
		end
	else
		selfSay("That's bad news. If you lost it, only way to get other is to kill holy serpents. But you can't go there so you must ask adventurers who can.",cid)
	end 
elseif Topic == 8 then
	if msgcontains(msg, "yes") then
		selfSay("Good thing that is! Report about mission when you have read those signs.",cid)
		setPlayerStorageValue(cid, 293, 7)
	else
		selfSay("Me sad. Me expected better from you!",cid)
	end 
elseif Topic == 9 then
	if msgcontains(msg, "yes") then
		selfSay("Oh, so clear is all now! Easy it will be to read the signs now! Soon we will know what to do! Thank you again! Ask for mission if you feel ready.",cid)
		doSendMagicEffect(getCreaturePosition(getNpcCid()), 13)
		setPlayerStorageValue(cid, 293, 8)
		npcHandler:releaseFocus()
	else
		selfSay("Me need to see it in your mind, other there is no way to proceed.",cid)
	end 
elseif Topic == 10 then
	if msgcontains(msg, "yes") then
		selfSay("You brave hairless ape! Get me hydra egg. If you lose egg, you probably have to fight many, many hydras to get another.",cid)
		setPlayerStorageValue(cid, 293, 9)
	else
		selfSay("Me sad. Me expected better from you!",cid)
	end 
elseif Topic == 11 then
	if msgcontains(msg, "yes") then
		if getPlayerItemCount(cid, 4850) ~= 0 then
			selfSay("Ah, the egg! Mighty warrior you be! Thank you. Hairycles will put it at safe place immediately.",cid)
			setPlayerStorageValue(cid, 293, 10)
			doPlayerRemoveItem(cid, 4850, 1)
			npcHandler:releaseFocus()
		else
			selfSay("You not have egg of hydra. Please get one!",cid)
		end
	else
		selfSay("Please hurry. Hairycles not knows when evil lizards strike again",cid)
	end
 
elseif Topic == 12 then
	if msgcontains(msg, "yes") then
		selfSay("Long journey it will take, good luck to you.",cid)
		setPlayerStorageValue(cid, 293, 11)
	else
		selfSay("Me sad. Me expected better from you!",cid)
	end
 
elseif Topic == 13 then
	if msgcontains(msg, "yes") then
		selfSay("Hairycles sure you will make it. Good luck, friend.",cid)
		setPlayerStorageValue(cid, 293, 13)
	else
		selfSay("Me sad. Please reconsider",cid)
	end
 
elseif Topic == 14 then
	if msgcontains(msg, "yes") then
		selfSay("Hairycles proud of you. Go and find holy hair. Good luck, friend.",cid)
		setPlayerStorageValue(cid, 293, 15)
	else
		selfSay("Me sad. Please reconsider",cid)
	end
 
elseif Topic == 15 then
	if msgcontains(msg, "yes") then
		if getPlayerItemCount(cid, 4843) ~= 0 then 
		selfSay("Incredible! You got a hair of holy Bong! This will raise the spirit of my people. You are truly a friend. But one last mission awaits you.",cid)
		setPlayerStorageValue(cid, 293, 16)
		doPlayerRemoveItem(cid, 4843, 1)
		else
			selfSay("You no have hair. You lost it? Go and look again.",cid)
			erasePlayerStorageValue(cid, 298)
		end
	else
		selfSay("Go to forbidden land in east to find hair.",cid)
	end
 
elseif Topic == 16 then
	if msgcontains(msg, "yes") then
		selfSay("Hairycles sure you will make it. Just use hammer on all that looks like snake or lizard. Tell Hairycles if you succeed with mission.",cid)
		doPlayerAddItem(cid, 4846, 1)
		setPlayerStorageValue(cid, 293, 17)
	else
		selfSay("Me sad. Please reconsider",cid)
	end
 
elseif Topic == 18 then
	if msgcontains(msg, "yes") then
		if getPlayerItemCount(cid, 4840) ~= 0 then
			selfSay("Incredible, you brought a witches' cap! Now me can prepare mighty charm of life. Yet still other missions will await you, friend.",cid)
			setPlayerStorageValue(cid, 293, 12)
			doPlayerRemoevItem(cid, 4840, 1)
		else
			selfSay("Not right mushroom you have. Find me a witches' cap on Fibula!",cid)
		end
	else
		selfSay("Please try to find me a witches' cap on Fibula.",cid)
	end
end
 	return true
end
npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, "Wait! Wait! Time I no have!")
npcHandler:setMessage(MESSAGE_IDLETIMEOUT, "Bye, bye.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye, bye.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye, bye.")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Edit: fixed another thing in the script =)
 
Last edited:
18:54 Hairycles: Welcome, Realistic!
18:54 Realistic: mission
18:54 Hairycles: 268449514

Haha

weirdt.jpg


Also I should have mentioned that I'm using a 7.72 Server (No NPC-Chat window)
 
Last edited:
Back
Top