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

Solved [Help] I cannot get quests to work.

Robxxxx

New Member
Joined
Aug 28, 2015
Messages
18
Reaction score
0
Anyone willing h to show me what I'm doing wrong or how to do this correctly. I basically want to repeat the anni chest system, 3-4 chests you pick one reward. I've tried following some of the tutorials but all I get are errors, thanks in advance, Rob.
 
so what do i change here to pick only one? im not sure which uniqe id im supposed to change.

<action actionid="2001" script="reward.lua"/>

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local chest = Container(item.uid)

if not chest then
return true
end

local uniqueid = chest:getUniqueId()
if player:getStorageValue(uniqueid) == -2 then
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
return true
end

local reward = nil
local start = player:getStorageValue(uniqueid) == -1 and 0 or player:getStorageValue(uniqueid)

for i = start, chest:getSize() do
reward = chest:getItem(i)
if not reward then
break
end

if reward:getWeight() > player:getFreeCapacity() then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. reward:getName() .. ' weighing ' .. reward:getWeight()/100 .. ' oz it\'s too heavy.')
player:setStorageValue(uniqueid, i)
break
else
local reward_container = Container(reward:getUniqueId())
if reward_container then
reward_container = reward_container:clone()
reward_container:moveTo(player)
else
player:addItem(reward:getId(), reward:getCount())
end
local reward_msg = reward:getArticle() .. ' ' .. reward:getName()
if reward:getCount() > 1 then
reward_msg = reward:getCount() .. ' ' .. reward:getPluralName()
end

player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found ' .. reward_msg .. '.')

player:setStorageValue(uniqueid, -2)
end
end

return true
end
 
Back
Top