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

Action [TFS 1x] ClickItems to CreateTeleport

underewar

Well-Known Member
Joined
Feb 9, 2013
Messages
60
Reaction score
71
Location
Brazil
GitHub
Underewarrr
Once the main stone appears it will be necessary to click on all the others so that they are again "normal" stones. Then the teleport appears.
Sem título-2022-06-27-1407.png
in addition you may be charged something to enter the tp after using the stones.

Enjoy.

data/scripts/action.xml

XML:
<action actionid = "10100" event = "script" value = "yourscript.lua" />


data/action/scripts/yourscript.lua

Lua:
local minutes = 5



local stones = {
 {pos = {x = 1037, y = 997, z = 7}},
 {pos = {x = 1041, y = 994, z = 7}},
 {pos = {x = 1045, y = 997, z = 7}},
}

local teleporter = {
 ['id'] = 1387,
 ['position.create'] = {x = 1041, y = 997, z = 7},
 ['position.send'] = {x = 1041, y = 992, z = 7},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

local a = item.actionid
if (not(a == 10100)) then
return true
end

if (getTileItemById(teleporter['position.create'], 1387).uid > 0) then
return true
end

if (item.itemid == 1304) then
    doSendMagicEffect(fromPosition, 52)
        else
    doSendMagicEffect(fromPosition, CONST_ME_POFF)
end

doTransformItem(item.uid, item.itemid == 1354 and 1304 or 1354)

local count = 0
for i = 1, #stones do
    local p = stones[i].pos
    if (getTileItemById(p, 1354).uid > 0) then
        count = count + 1
    end
end

if (count == #stones) then

    doCreatureSay(cid, "Sukcess!", TALKTYPE_ORANGE_1)
    doCreatureSay(cid, "The teleporter was created.", TALKTYPE_ORANGE_1)
    doSendMagicEffect(getCreaturePosition(cid), 49)
    doCreateTeleport(teleporter['id'], teleporter['position.send'], teleporter['position.create'])

    addEvent(function(cid)
        for v = 1, #stones do
            local s = stones[v].pos
            if (getTileItemById(s, 1354).uid > 0) then
                doTransformItem(getTileItemById(s, 1354).uid, 1304)
                doSendMagicEffect(s, CONST_ME_POFF)
            end
        end
        local tp = getTileItemById(teleporter['position.create'], teleporter['id']).uid
        if (tp > 0) then
            doRemoveItem(tp)
        end
    end, 60000 * minutes, cid)
end

return true
end

Configuration

Lua:
local minutes = 5 -- time to portal apear



local stones = {  -- Stone Position

 {pos = {x = 1037, y = 997, z = 7}},

 {pos = {x = 1041, y = 994, z = 7}},

 {pos = {x = 1045, y = 997, z = 7}},

}



local teleporter = { -- teleport config

 ['id'] = 1387,

 ['position.create'] = {x = 1041, y = 997, z = 7}, -- if fail where should be

 ['position.send'] = {x = 1041, y = 992, z = 7},

}
 
Back
Top