• 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 Globalevents Text Effect Change

Forkz

Well-Known Member
Joined
Jun 29, 2020
Messages
360
Solutions
1
Reaction score
76
Hi otlanders,
I'm using the script below, so I'd like to make a change, but I still don't have a choice.

Lua:
function onThink(interval, lastExecution)

local texts =
{
        ["Treiner Room"] = {{x=17577, y=17528, z=7}, 28, 39, TEXTCOLOR_WHITE},
        ["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, 3, TEXTCOLOR_RED},       
        ["VocQuest!"] = {{x=17582, y=17542, z=7}, 13, 12, TEXTCOLOR_RED}       
}

        for text, param in pairs(texts) do
                doSendAnimatedText(param[1], text, param[4])
                doSendMagicEffect(param[1], param[2])
                doSendMagicEffect(param[1], param[3])
        end
        return true
end

I would like to exchange the
Lua:
doSendAnimatedText(param[1], text, param[4])
for:
Lua:
doCreatureSay

any solution for the same?
 
Solution
S
found issue in script, param[4]? it ended at [3] already
Lua:
    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
When should it say a message on creature? Like (onStepIn,StepOut) and at which location? both are different functions.
Lua:
doSendAnimatedText(pos, text, color[, player])
doCreatureSay(uid, text[, type = SPEAK_SAY[, ghost = false[, cid = 0[, pos]]]])
 
which tfs are you using?
0.4
Post automatically merged:

When should it say a message on creature? Like (onStepIn,StepOut) and at which location? both are different functions.
Lua:
doSendAnimatedText(pos, text, color[, player])
doCreatureSay(uid, text[, type = SPEAK_SAY[, ghost = false[, cid = 0[, pos]]]])
It would be in the teleports, but "doSendAnimatedText" has the limit character and "doCreatureSay" is bigger.
Post automatically merged:

When should it say a message on creature? Like (onStepIn,StepOut) and at which location? both are different functions.
Lua:
doSendAnimatedText(pos, text, color[, player])
doCreatureSay(uid, text[, type = SPEAK_SAY[, ghost = false[, cid = 0[, pos]]]])
not work
Lua:
function onThink(interval, lastExecution)

local texts =
{
        ["Treiner Room"] = {{x=17577, y=17528, z=7}, 28, 39, TEXTCOLOR_WHITE},
        ["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, 3, TEXTCOLOR_RED},      
        ["VocQuest!"] = {{x=17582, y=17542, z=7}, 13, 12, TEXTCOLOR_RED}      
}

        for text, param in pairs(texts) do
            doSendAnimatedText(pos, text, color[, player])
            doCreatureSay(uid, text[, type = SPEAK_SAY[, ghost = false[, cid = 0[, pos]]]])
        end
        return true
end


otland.png
 
Lua:
local texts = {
    ["Treiner Room"] = {{x = 17577, y = 17528, z = 7}, {28, 39}, TEXTCOLOR_WHITE}, -- ["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[4] == "TALKTYPE_MONSTER" then
            if cid ~= 0 then
                doCreatureSay(cid, text, TALKTYPE_MONSTER, false, 0, param[1])
            end
        else
            doSendAnimatedText(param[1], text, param[4])
        end
        for i = 1, #param[2] do
            doSendMagicEffect(param[1], param[2][i])
        end
    end
    return true
end
 
Lua:
local texts = {
    ["Treiner Room"] = {{x = 17577, y = 17528, z = 7}, {28, 39}, TEXTCOLOR_WHITE}, -- ["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[4] == "TALKTYPE_MONSTER" then
            if cid ~= 0 then
                doCreatureSay(cid, text, TALKTYPE_MONSTER, false, 0, param[1])
            end
        else
            doSendAnimatedText(param[1], text, param[4])
        end
        for i = 1, #param[2] do
            doSendMagicEffect(param[1], param[2][i])
        end
    end
    return true
end
it didn't work, I used the code below
Lua:
["Treiner Room"] = {{x = 17577, y = 17528, z = 7}, {28, 39}, "TALKTYPE_MONSTER"}

otland.png
 
it didn't work, I used the code below
Lua:
["Treiner Room"] = {{x = 17577, y = 17528, z = 7}, {28, 39}, "TALKTYPE_MONSTER"}

View attachment 49421
try changing this line

from
Lua:
doCreatureSay(cid, text, TALKTYPE_MONSTER, false, 0, param[1])
to
Lua:
doCreatureSay(cid, text, TALKTYPE_MONSTER, false, nil, param[1])
 
try changing this line

from
Lua:
doCreatureSay(cid, text, TALKTYPE_MONSTER, false, 0, param[1])
to
Lua:
doCreatureSay(cid, text, TALKTYPE_MONSTER, false, nil, param[1])
i think it should be TALKTYPE_MONSTER_SAY, when i used 0.4 i used to use it that way
doSendAnimatedText(pos, text, TALKTYPE_ORANGE_1)
 
i think it should be TALKTYPE_MONSTER_SAY, when i used 0.4 i used to use it that way
doSendAnimatedText(pos, text, TALKTYPE_ORANGE_1)
makes more sense why it was showing up as black. lol
 
I couldn't make it work, the text keeps coming out "black"
It's gotta be one of those things. lol

Try all of these lines.

Lua:
doCreatureSay(cid, text, TALKTYPE_MONSTER, false, 0, param[1])
doCreatureSay(cid, text, TALKTYPE_MONSTER_SAY, false, 0, param[1])
doCreatureSay(cid, text, TALKTYPE_ORANGE_1, false, 0, param[1])

and/or

post your data\lib\000-constant.lua
 
found issue in script, param[4]? it ended at [3] already
Lua:
    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
 
Solution
Back
Top