• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Unique/Actions ID Chests

Captain Orhotek

New Member
Joined
May 20, 2009
Messages
118
Reaction score
1
How would I go about making three chests that give you different items...such as one gives a 100x mana rune and another gives an aol. But you can only use one of them and when you use it a certain amount of money is taken from you. Sort of like the way the arena works.
 
LUA:
	config = {
		cost = 1000,
		storage = 5010,
		items = { --     id,count
			item_1 = {2494,1},  -- Demon Armor 
			item_2 = {2400,1},  -- Magic Sword
			item_3 = {2431,1},  -- Stonecutter Axe
			item_4 = {2421,1}   -- Thunder Hammer
		}
	}

function onUse(cid, item, frompos, item2, topos)
if doPlayerRemoveMoney(cid,config.cost) == TRUE then
   	if getPlayerStorageValue(cid,config.storage) == -1 then
   		if item.uid == 5001 then
			newItem = config.items.item_1[1]
			count = config.items.item_1[2]
   		elseif item.uid == 5002 then
			newItem = config.items.item_2[1]
			count = config.items.item_2[2]
   		elseif item.uid == 5003 then
			newItem = config.items.item_3[1]
			count = config.items.item_3[2]
   		elseif item.uid == 5004 then
			newItem = config.items.item_4[1]
			count = config.items.item_4[2]
		end

		-- MSG  Config -----------------------------------------------------------------------------------------------------------------
		msgEmpty = "It is empty."
		msgGetItem = "You have found "..getItemArticleById(newItem).." "..getItemNameById(newItem).."."
		msgNoCap = "You have found a "..getItemNameById(newItem).." weighing "..getItemWeightById(newItem,count).." oz it is too heavy."
		--------------------------------------------------------------------------------------------------------------------------------

		if getPlayerFreeCap(cid) >= getItemWeightById(newItem,count) then
   			setPlayerStorageValue(cid,config.storage,1)
   			doPlayerAddItem(cid,newItem,count)
   			doPlayerSendTextMessage(cid,21,msgGetItem)
		else
			doPlayerSendTextMessage(cid,21,msgNoCap)
		end
   	else
   		doPlayerSendTextMessage(cid,21,msgEmpty)
   	end
end
return TRUE
end

I edited my anni chests script :thumbup:.

Regards,
Shawak
 
Thank you that works great but is there any way to make each chest cost a certain amount? And where you can only use chest once without that amount being used each time :D..not that it bothers me I can just make a note to say only use it once..but figured I would ask.

Or would the only way to do that is have three different scripts and one for each chest.
 
Last edited:
Back
Top