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

[Action] Quest backpack with items inside for tfs 0.4

Knight God

Member
Joined
Oct 19, 2008
Messages
1,180
Reaction score
21
As I said, I need this script with these indications, thanks to JDB for help before. :thumbup::thumbup:^_^
 
data/actions/scripts/script.lua

Code:
local config = {
	[1001] = { -- ITEM ACTIONID
		level = 100,
		storage = 45551,
		container = 1987,
		items = {
			{ 2160, 1 }, { 2152, 1 }
		}
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v = config[item.actionid]
	if v then
		if getPlayerLevel(cid) >= v.level then
			if getPlayerStorageValue(cid, v.storage) < 0 then
				local item = doCreateItemEx(cid, v.container, 1)
				if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
					return doPlayerSendCancel(cid, "Sorry, you are unable to carry this.")
				end
			
				for i = 1, #v.items do
					doAddContainerItem(item, v.items[i][1], v.items[i][2] or 1)
				end
			
				doPlayerSendTextMessage(cid, "You have found a " .. getItemInfo(v.container).name .. ".")
				doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
				setPlayerStorageValue(cid, v.storage, 1)
			else
				return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
			end
		else
			return doPlayerSendCancel(cid, "Sorry, your level is too low.")
		end
	end
	
	return true
end
 
*TIP*:
You can also do such quests in RME without scripts, just use Action ID: 2000, Unique ID: some random under 65535 (2^16-1) and put in chest contents Backpack with items inside.
 
Back
Top