• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

easy quesiton about quests storages

CheatsBCN

New Member
Joined
Mar 6, 2012
Messages
131
Reaction score
1
hello i have 3 quests in same room and i only want people to be able to choose one of em. on remeres map i know that on the chest box u gotta put the item id and then it will give u the item and put the storage value of the item number to 1, but if i want to set the storage of the others quest to 1 how should i proceed? i tryed adding this actions and this script for the 3

PHP:
	<action uniqueid="2453" event="script" value="arcane staff.lua" />
	<action uniqueid="8931" event="script" value="epiphany.lua" />
	<action uniqueid="2352" event="script" value="crystal arrow.lua" />



PHP:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 2453 or item.uid == 2352 or item.uid == 8931  then
queststatus = getPlayerStorageValue(cid,2453)
queststatus2 = getPlayerStorageValue(cid,2352)
queststatus3 = getPlayerSorageValue(cid,8931)
if queststatus == -1 or queststatus2 == -1 or queststatus3 == -1 or  then
doPlayerSendTextMessage(cid,22,"You have found the Epiphany!.")
doPlayerAddItem(cid,8931,1 )
setPlayerStorageValue(cid,2453,1)
setPlayerStorageValue(cid,8931,1)
setPlayerStorageValue(cid,2352,1)
else
doPlayerSendTextMessage(cid,22,"It is empty!")
end
else
return 0
end
return 1
end
 
LUA:
function onUse(cid, item, frompos, item2, topos) 
if item.uid == 2453 or item.uid == 2352 or item.uid == 8931  then 
queststatus = getPlayerStorageValue(cid,23456) 
if queststatus == -1 then 
doPlayerSendTextMessage(cid,22,"You have found the here shoul b get item name or w/e!.") 
doPlayerAddItem(cid,item.uid,1 ) 
setPlayerStorageValue(cid,23456,1)  
else 
doPlayerSendTextMessage(cid,22,"It is empty!") 
end 
else 
return 0 
end 
return 1 
end
 
Last edited:
LUA:
function onUse(cid, item, frompos, item2, topos) 
if item.uid == 2453 or item.uid == 2352 or item.uid == 8931  then 
queststatus = getPlayerStorageValue(cid,23456) 
if queststatus == -1 then 
doPlayerSendTextMessage(cid,22,"You have found the here shoul b get item name or w/e!.") 
doPlayerAddItem(cid,item.uid,1 ) 
setPlayerStorageValue(cid,23456,1)  
else 
doPlayerSendTextMessage(cid,22,"It is empty!") 
end 
else 
return 0 
end 
return 1 
end

what the fuck is this? copy paste? wopnt work.. still gives 3 items
 
Last edited:
Code:
function onUse(cid, item, frompos, item2, topos) 
if item.uid == 2453 or item.uid == 2352 or item.uid == 8931 then 
queststatus = getPlayerStorageValue(cid,23456) 
if queststatus == 1 then
doPlayerSendTextMessage(cid,22,"It is empty!") 
else
doPlayerSendTextMessage(cid,22,"You have found the here shoul b get item name or w/e!.") 
doPlayerAddItem(cid,item.uid,1 ) 
setPlayerStorageValue(cid,23456,1)
end 
else 
return 0 
end 
return 1 
end

Maybe this is how it should be... keep in mind I'm far from a pro scripter. I just switched around the player storage check so that it checks if you have already done the quest before giving you the reward.

Thanks,
Amped RPG staff
 
Here's the code I use

questsystem.lua (place in data/actions/scripts/)
note:make sure to insert your action id of chests and storage value you want set on the 2nd line in code!
Code:
local specialQuests = {
    [ACTION ID OF CHESTS] = STORAGE VALUE OF CHESTS--inquisition
}

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.uid)
		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.uid)
				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 weighing " .. getItemWeight(reward.uid) .. " oz. 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])
			doSendAnimatedText(getCreaturePosition(cid), questsExperience[storage], TEXTCOLOR_WHITE)
		end
	end

	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, result)
	return true
end

Now all you have to do is set your line up in actions.xml as
Code:
<action actionid="Action ID of chests" event="script" value="questsystem.lua"/>

This code will automatically take the action id of chest you use and set a storage value to it so that you cannot access other chests of the same action id.

Thanks,
AmpedRPG

P.s. I need help here... xD?

- - - Updated - - -

This script also allows you to set multiple chest groups up.

Just add another line in ur actions.xml like you did before and edit the script like so
Code:
local specialQuests = {
	[2001] = 30015, --Annihilator
    [2002] = 12000 --inquisition
}
 
Back
Top