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

An 2 Advanced npcs

breadmaker

New Member
Joined
Jul 16, 2010
Messages
160
Reaction score
3
Hello.
TFS 0.3.5pl1 (TIBIA 8.50)
I have next request.

First:
Player: Hi
NPC: Hello! Would you like to take a {challange} with strong quest ? I also selling {amulet of loss} for 2 cc.
Player: Challange
NPC: Go and kill 300 fire devils, come back when you done it!
Player: *after kill 300 fire devils* challange
NPC: Are you killed 300 fire devils ?
Player: Yes
NPC: Good! You can start second part of {challange}
Player: challange
NPC: Go and kill 250 demons, come back when you done it!
Player: *after kill 250 demons* challange
Player: challange
NPC: Are you killed 250 demons ?
Player: Yes
NPC: Good! You can start third part of {challange}
Player: challange
NPC: Go and kill 200 orshaabal, come back when you done it!
Player: *after kill 200 orshaabals* challange
Player: challange
NPC: Are you killed 200 orshabaals ?
Player: Yes
NPC: Good! You can start fourth part of {challange}
Player: challange
NPC: Go and kill 150 death orshaabals, come back when you done it!
Player: *after kill 150 death orshaabals* challange
NPC: Are you killed 150 death orshabaals ?
Player: Yes
NPC: Good! You can start five part of {challange}
Player: challange
NPC: Go and kill 50 super orshaabals, come back when you done it!
Player: Yes
NPC: Good! You done all killing parts! Now go to my brother Alice for next informations about this quest.
The NPC set you storage value :)

Second:
Player: Hi
NPC: You cannot talk with me go to my brother Steve and complete all killing quests.
* if get steve storage *
Player: Hi
NPC: Welcome in my house! I saw you helped Steve last night... great... are you interested in next {mission} ?
Player: Mission
NPC: Please bring me 4 items: necklace, wood, 100 eggs, 5 demon dusts
* after collecting items *
Player: Mission
NPC: Do you have all 4 required items ?
Player: Yes
* if player have items *
NPC: Great! Thanks for all of these! Now you can pass the doors near Steve.
The NPC set you storage value :)


Thanks if you done this.
Repp +++:thumbup:
 
Last edited:
The first one is already released on OtLand.

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

local Topic = {}

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 steve = 1234 -- Storage to start.
local done = 4567 -- Storage when finished.

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "task") or  msgcontains(msg, "yes") then
		if getPlayerStorageValue(cid, steve) == 1 then
			npcHandler:say("Welcome to my house! I saw you helped {Steve} last night, great. Are you interested in the next {mission}?", cid)
			Topic[cid] = 1
		else
			npcHandler:say("Go speak to Steve!", cid)
			npcHandler:releaseFocus(cid)
		end
	elseif msgcontains(msg, "mission") and Topic[cid] == 1 then
		npcHandler:say("Please bring me 4 items: a necklace, a piece of wood, 100 white eggs, and 5 demon dusts.", cid)
		Topic[cid] = 2
		npcHandler:releaseFocus(cid)
	elseif msgcontains(msg, "finished") and Topic[cid] == 2 then
		npcHandler:say("Did you bring me the required item's?", cid)
		Topic[cid] = 3
	elseif msgcontains(msg, "yes") and Topic[cid] == 3 then
[COLOR="red"]		local items = {
			{2160, 5},
			{2160, 5},
			{2160, 5},
			{2148, 3}
		}[/COLOR]
		if isInArray(items[1], getPlayerItemCount(cid)) >= items[2] then
			if doPlayerRemoveItem(cid, items[1], items[2]) then
				npcHandler:say("Great! Thanks for all of these! Now you can pass the doors near Steve.", cid)
				setPlayerStorageValue(cid, done, 1)
			else
				npcHandler:say("You do not have the item's I requested!", cid)
				Topic[cid] = 2
			end
		end
	end
	
	return true
end


npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye, asshole.')
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|! What the fuck do you want, is this about the {task}?')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top