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

Stacks of crystal coins in chests

leileililasian

New Member
Joined
Sep 27, 2009
Messages
50
Reaction score
0
I have been able to put a single crystal coin in chests but im trying to put multiple coins in there and its not exactly working. Can someone help me. The players can get the crystal coin but with what i have tried they only recieve 1.
 
go in your map editor, double click on the crystal coin you put inside the chest and there will be a count option, put whatever amount you want there. 100= 100cc etc
 
I have done that, and it did not work, i tried that before i posted on here.

- - - Updated - - -

Lua:
local t = {
[6001] = {8001,"crocodile boots",3982},
[6002] = {8002,"crystal coin",2160},
[6003] = {8003,"rope",2120},
[6004] = {8004,"blue robe",2656},
[6005] = {8005,"knight legs",2477},
[6006] = {8006,"spellbook",2175},
[6007] = {8007,"golden armor",2466},
[6008] = {8008,"steel boots",2645},
[6009] = {8009,"crystal coin",2160},
[6010] = {8010,"demon helmet",2493},
[6011] = {8011,"dragon shield",2516},
[6012] = {8012,"warrior helmet",2475},
[6013] = {8002,"robe of the underworld",8890},
[6014] = {8003,"demon legs",2495},
[6015] = {8003,"rainbow shield",8905},
[6016] = {8003,"spellbook of dark mysteries",8918},
[6017] = {8003,"royal crossbow",8851},
[6018] = {8004,"serpent sword",2409}
}
 
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = t[item.uid]
      if getPlayerStorageValue(cid,v[1]) == -1 and getPlayerFreeCap(cid) >= (getItemWeightById(v[3])) then
         setPlayerStorageValue(cid,v[1],1)
               doPlayerAddItem(cid,v[3])
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a " .. v[2] .. "!")
         elseif getPlayerStorageValue(cid,v[1]) == 1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty")
         elseif getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. ".00 oz in order to get the item")
                 end
     return true
end



I use this script, how would i script it with a count=30 wit the crystal coin.
 
Last edited by a moderator:
Check if this works

replace:
Code:
[6002] = {8002,"crystal coin",2160},

with :

Code:
[6002] = {8002,"crystal coin",2160,[COLOR="#FF0000"]10[/COLOR]},

10 being the amount of crystal coints.
 
Lua:
local t = {
[6001] = {8001,"crocodile boots",3982,1},
[6002] = {8002,"crystal coin",2160,10},
[6003] = {8003,"rope",2120,1},
[6004] = {8004,"blue robe",2656,1},
[6005] = {8005,"knight legs",2477,1},
[6006] = {8006,"spellbook",2175,1},
[6007] = {8007,"golden armor",2466,1},
[6008] = {8008,"steel boots",2645,1},
[6009] = {8009,"crystal coin",2160,10},
[6010] = {8010,"demon helmet",2493,1},
[6011] = {8011,"dragon shield",2516,1},
[6012] = {8012,"warrior helmet",2475,1},
[6013] = {8002,"robe of the underworld",8890,1},
[6014] = {8003,"demon legs",2495,1},
[6015] = {8003,"rainbow shield",8905,1},
[6016] = {8003,"spellbook of dark mysteries",8918,1},
[6017] = {8003,"royal crossbow",8851,1},
[6018] = {8004,"serpent sword",2409,1}
}
 
function onUse(cid,item,fromPosition,itemEx,toPosition)
	local v = t[item.uid]
   	if getPlayerStorageValue(cid,v[1]) == -1 and getPlayerFreeCap(cid) >= (getItemWeightById(v[3])) then
         	setPlayerStorageValue(cid,v[1],1)
       		doPlayerAddItem(cid,v[3],v[4])
               	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a " .. v[2] .. "!")
      	elseif getPlayerStorageValue(cid,v[1]) == 1 then
               	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty")
      	elseif getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then
               	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. ".00 oz in order to get the item")
      	end
     	return true
end

If you also want the textmessage to change in "You have found 10 crystal coins", then I need to know which server you use or you can change the names in the table to for example a rope and 10 crystal coins.
Then remove the "a" in the textmessage.
 
Last edited:
ok i will try this

- - - Updated - - -

The script did not work i got this error
[26/06/2013 09:43:16] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/chest sys.lua:20: ')' expected near 'v'
[26/06/2013 09:43:16] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/chest sys.lua)
[26/06/2013 09:43:16] data/actions/scripts/quests/chest sys.lua:20: ')' expected near 'v'

0.3.6, 8.54
 
Last edited:
Lua:
local t = {
[6001] = {8001,"crocodile boots",{3982,1}},
[6002] = {8002,"crystal coin",{2160,10}},
[6003] = {8003,"rope",{2120,1}},
[6004] = {8004,"blue robe",{2656,1}},
[6005] = {8005,"knight legs",{2477,1}},
[6006] = {8006,"spellbook",{2175,1}},
[6007] = {8007,"golden armor",{2466,1}},
[6008] = {8008,"steel boots",{2645,1}},
[6009] = {8009,"crystal coin",{2160,10}},
[6010] = {8010,"demon helmet",{2493,1}},
[6011] = {8011,"dragon shield",{2516,1}},
[6012] = {8012,"warrior helmet",{2475,1}},
[6013] = {8002,"robe of the underworld",{8890,1}},
[6014] = {8003,"demon legs",{2495,1}},
[6015] = {8003,"rainbow shield",{8905,1}},
[6016] = {8003,"spellbook of dark mysteries",{8918,1}},
[6017] = {8003,"royal crossbow",{8851,1}},
[6018] = {8004,"serpent sword",{2409,1}}
}
 
function onUse(cid,item,fromPosition,itemEx,toPosition)
	local v = t[item.uid]
   	if getPlayerStorageValue(cid,v[1]) == -1 and getPlayerFreeCap(cid) >= (getItemWeightById(v[3])) then
         	setPlayerStorageValue(cid,v[1],1)
       		doPlayerAddItem(cid,v[3],v[4])
               	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a " .. v[2] .. "!")
      	elseif getPlayerStorageValue(cid,v[1]) == 1 then
               	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty")
      	elseif getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then
               	doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. ".00 oz in order to get the item")
      	end
     	return true
end
 
Back
Top