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

Lua Use 30 items on rock remove stalagmite and create teleport

wafuboe

Member
Joined
Dec 24, 2010
Messages
881
Solutions
2
Reaction score
22
Hello,

Im having some issues doing the access for warzone 4,5,6, so im requesting if someone could use this part of this script to create something simple.

Use 30 gems on rock hollow geode, to remove stalagmite on x position open a teleport for x amount of time then add the stalagmite. Usinf tfs 1.4.2

thank you,

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player then
        return true
    end

    if not target:isItem() then
    return false
    end

    if target:isCreature() then
    return false
    end

    local WarzoneVI = Position(91, 212, 15)
    local WarzoneIV = Position(222, 98, 15)
    local WarzoneV = Position(140, 15, 15)
    local geodeId = 30166
    local targetPosition = target:getPosition()

    if targetPosition == WarzoneIV and target:getId() == geodeId then -- Warzone 4 BOSS!!!
        if Game.getStorageValue(GlobalStorageKeys.DangerousDepths.Geodes.WarzoneIV) < 30 then
            targetPosition:sendMagicEffect(CONST_ME_HITAREA)
            item:remove(1)
            if Game.getStorageValue(GlobalStorageKeys.DangerousDepths.Geodes.WarzoneIV) < 0 then
                Game.setStorageValue(GlobalStorageKeys.DangerousDepths.Geodes.WarzoneIV, 0)
            end
            Game.setStorageValue(GlobalStorageKeys.DangerousDepths.Geodes.WarzoneIV, Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneIV) + 1)
            if Game.getStorageValue(GlobalStorageKeys.DangerousDepths.Geodes.WarzoneIV) == 30 then
                local spectators = Game.getSpectators(targetPosition, false, true, 3, 3, 3, 3)
                for _, spectator in pairs(spectators) do
                    if spectator:isPlayer() then
                        spectator:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This crystal geode is shaking from a battle nearby.")
                    end
                end
                local stalagmites = Tile(Position(223, 98, 15)):getItemById(386)
                if stalagmites then
                    stalagmites:remove()
                    local teleport = Game.createItem(1387, 1, Position(223, 98, 15))
                    teleport:setActionId(57243)
                    addEvent(function()
                        if teleport then
                            teleport:remove(1)
                            Game.createItem(386, 1, Position(223, 98, 15))
                        end
                    end, 30*1000)
                    addEvent(clearForgotten, 30*60*1000, Position(295, 156, 15), Position(333, 174, 15), Position(225, 98, 15), GlobalStorage.DangerousDepths.Geodes.WarzoneIV)
                    startWarzoneIV()
                end
            end
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The crystal geode can't carry any more crystals.")
        end
    end
 
Well, you could just put a teleport in your map, instead of this stalagmite rock... It can't be simpler than that!

But if you want to use this script, maybe you could change the gem ID in 'actions.xml' for any other item to interact with stalagmite rock.

The world is full of possibilities, just pick one!
 
Well, you could just put a teleport in your map, instead of this stalagmite rock... It can't be simpler than that!

But if you want to use this script, maybe you could change the gem ID in 'actions.xml' for any other item to interact with stalagmite rock.

The world is full of possibilities, just pick one!
Hello,

Yeah thats my last resort just the teleport haha just dont wanted to be that simple. Thanks for the tip maybe the gemid is why its not working ill try:)

thanks
 
In my server I use pick on stalagmite rocks to 'break' them and create 'broken rocks'. Is written in .lua for 8.6 clients, with TSF 0.3.6, but the structure must be the same. Here's what look like

in 'actions.xml' the itemid is the pick. Notice that I put the file in the 'tools' folder.
XML:
<action itemid="2553" event="script" value="tools/pick.lua"/>

in 'pick.lua'
Lua:
local stalagmites = {391, 390, 387, 386} -- stalagmites ID's
-- local topos = { x=999, y=999, z=999 }
-- local createpos = { x=1000,  y=1000, z=1000 }
-- local gemID = 12345
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if(isInArray(stalagmites, itemEx.itemid)) then
        local rand = math.random(1, 100)
        if(rand >= 1 and rand <= 10)  then -- Insert your gemID condition with 'and getPlayerItemCount(cid, gemID) >= 30'
            doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
            doRemoveItem(itemEx.uid, 1)
            --doPlayerRemoveItem(cid, gemID , 30)
            doCreateTeleport(1387, topos, createpos) -- You can put your teleport here
            -- Here is for remove the teleport
            -- addEvent(function()
            -- doRemoveItem(getTileItemById(toPosition,1387).uid) 
            -- end, 598000)
            addEvent(doCreateItem, 600000, 387, 1, toPosition) -- After 10 minutes, the rock is back
        doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
        return true
end
    return false
end

Well, when you use the pick on the stalagmite rocks, there's a 10/100 chance to 'break' it and then create a teleport. After 10 minutes, everything's back to the normal. I hope it's understandable!
 
Just use playerstorage increment it on everytime its used on stalagmite and when its 30 reset counter and create teleport and if u want use different action ids for different teleports and stalagmites
 
Back
Top