• 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+ does not send effect to position

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,751
Solutions
80
Reaction score
1,889
Location
Germany
for some reason it does not send the teleport effect as it should, feel free to let me know what I did wrong

Lua:
local rebornToPass = MoveEvent()
rebornToPass:type("stepin")

local config = {
    [52501] = { reborn = 5, des = "you must be atleast reborn 5 to access." },
    [52502] = { reborn = 10, des = "you must be atleast reborn 10 to access." },
    [52503] = { reborn = 15, des = "you must be atleast reborn 15 to access." },
    [52504] = { reborn = 20, des = "you must be atleast reborn 20 to access." },
    [52505] = { reborn = 25, des = "you must be atleast reborn 25 to access." },
    [52506] = { reborn = 30, des = "you must be atleast reborn 30 to access." },
    [52507] = { reborn = 35, des = "you must be atleast reborn 35 to access." },
    [52508] = { reborn = 40, des = "you must be atleast reborn 40 to access." },
    [52509] = { reborn = 45, des = "you must be atleast reborn 45 to access." },
    [52510] = { reborn = 50, des = "you must be atleast reborn 50 to access." }
}

function rebornToPass.onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local reb = config[item.actionid]
    if player:getReborn() < reb.reborn then
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, reb.des)
        player:teleportTo(fromPosition)
    end
    return true
end

for i = 52501, 52510 do
rebornToPass:aid(i)
end

rebornToPass:register()
 
effect still does not appear for some reason
It must be something to do with your player:getReborn() function

View attachment bandicam 2021-09-26 19-07-54-235.mp4

Find out what it prints.
Lua:
local rebornToPass = MoveEvent()
rebornToPass:type("stepin")

local config = {
    [52501] = { reborn = 5, des = "you must be atleast reborn 5 to access." },
    [52502] = { reborn = 10, des = "you must be atleast reborn 10 to access." },
    [52503] = { reborn = 15, des = "you must be atleast reborn 15 to access." },
    [52504] = { reborn = 20, des = "you must be atleast reborn 20 to access." },
    [52505] = { reborn = 25, des = "you must be atleast reborn 25 to access." },
    [52506] = { reborn = 30, des = "you must be atleast reborn 30 to access." },
    [52507] = { reborn = 35, des = "you must be atleast reborn 35 to access." },
    [52508] = { reborn = 40, des = "you must be atleast reborn 40 to access." },
    [52509] = { reborn = 45, des = "you must be atleast reborn 45 to access." },
    [52510] = { reborn = 50, des = "you must be atleast reborn 50 to access." }
}

function rebornToPass.onStepIn(player, item, position, fromPosition)
    if not player then
        return true
    end
    local reb = config[item:getActionId()]
    print("player:getReborn() -> " .. player:getReborn())
    if player:getReborn() < reb.reborn then
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, reb.des)
        player:teleportTo(fromPosition)
    end
    return true
end

for i = 52501, 52510 do
rebornToPass:aid(i)
end

rebornToPass:register()
Post automatically merged:

Put effect line after teleport line.
I read the entire post wrong.
This is the correct answer.
 
Weird if I do something like this as example

Lua:
local reborn50topass = MoveEvent()
reborn50topass:type("stepin")

function reborn50topass.onStepIn(player, item, position, fromPosition)
    if not player or player:isInGhostMode() then
        return true
    end
    if player:getReborn() < 50 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must be atleast reborn 50 to access.')
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition, true)
    end
    return true
end

reborn50topass:aid(5050)
reborn50topass:register()
Sorry, I read the post wrong.
I thought the entire block of code wasn't working instead of only the effect.
This is the correct answer.

You're sending the effect, and then teleporting the player.

You want to teleport the player, then send the effect at the players position.
 
Sorry, I read the post wrong.
I thought the entire block of code wasn't working instead of only the effect.
This is the correct answer.

You're sending the effect, and then teleporting the player.

You want to teleport the player, then send the effect at the players position.

Yes my fault I did not see his reply befor
edited my post above
Thanks for the help guys
 
Back
Top