• 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 TFS1.5 Thais Lighthouse Quest Support

dyl12189

New Member
Joined
Nov 4, 2023
Messages
13
Reaction score
1
I am trying to have the portal appear when someone is hits the lever after the hidden stairs.

Here is my code so far:

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    --first lever to open the ladder
    if item.actionid == 50023 then
        local laddertile = Tile(Position({x = 32225, y = 32276, z = 8}))
            if item.itemid == 1945 then
                laddertile:getItemById(9021):transform(369)
                item:transform(1946)
            else
                laddertile:getItemById(369):transform(9021)
                item:transform(1945)
            end
    --second lever to open the portal to cyclops
    elseif item.actionid == 50024 then
        local portaltile = Tile(Position({x = 32232, y = 32276, z = 9}))
        if item.itemid == 1945 then
            if portaltile:getItemById(1387) then
                portaltile:getItemById(1387):remove()
            else
                local portal = Game.createItem(1387, 1, {x = 32232, y = 32276, z = 9})
                if portal then
                    portal:setActionId(50026)
                end
                item:transform(1946)
            end
        else
            if portaltile:getItemById(1387) then
                portaltile:getItemById(1387):remove()
                item:transform(1945)
            end
        end
    end
    return true
end

The first half works in changing the muddy floor to a ladder but I can't get the teleporter to spawn in.
 
Solution
See if this will fix it, otherwise you should add some print statements to identify where the issue occurs.

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    --first lever to open the ladder
    if item.actionid == 50023 then
        local laddertile = Tile(Position(32225, 32276, 8))
            if item.itemid == 1945 then
                laddertile:getItemById(9021):transform(369)
                item:transform(1946)
            else
                laddertile:getItemById(369):transform(9021)
                item:transform(1945)
            end
    --second lever to open the portal to cyclops
    elseif item.actionid == 50024 then
        local portaltile = Tile(Position(32232, 32276, 9))
        if...
No console errors.

Here is my actions.xml script:

Lua:
<action fromaid="50023" toaid="50024" script="quests/Thais/thaisLightHouseLever.lua" />

and a screenshot of the map from RME:

1700370379758.png

1700370461019.png
 
See if this will fix it, otherwise you should add some print statements to identify where the issue occurs.

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    --first lever to open the ladder
    if item.actionid == 50023 then
        local laddertile = Tile(Position(32225, 32276, 8))
            if item.itemid == 1945 then
                laddertile:getItemById(9021):transform(369)
                item:transform(1946)
            else
                laddertile:getItemById(369):transform(9021)
                item:transform(1945)
            end
    --second lever to open the portal to cyclops
    elseif item.actionid == 50024 then
        local portaltile = Tile(Position(32232, 32276, 9))
        if item.itemid == 1945 then
            local portal = Game.createItem(1387, 1, Position(32232, 32276, 9))
            if portal then
                portal:setActionId(50026)
            end
            item:transform(1946)
        else
            if portaltile:getItemById(1387) then
                portaltile:getItemById(1387):remove()
                item:transform(1945)
            end
        end
    end
    return true
end
 
Solution
Back
Top