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

Script Help

dfsuno

New Member
Joined
Jun 20, 2021
Messages
20
Reaction score
2
Could you help me, my script doesn't work I need that when the 3 monsters are in their position you can give tp, this script with only 1 being in position can use the tp.


Lua:
local monsters = {
    {name = "demon", position = {x = 655, y = 108, z = 3}},
    {name = "goblin", position = {x = 665, y = 108, z = 3}},
    {name = "orc", position = {x = 669, y = 108, z = 3}}
}

local lever = Action()
function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
   for _, monster in ipairs(monsters) do
        local tile = Tile(monster.position)
        if tile then
            local creature = tile:getTopCreature()
            if creature and creature:isMonster() and creature:getName():lower() == monster.name then
                player:say("Try your luck for the last time, you are not worthy of being here.")
                doTeleportThing(player, {x=672,y=124,z=1}) -- teleport room position
                doSendMagicEffect(getPlayerPosition(player), CONST_ME_TELEPORT)
                return true
            end
        end
    end
    player:say("The knights are not in their positions..")
    return true
end

lever:aid(25559)
lever:register()
 
Lua:
local monsters = {
    {name = "demon", position = {x = 655, y = 108, z = 3}},
    {name = "goblin", position = {x = 665, y = 108, z = 3}},
    {name = "orc", position = {x = 669, y = 108, z = 3}}
}

local lever = Action()
function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local count = 0
    for _, monster in ipairs(monsters) do
        local tile = Tile(monster.position)
        if tile then
            local creature = tile:getTopCreature()
            if creature and creature:isMonster() and creature:getName():lower() == monster.name then
                count = count + 1
            end
        end
    end
    if count == #monsters then
        player:say("Try your luck for the last time, you are not worthy of being here.")
        doTeleportThing(player, {x=672,y=124,z=1}) -- teleport room position
        doSendMagicEffect(getPlayerPosition(player), CONST_ME_TELEPORT)
        return true
    end
    player:say("The knights are not in their positions..")
    return true
end

lever:aid(25559)
lever:register()
 
Back
Top