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

How to add a longer text above the teleport?

vexler222

Member
Joined
Apr 22, 2012
Messages
437
Solutions
6
Reaction score
13
How to add a longer text above the teleport?
8.6 tfs 0.4

Code:
local texts = {
    ["Huntsville"] = {{x=999, y=993, z=7}, {28, 39}, TALKTYPE_MONSTER}, -- ["text"] = {{position}, {effects}, animated_text_colour/talktype_monster}
    ["Teleports!"] = {{x = 17587, y = 17528, z = 7}, {28, 39}, TEXTCOLOR_GREY},   
    ["Castle24H"] = {{x = 17582, y = 17526, z = 7}, {37, 37}, TEXTCOLOR_ORANGE},
    ["Bank"] = {{x = 17563, y = 17562, z = 7}, {56, 56}, TEXTCOLOR_RED},
    ["Trainers"] = {{x = 18410, y = 18025, z = 6}, {28, 39}, TEXTCOLOR_RED},
    ["F E A R"] = {{x = 17582, y = 17534, z = 7}, {3}, TEXTCOLOR_RED},   
    ["VocQuest!"] = {{x = 17582, y = 17542, z = 7}, {13, 12}, TEXTCOLOR_RED},
    ["test test"] = {{x = 1000, y = 1000, z = 7}, {13, 12}, "TALKTYPE_MONSTER"}  -- talktype monster
}

function onThink(interval, lastExecution)
    local cid = 0
    for _, pid in ipairs(getPlayersOnline()) do
        if isPlayer(pid) then
            cid = pid
            break
        end
    end
    for text, param in pairs(texts) do
        if param[3] == "TALKTYPE_MONSTER" then
            if cid ~= 0 then
                doCreatureSay(cid, text, TALKTYPE_MONSTER, false, 0, param[1])
            end
        else
            doSendAnimatedText(param[1], text, param[3])
        end
        for i = 1, #param[2] do
            doSendMagicEffect(param[1], param[2][i])
        end
    end
    return true
end
 

Attachments

M0ustafa

1337
Senator
Joined
Mar 4, 2017
Messages
2,562
Solutions
315
Reaction score
1,133
Location
Egypt
The script above should be working for both functions like you are choosing between them.
doSendAnimatedTextor doCreatureSay
If you want it all to be doCreatureSay then just add "TALKTYPE_MONSTER" at the end of every line above, Should look like this one.
Lua:
local texts = {
    ["Huntsville"] = {{x=999, y=993, z=7}, {28, 39}, "TALKTYPE_MONSTER"}, -- ["text"] = {{position}, {effects}, animated_text_colour/talktype_monster}
    ["Teleports!"] = {{x = 17587, y = 17528, z = 7}, {28, 39}, "TALKTYPE_MONSTER"},   
    ["Castle24H"] = {{x = 17582, y = 17526, z = 7}, {37, 37}, "TALKTYPE_MONSTER"},
    ["Bank"] = {{x = 17563, y = 17562, z = 7}, {56, 56}, "TALKTYPE_MONSTER"},
    ["Trainers"] = {{x = 18410, y = 18025, z = 6}, {28, 39}, "TALKTYPE_MONSTER"},
    ["F E A R"] = {{x = 17582, y = 17534, z = 7}, {3}, "TALKTYPE_MONSTER"},   
    ["VocQuest!"] = {{x = 17582, y = 17542, z = 7}, {13, 12}, "TALKTYPE_MONSTER"},
    ["test test"] = {{x = 1000, y = 1000, z = 7}, {13, 12}, "TALKTYPE_MONSTER"}  -- talktype monster
}

function onThink(interval, lastExecution)
    local cid = 0
    for _, pid in ipairs(getPlayersOnline()) do
        if isPlayer(pid) then
            cid = pid
            break
        end
    end
     for text, param in pairs(texts) do
        if param[3] == "TALKTYPE_MONSTER" then
            if cid ~= 0 then
                doCreatureSay(cid, text, TALKTYPE_MONSTER, false, 0, param[1])
            end
        else
            doSendAnimatedText(param[1], text, param[3])
        end
        for i = 1, #param[2] do
            doSendMagicEffect(param[1], param[2][i])
        end
    end
    return true
end
 
Top