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

quests

jwthbb

New Member
Joined
Apr 22, 2013
Messages
37
Reaction score
0
i have searched everywhere on this forum for quests. but i cant fix it.

i know that action id need to be 2000.

unique id is? everyone says its 32000etc but when i type that. it just opens nothing more. it doesnt give me anything. when i look in script quest. it says this

local annihilatorReward = {1990, 2400, 2431, 2494}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.uid <= 1250 or item.uid >= 30000 then
return false
end

local itemType = ItemType(item.uid)
if itemType:getId() == 0 then
return false
end

local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if isInArray(annihilatorReward, item.uid) then
if player:getStorageValue(30015) == -1 then
if playerCap >= itemWeight then
if item.uid == 1990 then
player:addItem(1990, 1):addItem(2326, 1)
else
player:addItem(item.uid, 1)
end
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(30015, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
end
elseif player:getStorageValue(item.uid) == -1 then
if playerCap >= itemWeight then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:addItem(item.uid, 1)
player:setStorageValue(item.uid, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
end
return true
end



please help me. cant figure this shit out
 
In your map editor get the chest action id 22001 and the unique id to whatever you like (for example 1000) then puit the item you want to reward to be in the chest.
put this in actions.xml:
<action actionid="22001" script="scrips/Questbox.lua" />

and make this script named Questbox.lua in your scripts map:
Code:
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) == 1 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.')
            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, 1)
        end
    end

    return true
end
 
Back
Top