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

Help on making hidden features on map

RealRolePlayer

New Member
Joined
Oct 28, 2015
Messages
19
Reaction score
0
I'd like to add some hidden stone piles that are activated only when using a pick on the determined place.. How should I do it?
 
THIS is what it looks like, and heres the code.

actions/scripts
Lua:
local config = {
    pickaxeusedon = 1285,-- ID of item pickaxe was used on
    pickuse = Position(993, 1007, 7), -- where do you need to use the pickaxe
    passage = Position(992, 1007, 7), -- where does the hole appear
    spawn = 383, -- ID of the hole
    cover = 836, -- ID of the item that will cover the hole
    time = 3*1000 -- How much time before the hole closes again, change 3 to anything you want.
}

local function fixStone(pos)
    local item = Tile(pos):getItemById(1336)
    if item then
        item:transform(1285)
        config.pickuse:sendMagicEffect(CONST_ME_POFF)
    end
    Game.createItem(config.cover, 1, config.passage)
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if (toPosition == config.pickuse) and (target:isItem() and target.itemid == config.pickaxeusedon) then
        config.passage:sendMagicEffect(CONST_ME_POFF)
        target:transform(1336)
        Game.createItem(config.spawn, 1, config.passage)
        addEvent(fixStone, config.time, toPosition)
        return true
    end
    return false
end

actions.xml
XML:
<action itemid="2553" script="filename" />

Would have never done it without Xeraphus as he is the one teaching me lua :p:p:rolleyes:
 
Last edited:
Back
Top