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

TFS 1.X+ Training slot script

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
932
Solutions
23
Reaction score
445
Location
Santiago - Chile
Hi, I wonder if someone can help me with this. Got this error while using this script (TFS 1.4 nekiro), is supposed to teleport me to an empty training slot. Took the script from a datapack, that's why it is in polish. If someone can help me and adapt it to 1.4 will be appreciated a lot, thanks in advance!

moveevent.png

Code:
--- Edit by Collo~ gg: 7284838 (c)----

local pozycje = {
                {x=168,y=472,z=8,stackpos=STACKPOS_TOP_CREATURE},
                {x=179,y=472,z=8,stackpos=STACKPOS_TOP_CREATURE}
                }
local nowa_pozycja = {x=250,y=415,z=6}

local storage = 454574
local exh = 40 -- sec

function onStepIn(cid, item, position, fromPosition)

if exhaustion.check(cid, storage) ~= false then
    return doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You must to wait ' .. exhaustion.get(cid, storage) .. ' seconds to enter again.'), doTeleportThing(cid, fromPosition)
end

for i = 1, #pozycje do
    local wolne_miejsce = getThingFromPos(pozycje[i])
    if not(isCreature(wolne_miejsce.uid)) then
        doTeleportThing(cid, pozycje[i])
        doSendMagicEffect(pozycje[i], CONST_ME_TELEPORT)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[Training Room #"..i.."]. If you remain on this tile longer then 4 hours the system will automatically log you out.")
        exhaustion.set(cid, storage, exh)
        return true
    else
        if i == #pozycje then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The training monks are at their maximum capacity.")
            doTeleportThing(cid, nowa_pozycja)
            doSendMagicEffect(nowa_pozycja, CONST_ME_TELEPORT)
            exhaustion.set(cid, storage, exh)
            return true
        end
    end
end
exhaustion.set(cid, storage, exh)
return true
end
 

Evil Puncker

prolonged absenteeism
TFS Developer
Joined
May 30, 2009
Messages
8,041
Solutions
215
Reaction score
3,881
here:
 
Solution
OP
OP
ralke

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
932
Solutions
23
Reaction score
445
Location
Santiago - Chile
here:

Thanks a lot :)! This solves exhaustion, but now I have troubles with getThingFromPos, like is mentioned here Lua - Script Help - 'getThingFromPos' (a nil value) (https://otland.net/threads/script-help-getthingfrompos-a-nil-value.273567/#post-2635062), the function is written in compat.lua but didn't work.

getthingfrompos.png
 
Last edited:
Top