• 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 text above teleport for tfs 1.3

Opatulek

New Member
Joined
Apr 25, 2021
Messages
22
Reaction score
2
Hello! I spent two hours looking for a script that works on tfs 1.3, however I found nothing useful for my tfs version,(1.3 otbr serv) I need a script for text effects above teleport Like on this photo.. 1620664380053.png

I will be grateful for any help <3
 
Solution
Here is a example TFS 1.3

data/scripts/texteffects.lua
Lua:
local config = {
    interval = 5000,
    texts = {
        { pos = Position(3191, 1810, 7), text = "Temple!", effects = { CONST_ME_TELEPORT, CONST_ME_DRAWBLOOD } },
        { pos = Position(3188, 1811, 7), text = "Depots!", effects = { CONST_ME_ICEAREA, CONST_ME_ENERGYHIT } },
        { pos = Position(3191, 1814, 7), text = "Skills!", effects = { CONST_ME_ENERGYAREA, CONST_ME_FERUMBRAS } }
    }
}

local textOnMap = GlobalEvent("TextOnMap")

function textOnMap.onThink(interval)
    local player = Game.getPlayers()[1]
    if not player then
        return true
    end

    for k, info in pairs(config.texts) do...

Bar T

New Member
Joined
Sep 2, 2020
Messages
20
Reaction score
2
Try this

Lua:
local fields = {

{x = 553, y = 446, z = 7, text = "Exp Room", eff = 21},

{x = 553, y = 446, z = 7, text = "", eff = 18},

{x = 281, y = 254, z = 8, text = "TP Room"}, -- text only

{x = 307, y = 254, z = 15, text = "Event", eff = CONST_ME_GROUNDSHAKER},

}



function onThink(interval)

   for i = 1, #fields do

     local pos = fields

[I]     local people = getSpectators(pos, 7, 5, false, true)

     if people then

       if pos.text then

         doCreatureSay(people[1], pos.text, TALKTYPE_MONSTER_SAY, true, 0, pos)

       end

       if pos.eff then

         doSendMagicEffect(pos, pos.eff)

       end

     end

   end

   return true
 
Last edited:
OP
Opatulek

Opatulek

New Member
Joined
Apr 25, 2021
Messages
22
Reaction score
2
Try this

local fields = { {x = 553, y = 446, z = 7, text = "Exp Room", eff = 21}, {x = 553, y = 446, z = 7, text = "", eff = 18}, {x = 281, y = 254, z = 8, text = "TP Room"}, -- text only {x = 307, y = 254, z = 15, text = "Event", eff = CONST_ME_GROUNDSHAKER}, } function onThink(interval) for i = 1, #fields do local pos = fields [I] local people = getSpectators(pos, 7, 5, false, true) if people then if pos.text then doCreatureSay(people[1], pos.text, TALKTYPE_MONSTER_SAY, true, 0, pos) end if pos.eff then doSendMagicEffect(pos, pos.eff) end end end return true[/I]
There is someting wrong, I add this script in data\scripts\globalevents\customs trying data\scripts\globalevents too, maybee this is bad location cause I don't see any error, script don't working, no effect on my floor (I changed x y z)
Post automatically merged:

I tried this:

local config = {
positions = {
{pos = {x = 970, y = 1072, z = 7}, text = "Hello Sir! How are you?", effects = {CONST_ME_MAGIC_BLUE}},
{pos = {x = 855, y = 972, z = 7}, text = "How are you?"}
},
effects = {CONST_ME_POFF, CONST_ME_TELEPORT, CONST_ME_MAGIC_RED}
}

function onThink(interval)
local people = getPlayersOnline()
if #people == 0 then
return true
end

for _, info in pairs(config.positions) do
doPlayerSay(people[1], info.text, TALKTYPE_MONSTER_SAY, false, 0, info.pos)
if info.effects and #info.effects > 0 then
doSendMagicEffect(info.pos, info.effects[math.random(#info.effects)])
elseif config.effects and #config.effects > 0 then
doSendMagicEffect(info.pos, config.effects[math.random(#config.effects)])
end
end
return true
end
teleport:register()

but have:
[2021-10-05 19:07:03.945] [error] Lua script error: C:\vcpkg\otservbr-global\data\scripts\globalevents\teleport.lua
...g\otservbr-global\data\scripts\globalevents\teleport.lua:25: attempt to index global 'teleport' (a nil value)
stack traceback:
[C]: in function '__index'
...g\otservbr-global\data\scripts\globalevents\teleport.lua:25: in main chunk
 
Last edited:

Kooda

Member
Joined
May 7, 2021
Messages
20
Solutions
4
Reaction score
12
Lua:
local config = {
positions = {
{pos = {x = 970, y = 1072, z = 7}, text = "Hello Sir! How are you?", effects = {CONST_ME_MAGIC_BLUE}},
{pos = {x = 855, y = 972, z = 7}, text = "How are you?"}
},
effects = {CONST_ME_POFF, CONST_ME_TELEPORT, CONST_ME_MAGIC_RED}
}

local teleport = GlobalEvent("teleport")

function teleport.onThink(interval)
local people = getPlayersOnline()
if #people == 0 then
return true
end

for _, info in pairs(config.positions) do
doPlayerSay(people[1], info.text, TALKTYPE_MONSTER_SAY, false, 0, info.pos)
if info.effects and #info.effects > 0 then
doSendMagicEffect(info.pos, info.effects[math.random(#info.effects)])
elseif config.effects and #config.effects > 0 then
doSendMagicEffect(info.pos, config.effects[math.random(#config.effects)])
end
end
return true
end
teleport:interval(5000)
teleport:register()
 
OP
Opatulek

Opatulek

New Member
Joined
Apr 25, 2021
Messages
22
Reaction score
2
Lua:
[2021-11-05 22:20:22.546] [error] [GlobalEvents::think] - Failed to execute event: teleport
[2021-11-05 22:20:27.535] [error] Lua script error: C:\vcpkg\otservbr-global\data\scripts\teleport.lua:callback
C:\vcpkg\otservbr-global\data\scripts\teleport.lua:12: attempt to call global 'getPlayersOnline' (a nil value)
stack traceback:
        [C]: in function 'getPlayersOnline'
        C:\vcpkg\otservbr-global\data\scripts\teleport.lua:12: in function <C:\vcpkg\otservbr-global\data\scripts\teleport.lua:11>
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Support Team
Joined
Mar 16, 2017
Messages
894
Solutions
86
Reaction score
865
Location
London
GitHub
MillhioreBT
Here is a example TFS 1.3

data/scripts/texteffects.lua
Lua:
local config = {
    interval = 5000,
    texts = {
        { pos = Position(3191, 1810, 7), text = "Temple!", effects = { CONST_ME_TELEPORT, CONST_ME_DRAWBLOOD } },
        { pos = Position(3188, 1811, 7), text = "Depots!", effects = { CONST_ME_ICEAREA, CONST_ME_ENERGYHIT } },
        { pos = Position(3191, 1814, 7), text = "Skills!", effects = { CONST_ME_ENERGYAREA, CONST_ME_FERUMBRAS } }
    }
}

local textOnMap = GlobalEvent("TextOnMap")

function textOnMap.onThink(interval)
    local player = Game.getPlayers()[1]
    if not player then
        return true
    end

    for k, info in pairs(config.texts) do
        player:say(info.text, TALKTYPE_MONSTER_SAY, false, nil, info.pos)
        info.pos:sendMagicEffect(info.effects[math.random(1, #info.effects)])
    end
    return true
end

textOnMap:interval(config.interval)
textOnMap:register()
 
Solution
OP
Opatulek

Opatulek

New Member
Joined
Apr 25, 2021
Messages
22
Reaction score
2
Here is a example TFS 1.3

data/scripts/texteffects.lua
Lua:
local config = {
    interval = 5000,
    texts = {
        { pos = Position(3191, 1810, 7), text = "Temple!", effects = { CONST_ME_TELEPORT, CONST_ME_DRAWBLOOD } },
        { pos = Position(3188, 1811, 7), text = "Depots!", effects = { CONST_ME_ICEAREA, CONST_ME_ENERGYHIT } },
        { pos = Position(3191, 1814, 7), text = "Skills!", effects = { CONST_ME_ENERGYAREA, CONST_ME_FERUMBRAS } }
    }
}

local textOnMap = GlobalEvent("TextOnMap")

function textOnMap.onThink(interval)
    local player = Game.getPlayers()[1]
    if not player then
        return true
    end

    for k, info in pairs(config.texts) do
        player:say(info.text, TALKTYPE_MONSTER_SAY, false, nil, info.pos)
        info.pos:sendMagicEffect(info.effects[math.random(1, #info.effects)])
    end
    return true
end

textOnMap:interval(config.interval)
textOnMap:register()
Solved, it is working, huge thanks!
 
Top