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

Chest Problem

Real,

look on your map editor within this quest has the item, NO can have anything in the quest, only action + uniqueID.

so in your example test:

Action ID 2000
UniqueID 2195 and test

Make sure the map editor has nothing inside the quest, only actions
 
Idk if I'm right but
Lua:
if(getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF, cid)
		return true
	end
then try to test it on ordinary character with no privileges
 
Well, you most likely use another script for the quest-chest-system (or none at all), there are variations on it. Check a newer revision for the newest script.
 
Idk if I'm right but
Lua:
if(getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF, cid)
		return true
	end
then try to test it on ordinary character with no privileges

and where this goes?

thank you.
 
the problem is that you are placing an item inside the chest, what you need to do is give it an uid, then associate that uid with an action script, then on that action script you make the script that gives the player the item, pretty simple
 
the problem is that you are placing an item inside the chest, what you need to do is give it an uid, then associate that uid with an action script, then on that action script you make the script that gives the player the item, pretty simple

alright but in my other server I just have to put action id 2000 and the unique id and it gives the player the item..

so that means that If I make 100 quests i'm gonna have to make 100 scripts?
 
Create a new file into actions folder, system.lua

Code:
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.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

Code:
	<action actionid="2000" event="script" value="system.lua"/>

So, all chests need to be: action id = 2000, unique id = storage (can be Item ID) and containing the items.
 
THANK YOU! :D loney.. now is working fine..when you click on the chest the chest gives you the item.. but players can move the chests around.. lol how can I fix that?
 
Make sure you're not on your God character.
God characters can move uniqueID objects, whilst normal characters cannot.
 
Please help this script in my tfs 0.4 dont work
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.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, 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
 
Hey I'm back again with a problem I can't solve. I had the same problem that Real Steal was having but I manage to solve it.
Now I noticed something that wasn't right.
If I make a regular quest chest and do exactly the right way I get the item, everything works as it should do without problems happy happy :) BUT if I try to put 2 items inside the chest I will only get the item that I put first and the second one won't follow.
Now I've tried to put a backpack inside the chest and then put the items inside the backpack but then when i right click the chest in game i reicive only the backpack completely empty.... It is frustrating and I need to fix this! Anybody knows the problem? Please help me out REP++
 
You can do it like this.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	if item.uid == 2492 then
		if getPlayerStorageValue(cid,2492) == -1 then
			local bp = doPlayerAddItem(cid,1987,1)
			doAddContainerItem(bp,2492,1) 
			doAddContainerItem(bp,2414,1) 
			setPlayerStorageValue(cid,2492,1)
			doPlayerSendTextMessage(cid,25,'You have found a bag')
	elseif getPlayerStorageValue(cid,2492) == 1 then
		doPlayerSendTextMessage(cid,25,'It is empty.')
end
return 1
else
return 0
end
end
Add a line with the uniqueid to actions xml and only use that uniqueid in the chest.
 
Thx for the reply Limos. I'm sure it works that way, the problem is that the map itself has so many quests already and I was wondering if there was a way to make the quests work properly like they used to on my other servers.
I could make my quests from RME directly without any scripting or other stuff.. I'm too busy on other things i can't make .lua scripts for 200 quests :/

- - - Updated - - -

Anybody??.. Bump
 
Back
Top