Mr Noxi
Noxus Otserver
Hellos,
So i just came across this issue in my quest system.
Say a player has no space in backpack and opens the chest, player gets the EXP added but the item get dropped on floor
Part of the code below
The chest system code below
Any idea what i might need to add so the player can get a msg that he needs to clear a spot for the reward item before getting the item?
Appreciate the help!
So i just came across this issue in my quest system.
Say a player has no space in backpack and opens the chest, player gets the EXP added but the item get dropped on floor
Part of the code below
Lua:
expReward = 9000000,
item_reward = {
[1] = {itemid = 11304, count = 1} --Mighty Ring quest Knight
}
},
The chest system code below
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player = Player(player)
chest = questChests[item:getAttribute('uid')]
if not chest then return true end
--------------Check if player has already opened the chest-----
if player:getStorageValue(item:getAttribute('uid')) == 1 then
return player:sendCancelMessage("The chest is empty.")
end
--------------Check if player has quest status-----------------
if chest.storage and chest.status then
if player:getStorageValue(chest.storage) ~= chest.status then
return player:sendCancelMessage(chest.questMsg_fail)
end
end
---------------Check if player has level requirement------------
if chest.levelReq then
if player:getLevel() < chest.levelReq then
return player:sendCancelMessage("You must be level "..chest.levelReq.. " to open this chest.")
end
end
--------------Check if player has key required-------------------
if chest.keyReq then
if player:getItemCount(chest.keyReq) < 1 then
return player:sendCancelMessage("This chest requires a key to open.")
end
end
------------Give player EXP reward-------------------------------
if chest.vocation then
if not table.contains(chest.vocation.id, player:getVocation():getId()) then
return player:sendCancelMessage("Your vocation cannot open this chest.")
end
end
if chest.expReward then
player:addExperience(chest.expReward, true)
end
------------Give player reward items---------------------
if chest.item_reward then
for i = 1, #chest.item_reward do
player:addItem(chest.item_reward[i].itemid, chest.item_reward[i].count, 1)
end
end
------------Give player outfit reward--------------------
if chest.outfit_reward then
for i = 1, #chest.outfit_reward do
if player:getSex() == 0 then
player:addOutfit(chest.outfit_reward[i].female, chest.outfit_reward[i].addons)
else
player:addOutfit(chest.outfit_reward[i].male, chest.outfit_reward[i].addons)
end
end
end
-----------Give player addon reward-----------------------
if chest.addon_reward then
for i = 1, #chest.addon_reward do
if player:getSex() == 0 then
if chest.addon_reward.addons == 1 then
player:addOutfitAddon(chest.addon_reward[i].female, 1)
else
player:addOutfitAddon(chest.addon_reward[i].female, 1)
player:addOutfitAddon(chest.addon_reward[i].female, 2)
end
else
if chest.addon_reward.addons == 1 then
player:addOutfitAddon(chest.addon_reward[i].male, 1)
else
player:addOutfitAddon(chest.addon_reward[i].male, 1)
player:addOutfitAddon(chest.addon_reward[i].male, 2)
end
end
end
end
----------Give player mount reward--------------------------
if chest.mount_reward then
for i = 1, #chest.mount_reward do
player:addMount(chest.mount_reward[i].mountId)
end
end
if chest.questStatus then
player:setStorageValue(chest.questStorage, chest.questStatus + 1)
end
player:sendCancelMessage("You have recieved your reward.")
player:setStorageValue(item:getAttribute('uid'), 1)
return false
end
Any idea what i might need to add so the player can get a msg that he needs to clear a spot for the reward item before getting the item?
Appreciate the help!
Last edited: