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

Solved Quest wont work right

witze15

New Member
Joined
Mar 21, 2010
Messages
29
Reaction score
1
Hello everone,

also i have one problem.

My chest have the Actionid 2000 for quest and 12345 for UID
now i turn ONE item into the chest for example a tallon (2151) than i save the map and start the server.

Know i walk to the chest and klick on it.
And what i get? a door...

Why?

i hope you can help me :D
 
Do you use Mystic Spirit? This server uses a script called quest.lua for questboxes. With this script the unique id is both the storage and the itemid, the script is added with the chest ids in actions.xml.
The script you are talking about with actionid 2000, uniqueid for the storage and the items people get in the chest is the system.lua from TFS 0.3/0.4.
If you want to use that on instead of the quest.lua you can add this script.

actions.xml
XML:
<action actionid="2000" script="quests/system.lua"/>
system.lua
Lua:
local specialQuests = {
	[2001] = 30015 --Annihilator
}

local questsExperience = {
	[30015] = 10000
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

	local storage = specialQuests[item.actionid]
	if(not storage) then
		storage = item.uid
		if(storage > 65535) then
			return false
		end
	end

	if(getPlayerStorageValue(cid, storage) > 0) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
		return true
	end

	local items = {}
	local reward = 0

	local size = isContainer(item.uid) and getContainerSize(item.uid) or 0
	if(size == 0) then
		reward = doCopyItem(item, false)
	else
		for i = 0, size do
			local tmp = getContainerItem(item.uid, i)
			if(tmp.itemid > 0) then
				table.insert(items, tmp)
			end
		end
	end

	size = table.maxn(items)
	if(size == 1) then
		reward = doCopyItem(items[1], true)
	end

	local result = ""
	if(reward ~= 0) then
		local ret = getItemDescriptions(reward.itemid)
		if(reward.type > 0 and isItemRune(reward.itemid)) then
			result = reward.type .. " charges " .. ret.name
		elseif(reward.type > 0 and isItemStackable(reward.itemid)) then
			result = reward.type .. " " .. ret.plural
		else
			result = ret.article .. " " .. ret.name
		end
	else
		if(size > 20) then
			reward = doCopyItem(item, false)
		elseif(size > 8) then
			reward = getThing(doCreateItemEx(1988, 1))
		else
			reward = getThing(doCreateItemEx(1987, 1))
		end

		for i = 1, size do
			local tmp = doCopyItem(items[i], true)
			if(doAddContainerItemEx(reward.uid, tmp.uid) ~= RETURNVALUE_NOERROR) then
				print("[Warning] QuestSystem:", "Could not add quest reward")
			else
				local ret = ", "
				if(i == 2) then
					ret = " and "
				elseif(i == 1) then
					ret = ""
				end

				result = result .. ret
				ret = getItemDescriptions(tmp.itemid)
				if(tmp.type > 0 and isItemRune(tmp.itemid)) then
					result = result .. tmp.type .. " charges " .. ret.name
				elseif(tmp.type > 0 and isItemStackable(tmp.itemid)) then
					result = result .. tmp.type .. " " .. ret.plural
				else
					result = result .. ret.article .. " " .. ret.name
				end
			end
		end
	end

	if(doPlayerAddItemEx(cid, reward.uid, false) ~= RETURNVALUE_NOERROR) then
		result = "You have found a reward. It is too heavy or you have not enough space."
	else
		result = "You have found " .. result .. "."
		setPlayerStorageValue(cid, storage, 1)
		if(questsExperience[storage] ~= nil) then
			doPlayerAddExp(cid, questsExperience[storage])
		end
	end

	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, result)
	return true
end

Also remove the chest ids if you want to use those.
XML:
<action itemid="1740" script="quests/quests.lua"/>
<action fromid="1747" toid="1749" script="quests/quests.lua"/>
 
Thank You thats worked,

but why is this so a big Code? xDD

Can you tell me why this work and what i can do and change with them?

And how i can insert a quest log when i have done a quest?
 
Thank You thats worked,

but why is this so a big Code? xDD

Can you tell me why this work and what i can do and change with them?

And how i can insert a quest log when i have done a quest?

For edit quest logs, got to XML/quests.xml
 
You don't have to change anything in this script. Only thing you need to do it add the items in the chest with action id 2000 and an uniqueid for the storage. The reason why it's big is because the script needs to check for alot of things also to let the textmessage show exactly what the player receives, the names, amount of items (with more then one the script adds it in a bag), charges, count, if it's to heavy or if a player doesn't have enough space to receive the item etc.
For the questlog you can look at this tutorial.
http://otland.net/f479/configuration-how-make-working-quest-log-143683/
 
Last edited:
I have a similar problem, i am using action id 2000 but dont know what to use for the unique id for the chest.. inside i have a bag with knight armor and knight legs..
Do you have to change the action id for each different quest chest?
 
Use actionid 2000, uniqueid must be different every chest, it doesn't matter which one you use, as long as you didn't use it already.
And just add the items separate in de chest, not in a bag, the script already adds it in a bag if you add more then 1 item in the chest.
 
Back
Top