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

TSF 1.5 Yalahar mechanism

pichetas

New Member
Joined
Nov 22, 2008
Messages
21
Reaction score
2
Hello, I've been looking for a yalahar mechanism action that works, but so far I've only seen from tfs 0.4-, and it doesnt work on my server, I'll post here the action.lua that I'm using

Lua:
local t = {
    [51151] = {x=32729, y=31200, z=5},
    [51152] = {x=32734, y=31200, z=5},
    [51153] = {x=32744, y=31161, z=5},
    [51154] = {x=32744, y=31164, z=5},
    [51155] = {x=32776, y=31141, z=5},
    [51156] = {x=32776, y=31145, z=5},
    [51159] = {x=32874, y=31202, z=5},
    [51160] = {x=32869, y=31202, z=5},
    [51161] = {x=32855, y=31252, z=5},
    [51162] = {x=32853, y=31248, z=5},
    [51163] = {x=32834, y=31269, z=5},
    [51164] = {x=32833, y=31266, z=5},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tmp = getThingPos(cid)
    doTeleportThing(cid, t[item.uid])
    doSendMagicEffect(tmp, CONST_ME_TELEPORT)
    doSendMagicEffect(t[item.uid], CONST_ME_TELEPORT)
    return true
end

And in actions.xml i have this
XML:
<action actionid="51151" script="yalahar_mechanism.lua"/>
<action actionid="51152" script="yalahar_mechanism.lua"/>
<action actionid="51153" script="yalahar_mechanism.lua"/>
<action actionid="51154" script="yalahar_mechanism.lua"/>
<action actionid="51155" script="yalahar_mechanism.lua"/>
<action actionid="51156" script="yalahar_mechanism.lua"/>
<action actionid="51159" script="yalahar_mechanism.lua"/>
<action actionid="51160" script="yalahar_mechanism.lua"/>
<action actionid="51161" script="yalahar_mechanism.lua"/>
<action actionid="51162" script="yalahar_mechanism.lua"/>
<action actionid="51163" script="yalahar_mechanism.lua"/>
<action actionid="51164" script="yalahar_mechanism.lua"/>

When I click on the mechanism, it says the following error:
Lua Script Error: [Action Interface]
data/actions/scripts/yalahar_mechanism.lua:eek:nUse
attempt to index a nil value
stack traceback:
[C]: at 0x5588bfb89c96
[C]: in function 'doTeleportThing'
data/actions/scripts/yalahar_mechanism.lua:17: in function <data/actions/scripts/yalahar_mechanism.lua:15>
 
look this ORTS script as example:
Lua:
local mechanisms = {
    [3091] = {pos = Position(32744, 31161, 5), value = 21}, -- Alchemist
    [3092] = {pos = Position(32744, 31164, 5), value = 21},
    [3093] = {pos = Position(32833, 31269, 5), value = 24}, -- Trade
    [3094] = {pos = Position(32833, 31266, 5), value = 24},
    [3095] = {pos = Position(32729, 31200, 5), value = 29}, -- Arena
    [3096] = {pos = Position(32734, 31200, 5), value = 29},
    [3097] = {pos = Position(32776, 31141, 5), value = 35}, -- Cemetery
    [3098] = {pos = Position(32776, 31145, 5), value = 35},
    [3099] = {pos = Position(32874, 31202, 5), value = 41}, -- Sunken
    [3100] = {pos = Position(32869, 31202, 5), value = 41},
    [3101] = {pos = Position(32856, 31251, 5), value = 45}, -- Factory
    [3102] = {pos = Position(32854, 31248, 5), value = 45}
}

local mechanisms2 = {
    [9235] = {pos = Position(32773, 31116, 7)},
    [9236] = {pos = Position(32780, 31115, 7)}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if(mechanisms[item.uid]) then
        if(player:getStorageValue(PlayerStorageKeys.InServiceofYalahar.Questline) >= mechanisms[item.uid].value) then
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:teleportTo(mechanisms[item.uid].pos)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        else
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The gate mechanism won't move. You probably have to find a way around until you figure out how to operate the gate.")
        end
    elseif(mechanisms2[item.uid]) then
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(mechanisms2[item.uid].pos)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    end
    return true
end
 
Hello, I've been looking for a yalahar mechanism action that works, but so far I've only seen from tfs 0.4-, and it doesnt work on my server, I'll post here the action.lua that I'm using

Lua:
local t = {
    [51151] = {x=32729, y=31200, z=5},
    [51152] = {x=32734, y=31200, z=5},
    [51153] = {x=32744, y=31161, z=5},
    [51154] = {x=32744, y=31164, z=5},
    [51155] = {x=32776, y=31141, z=5},
    [51156] = {x=32776, y=31145, z=5},
    [51159] = {x=32874, y=31202, z=5},
    [51160] = {x=32869, y=31202, z=5},
    [51161] = {x=32855, y=31252, z=5},
    [51162] = {x=32853, y=31248, z=5},
    [51163] = {x=32834, y=31269, z=5},
    [51164] = {x=32833, y=31266, z=5},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tmp = getThingPos(cid)
    doTeleportThing(cid, t[item.uid])
    doSendMagicEffect(tmp, CONST_ME_TELEPORT)
    doSendMagicEffect(t[item.uid], CONST_ME_TELEPORT)
    return true
end

And in actions.xml i have this
XML:
<action actionid="51151" script="yalahar_mechanism.lua"/>
<action actionid="51152" script="yalahar_mechanism.lua"/>
<action actionid="51153" script="yalahar_mechanism.lua"/>
<action actionid="51154" script="yalahar_mechanism.lua"/>
<action actionid="51155" script="yalahar_mechanism.lua"/>
<action actionid="51156" script="yalahar_mechanism.lua"/>
<action actionid="51159" script="yalahar_mechanism.lua"/>
<action actionid="51160" script="yalahar_mechanism.lua"/>
<action actionid="51161" script="yalahar_mechanism.lua"/>
<action actionid="51162" script="yalahar_mechanism.lua"/>
<action actionid="51163" script="yalahar_mechanism.lua"/>
<action actionid="51164" script="yalahar_mechanism.lua"/>

When I click on the mechanism, it says the following error:
Lua Script Error: [Action Interface]
data/actions/scripts/yalahar_mechanism.lua:eek:nUse
attempt to index a nil value
stack traceback:
[C]: at 0x5588bfb89c96
[C]: in function 'doTeleportThing'
data/actions/scripts/yalahar_mechanism.lua:17: in function <data/actions/scripts/yalahar_mechanism.lua:15>
Try that my friend, just modified a bit ;)
Lua:
local config = {
    [51151] = {mPos = Position(32729, 31200, 5)},
    [51152] = {mPos = Position(32734, 31200, 5)},
    [51153] = {mPos = Position(32744, 31161, 5)},
    [51154] = {mPos = Position(32744, 31164, 5)},
    [51155] = {mPos = Position(32776, 31141, 5)},
    [51156] = {mPos = Position(32776, 31145, 5)},
    [51159] = {mPos = Position(32874, 31202, 5)},
    [51160] = {mPos = Position(32869, 31202, 5)},
    [51161] = {mPos = Position(32855, 31252, 5)},
    [51162] = {mPos = Position(32853, 31248, 5)},
    [51163] = {mPos = Position(32834, 31269, 5)},
    [51164] = {mPos = Position(32833, 31266, 5)}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local t = config[item.uid]
    player:teleportTo(t.mPos)
    fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
    toPosition:sendMagicEffect(CONST_ME_TELEPORT)
    return true
end
 
Back
Top