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

Level to Open Chest

drifter8779

Member
Joined
Oct 17, 2009
Messages
163
Reaction score
7
I looked all over the site, search Function, couldn't find anything

I need the script for The level required to open a chest

And if your not the required level you get a message saying so.

Also with a unique id that you can only open it once
 
Code:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 6666 then
   getPlayerStorageValue(cid,11133)
   getPlayerLevel(cid, 500)
  else
   doPlayerSendTextMessage(cid,22,"You need level 500 to open this chest.")
   if queststatus == -1 or queststatus == 0 then
   doPlayerSendTextMessage(cid,22,"You have found a Shadow Sceptre.")
   item_uid = doPlayerAddItem(cid,7451,1)
   setPlayerStorageValue(cid,11133,1)

  else
   doPlayerSendTextMessage(cid,22,"You have already done this quest.")
  end
else
  return 0
end
return 1
end
 
Last edited:
Wrong section? I need "Support" in finding this script.
Thanks btw

- - - Updated - - -

Says
PHP:
[Error - LuaScriptInterface::loadFile] data/actions/scripts/levelquestspirit.lua:16: 'end' expected (to close 'function' at line 1) near 'else'
[26/08/2012 03:03:43] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/levelquestspirit.lua)
[26/08/2012 03:03:43] data/actions/scripts/levelquestspirit.lua:16: 'end' expected (to close 'function' at line 1) near 'else'

And
PHP:
[26/08/2012 03:04:04] [Error - LuaScriptInterface::loadFile] data/actions/scripts/levelquestspirit.lua:17: '<eof>' expected near 'else'
[26/08/2012 03:04:04] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/levelquestspirit.lua)
[26/08/2012 03:04:04] data/actions/scripts/levelquestspirit.lua:17: '<eof>' expected near 'else'
 
Find a chest script, and add the following:

LUA:
local reqLevel = 100
if(getPlayerLevel(cid) >= reqLevel) then
If you supply me with your chest script, I will add it for you. ;)
 
Then, you just have to put every item in that chest on mapeditor and then set actionid as 2000 and an empty uniqueid.

Or you can use this script:
customchest.lua:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local ThisIsWarOfTheTitansScript = true
	
	local level = 100
	local str = 2020
	local itemsReward = {
		[1] = {2160, 1},
		[2] = {2173, 1},
		[3] = {2152, 1}
	}
	if(ThisIsWarOfTheTitansScript) then
		if(getPlayerLevel(cid) >= level) then
			if(getPlayerStorageValue(cid, str) < 0) then
				setPlayerStorageValue(cid, str, 1)
				for i = 1, #itemsReward do
					doPlayerAddItem(cid, itemsReward[i][1], itemsReward[i][2])
				end
				doSendMagicEffect(getCreaturePosition(cid), 12)
			else
				doPlayerSendCancel(cid, "It's empty")
				doSendMagicEffect(getCreaturePosition(cid), 2)
				return false
			end
		else
			doPlayerSendCancel(cid, "Sorry, not enough level. [lv. ".. level .."]")
			doSendMagicEffect(getCreaturePosition(cid), 2)
			return false
		end
	else
		doPlayerSendCancel(cid, "Not giving credits? bllluhuuhuh")
		doSendMagicEffect(getCreaturePosition(cid), 2)
		return false
	end
	return true
end

XML:
	<action actionid="8030" event="script" value="customchest.lua"/>

now, set the actionid, 8030 on the chest and it's done!
 
Last edited:
Ok WarofTheTitans, that seemed to work, but, the chest still opens so the player can still take the item out
Also, players cant deal out damage? whats with that, and they are not gaining any skill at all
 
Wait what? Use the script instead.
And not gaining skills is maybe somewhere in vocations.xml

It's the fist/axe/sword etc multiplier. You have to reduce it to 1.0 - 1.9
 
Sorry double post, also changed them, they were all below 2.0, still cant gain skill, or deal any damage what so ever, only skill i can gain is Fist, and even when i remove it, it still appears in the chest
 
Back
Top