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

Use Item on Object to receive items

SebbePwnyou

New Member
Joined
Jan 14, 2015
Messages
19
Reaction score
3
Hello, Otland community I'm doing some custom things on a private server for myself and a few friends and I was curious if someone had a script where you can use a "pickaxe" on a rock to receive a random item from a list?
 
Solution
bleh, I don't know if you want it for every rock or a single rock.. mmmm, gonna make the pickaxe the focal point instead of the rock.
I'm not certain whether or not your pickaxe is already being used in another script..
But there is always the dwarven pickaxe as a back-up tool.
XML:
<action itemid="2553" event="script" value="pickaxe_treasure.lua"/>
Lua:
local random_items = {
    {1111, 1}, --{itemid, count}
    {1111, 1},
    {1111, 1},
    {1111, 1}
}
local rock = 111111 -- rock id

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == rock then
        local rand = math.random(#random_items)
        doPlayerAddItem(cid, random_items[rand][1], random_items[rand][2], true)
    end
    return true
end
bleh, I don't know if you want it for every rock or a single rock.. mmmm, gonna make the pickaxe the focal point instead of the rock.
I'm not certain whether or not your pickaxe is already being used in another script..
But there is always the dwarven pickaxe as a back-up tool.
XML:
<action itemid="2553" event="script" value="pickaxe_treasure.lua"/>
Lua:
local random_items = {
    {1111, 1}, --{itemid, count}
    {1111, 1},
    {1111, 1},
    {1111, 1}
}
local rock = 111111 -- rock id

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == rock then
        local rand = math.random(#random_items)
        doPlayerAddItem(cid, random_items[rand][1], random_items[rand][2], true)
    end
    return true
end
 
Solution
Back
Top