Ok, so this is the new system I made
I've been thinking, that doing so many chests for quests its kinda irritating,thats why I ,made the system, which is really easy to configure and add chests!
Now with weight check too!
data/actions/scripts/chest sys.lua
data/actions/actions.xml
How does it work? How can I edit it?
[6001] = {8001,magic sword,2400)
RED = UniqueID that will be set for chest at RME
GREEN = Storage Value (if this is repeated with other storages, only one chest will be opened)
BLUE = Name of the item
YELLOW = ItemID of the item
How can I add more?
Easy,
[6018] = {8004,boots of haste,2195}
data/actions/actions.xml
Once we added 1 more, we now go to actions.xml and put 6001-6018 instead of 6001-6017, cause we added a new one which is 6018
In the lua script, its just changing the UID, a new storage, and then name and ItemID!
Tested with TFS 0.3.6
Enjoy!
I've been thinking, that doing so many chests for quests its kinda irritating,thats why I ,made the system, which is really easy to configure and add chests!
Now with weight check too!
data/actions/scripts/chest sys.lua
Lua:
local t = {
[6001] = {8001,"magic sword",2400},
[6002] = {8001,"demon armor",2494},
[6003] = {8001,"stonecutter axe",2431},
[6004] = {8001,"annihilation bear",2326},
[6005] = {8002,"emerald sword",8930},
[6006] = {8002,"obsidian truncheon",8928},
[6007] = {8002,"hellforged axe",8924},
[6008] = {8002,"royal crossbow",8851},
[6009] = {8002,"warsinger bow",8854},
[6010] = {8002,"spellbook of dark mysteries",8918},
[6011] = {8002,"master archers armor",8888},
[6012] = {8002,"fireborn giant armor",8881},
[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
data/actions/actions.xml
XML:
<action uniqueid="6001-6017" event="script" value="chest sys.lua"/>
How does it work? How can I edit it?
[6001] = {8001,magic sword,2400)
RED = UniqueID that will be set for chest at RME
GREEN = Storage Value (if this is repeated with other storages, only one chest will be opened)
BLUE = Name of the item
YELLOW = ItemID of the item
How can I add more?
Easy,
[6018] = {8004,boots of haste,2195}
data/actions/actions.xml
XML:
<action uniqueid="6001-6018" event="script" value="chest sys.lua"/>
Once we added 1 more, we now go to actions.xml and put 6001-6018 instead of 6001-6017, cause we added a new one which is 6018
In the lua script, its just changing the UID, a new storage, and then name and ItemID!
Tested with TFS 0.3.6
Enjoy!
Last edited: