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

Simple Quest

heley

New Member
Joined
Mar 14, 2011
Messages
96
Reaction score
1
Hi Im either looking for someone to create a simple quest or link me to a tutorial of how to do it.

Im looking for a quest that goes:
1) talk to npca A
2) say 'mount'
3) npc reply's to go visit npc B
4) talk to npc B
5) say 'npca A sent me'
6) npc B says ill let you take a free mount if you help me by looting x chest and bring back the item.
7) you say 'yes'
8) saying yes lets you access door A1, that you couldn't access before
9) you loot x chest, obtaining the item.
10) you talk to npc B and say 'x item from chest' giving the item u obtained .
11) npc B says well done, go claim your mount
12) You can now open door A2 forever that you couldnt open before, but door A1 you cannot acess any more.

I know its big ask but if any one could be really nice and make it :)?, or even just link me a good tutorial that will show me how to do it.

many many thanks.

Heley.

- - - Updated - - -

----BUMP----
 
Last edited:
I'd like to see this script
as far as scripting go not simple because it requires more then one script(npcs) but could easily be done with storage values
I'm just horrible with npcs
good luck post script here please if you get it figured out i could use something like that
 
NPC A
Lua:
-- Npc A
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	local storage = 9105 
 
	if(msgcontains(msg, 'mount')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			selfSay('Go visit npc B.', cid)
			setPlayerStorageValue(cid, storage, 1)

		elseif(getPlayerStorageValue(cid, storage) == 1) then
			selfSay('Already visited npc B? Haven\'t heard anything from him yet, please go visit him.', cid)

		elseif(getPlayerStorageValue(cid, storage) > 1) then
			selfSay('Npc B told me you were helping him, that is great.', cid)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

NPC B
Lua:
-- Npc B
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	local storage = 9105 
	local monsterstorage = 14022
	local item = 1000  -- id of item
	local mountid = 2  -- mount here
 
	if(msgcontains(msg, 'npc A') or msgcontains(msg, 'sent me')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			selfSay('He didn\'t, don\'t lie to me.', cid)

		elseif(getPlayerStorageValue(cid, storage) == 1) then
			selfSay('Can you help me by killing x monster and bring the item it drops? I will give you a free mount.', cid)
			talkState[talkUser] = 1
		end
	end
	
	if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		selfSay('Great, good luck. You can now acces door A1.', cid)
		setPlayerStorageValue(cid, storage, 2)
		talkState[talkUser] = 0
	end

	if(msgcontains(msg, 'x monster') or msgcontains(msg, 'item')) then
		if(getPlayerStorageValue(cid, storage) == 2) then
			if(getPlayerStorageValue(cid, monsterstorage) == 1) then
				if getPlayerItemCount(cid, item) >= 1 then
                			doPlayerRemoveItem(cid, item, 1)
					selfSay('Well done, here is your mount, you can now also acces door A2.', cid)
					doPlayerAddMount(cid, mountid)
					setPlayerStorageValue(cid, storage, 3)
				else
					selfSay('Where is the item x monster dropped?', cid)
				end
			else
				selfSay('You didn\'t kill x monster.', cid)
			end
		elseif(getPlayerStorageValue(cid, storage) == 3) then
			selfSay('Huh?', cid)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

creaturescript
Lua:
function onKill(cid, target)
 
local config = {
	["xmonster"] = {amount = 1, storage = 14022}
}
 
local monster = config[getCreatureName(target):lower()]
 
	if(isPlayer(target)) or not monster then
		return true
	end
 
	if getPlayerStorageValue(cid, monster.storage) >= -1 and (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount then			
		setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
	end
	if (getPlayerStorageValue(cid, monster.storage) +1) == monster.amount then
		doPlayerSendTextMessage(cid, 22, "Congratulations, you killed the "..getCreatureName(target)..". Go back to npc B to get your reward.")
		setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
	end
	return true
end

For the doors, you can just check for storage 2 and 3 to enter.
 
Last edited:
NPC A
Lua:
-- Npc A
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	local storage = 9105 
 
	if(msgcontains(msg, 'mount')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			selfSay('Go visit npc B.', cid)
			setPlayerStorageValue(cid, storage, 1)

		elseif(getPlayerStorageValue(cid, storage) == 1) then
			selfSay('Already visited npc B? Haven\'t heard anything from him yet, please go visit him.', cid)

		elseif(getPlayerStorageValue(cid, storage) > 1) then
			selfSay('Npc B told me you were helping him, that is great.', cid)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

NPC B
Lua:
-- Npc B
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	local storage = 9105 
	local monsterstorage = 14022
	local item = 1000  -- id of item
	local mountid = 2  -- mount here
 
	if(msgcontains(msg, 'npc A') or msgcontains(msg, 'sent me')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			selfSay('He didn\'t, don\'t lie to me.', cid)
			setPlayerStorageValue(cid, storage, 1)

		elseif(getPlayerStorageValue(cid, storage) == 1) then
			selfSay('Can you help me by killing x monster and bring the item it drops? I will give you a free mount.', cid)
			talkState[talkUser] = 1
		end
	end
	
	if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		selfSay('Great, good luck. You can now acces door A1.', cid)
		setPlayerStorageValue(cid, storage, 2)
		talkState[talkUser] = 0
	end

	if(msgcontains(msg, 'x monster') or msgcontains(msg, 'item')) then
		if(getPlayerStorageValue(cid, storage) == 2) then
			if(getPlayerStorageValue(cid, storage) == 1) then
				if getPlayerItemCount(cid, item) >= 1 then
                			doPlayerRemoveItem(cid, item, 1)
					selfSay('Well done, here is your mount, you can now also acces door A2.', cid)
					doPlayerAddMount(cid, mountid)
					setPlayerStorageValue(cid, storage, 3)
				else
					selfSay('Where is the item x monster dropped?', cid)
				end
			else
				selfSay('You didn\'t kill x monster.', cid)
			end
		elseif(getPlayerStorageValue(cid, storage) == 3) then
			selfSay('Huh?', cid)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

creaturescript
Lua:
function onKill(cid, target)
 
local config = {
	["xmonster"] = {amount = 1, storage = 14022}
}
 
local monster = config[getCreatureName(target):lower()]
 
	if(isPlayer(target)) or not monster then
		return true
	end
 
	if getPlayerStorageValue(cid, monster.storage) >= -1 and (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount then			
		setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
	end
	if (getPlayerStorageValue(cid, monster.storage) +1) == monster.amount then
		doPlayerSendTextMessage(cid, 22, "Congratulations, you killed the "..getCreatureName(target)..". Go back to npc B to get your reward.")
		setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
	end
	return true
end

For the doors, you can just check for storage 2 and 3 to enter.

Ty man but it dosnt seem to count the monsters, or come up with the message once you have killed them, so you cant progress past that bit. ;S
 
Added the name of the creaturescript line to login.lua?

Btw, just saw I made a little mistake in NPC B, so I edited my post.
 
Last edited:
Added the name of the creaturescript line to login.lua?

Btw, just saw I made a little mistake in NPC B, so I edited my post.

Still not working ;S, theres a couple of errors, NPC B, says 'No he didn't don't lie to me' even if I have spoken to NPC A before, I have to repeat 'NPC A sent me' 2 times in order for him to offer me the quest, you can also go straight to NPC B and say 'NPC A sent me' 2 times and he will offer you the quest, without going to NPC A beforehand. Also its not registering the kills, I kill the Rotworm, nothing comes up, I go to NPC B and say 'x monster' and he says You didn't kill x monster. Heres what ive done with the code:


Script:

PHP:
function onKill(cid, target)
 
local config = {
	["Rotworm"] = {amount = 1, storage = 14022}
}
 
local monster = config[getCreatureName(target):lower()]
 
	if(isPlayer(target)) or not monster then
		return true
	end
 
	if getPlayerStorageValue(cid, monster.storage) >= -1 and (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount then			
		setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
		doPlayerSendTextMessage(cid, 22, "Congratulations, you killed the "..getCreatureName(target)..". Go back to npc B to get your reward.")
	end
	if (getPlayerStorageValue(cid, monster.storage) +1) == monster.amount then
		doPlayerSendTextMessage(cid, 22, "Congratulations, you killed the "..getCreatureName(target)..". Go back to npc B to get your reward.")
		setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
	end
	return true
end

CreatureScripts:

PHP:
<event type="kill" name="killedmonster" event="script" value="killedmonster.lua"/>

Login:

PHP:
registerCreatureEvent(cid, "killedmonster")

Doors:

PHP:
function onUse(cid, item, frompos, item2, topos) 
       if item.uid == 9105  then 
           queststatus = getPlayerStorageValue(cid, 9105 ) 
           if queststatus == 2 then 

            pos = getPlayerPosition(cid) 

            if pos.x == topos.x then 
                if pos.y < topos.y then 
                    pos.y = topos.y + 1 
                else 
                    pos.y = topos.y - 1 
                end 
            elseif pos.y == topos.y then 
                if pos.x < topos.x then 
                    pos.x = topos.x + 1 
                else 
                    pos.x = topos.x - 1 
                end 
            else 
                doPlayerSendTextMessage(cid,22,'Stand in front of the door.') 
                return TRUE 
            end 

            doTeleportThing(cid,pos) 
            doSendMagicEffect(topos,12) 
        else 
            doPlayerSendTextMessage(cid,22,'You need to complete a quest, then you can pass.') 
        end 
        return TRUE 
    else 
        return FALSE 
    end 
end
 
Last edited:
What kind of errors do you get?

Btw, edited npc B, be sure to use same storage for both npcs and add the monster without capital.
 
Last edited:
What kind of errors do you get?
Btw, edited npc B, be sure to use same storage for both npcs and add the monster without capital.

None, thats the strange thing. working on 9.6 client, TFS 0.4.

Ok now this is odd lol, i accept the mission off NPC A, then go to NPC B and say NPC A sent me, and he wont have it ;/

07:17 [NPC] 1: Welcome, Thegooua! I have been expecting you.
07:17 Thegooua [35]: mount
07:17 [NPC] 1: So you interested in mount mission?
07:17 Thegooua [35]: yes
07:17 [NPC] 1: Great as I see you approved!
07:17 Thegooua [35]: yes
07:17 [NPC] 1: Great as I see you approved!
07:17 Thegooua [35]: yes
07:17 [NPC] 1: Great as I see you approved!

07:17 Thegooua [35]: npc a sent me
07:17 [NPC] 2: He didn't, don't lie to me.
07:17 Thegooua [35]: npc a sent me
07:17 [NPC] 2: He didn't, don't lie to me.
 
Last edited:
Didn't tested the npcs, just made it quick, so made a few mistakes, edited it again (NPC B). The creaturescript is from the task system I made for my own server a while ago, so should work.

Edit: Just saw it's on a new page, incase you didn't saw my edit on my other post. Be sure the storage from the NPCs are the same.
 
Last edited:
Didn't tested the npcs, just made it quick, so made a few mistakes, edited it again (NPC B). The creaturescript is from the task system I made for my own server a while ago, so should work.

Still doing the same thing lol :(, accept off npc A, goto npc B say 'npc A sent me' he tells me 'do he didn't, don't lie'. Anyway rep for helping me so far ;/.
 
Did you edited npc A, if you did, show the script.

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="[NPC] 1" script="npcA.lua" talkradius="3" walkradius="3" walkinterval="1500" floorchange="0">
	<health now="100" max="100"/>
	<look type="146" head="20" body="16" legs="32" feet="20" mount="405" addons="3"/>
</npc>

PHP:
-- Npc A
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	local storage = 9105 
 
	if(msgcontains(msg, 'mount')) then
		if(getPlayerStorageValue(cid, storage) == -1) then
			selfSay('Go visit npc B.', cid)
			setPlayerStorageValue(cid, storage, 1)
 
		elseif(getPlayerStorageValue(cid, storage) == 1) then
			selfSay('Already visited npc B? Haven\'t heard anything from him yet, please go visit him.', cid)
 
		elseif(getPlayerStorageValue(cid, storage) > 1) then
			selfSay('Npc B told me you were helping him, that is great.', cid)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
None, thats the strange thing. working on 9.6 client, TFS 0.4.

Ok now this is odd lol, i accept the mission off NPC A, then go to NPC B and say NPC A sent me, and he wont have it ;/

07:17 [NPC] 1: Welcome, Thegooua! I have been expecting you.
07:17 Thegooua [35]: mount
07:17 [NPC] 1: So you interested in mount mission?
07:17 Thegooua [35]: yes
07:17 [NPC] 1: Great as I see you approved!
07:17 Thegooua [35]: yes
07:17 [NPC] 1: Great as I see you approved!
07:17 Thegooua [35]: yes
07:17 [NPC] 1: Great as I see you approved!

07:17 Thegooua [35]: npc a sent me
07:17 [NPC] 2: He didn't, don't lie to me.
07:17 Thegooua [35]: npc a sent me
07:17 [NPC] 2: He didn't, don't lie to me.

NPC A is NPC 1 right?

If you are done talking to NPC A, it should set the storage to 1
Lua:
            setPlayerStorageValue(cid, storage, 1)

In the npc A I wrote it does that immediatly after saying mount.
 
Yup

but i dont see this message anywhere in your code?
07:17 [NPC] 1: Great as I see you approved!
Its like its not updating correctly ;/
 
Back
Top