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

This from 0.4 to 1.2?

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,755
Solutions
80
Reaction score
1,891
Location
Germany
Is it possible to edit this script? from tfs 0.4 to tfs 1.2.....

Lua:
function doNewSendAnimatedText(pos, text, color, cid)
    if tonumber(text) then
        text = tonumber(text)
        if cid and isPlayer(cid) then
            doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, '', text, color, pos)
        else
            local t = getSpectators(pos, 7, 5, false)
            if t then
                for _, cid in ipairs(t) do
                    if isPlayer(cid) then
                        doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE_OTHERS, '', text, color, pos)
                    end
                end
            end
        end
    else
        if cid and isCreature(cid) then
            doCreatureSay(cid, text, TALKTYPE_MONSTER)
        else
            local t = getSpectators(pos, 7, 5, false)
            if t then
                for _, cid in ipairs(t) do
                    if isPlayer(cid) then
                        doCreatureSay(cid, text, TALKTYPE_MONSTER, false, cid, pos)
                    end
                end
            end
        end
    end
end
 
Try this:
Lua:
function doNewSendAnimatedText(pos, text, color, creature)
    local pos = Position(pos)
    if creature and creature:isCreature() then
        if pos == nil then
            pos = Position(creature:getPosition())
        end
    else
        print("Error: doNewSendAnimatedText was called without a valid creature parameter.")
        return false
    end
    if pos == nil then
        print("Error: doNewSendAnimatedText was called without a valid position parameter.")
        return false
    end

    if tonumber(text) then
        text = tonumber(text)
        if creature:isPlayer() then
            creature:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
        else
            local t = Game.getSpectators(pos, false, true, 7, 7, 5, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
                end
            end
        end
    else
        if creature:isCreature() then
            creature:say(text, TALKTYPE_MONSTER)
        else
            local t = Game.getSpectators(pos, false, true, 7, 7, 5, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:say(text, TALKTYPE_MONSTER, false, spectator, pos)
                end
            end
        end
    end
    return true
end

References, using the TFS WIKI:

Metatable Position.

Metatable Creature:
isPlayer()
isCreature()
say(text, type[, ghost = false[, target = nil[, position]]])

Metatable Player:
sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]])

Metatable Game:
Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]])

Constants:
TalkType
Message
 
Last edited:
Try this:
Lua:
function doNewSendAnimatedText(pos, text, color, creature)
    local pos = Position(pos)
    if creature:isCreature() then
        if pos == nil then
            pos = Position(creature:getPosition())
        end
    else
        print("Error: doNewSendAnimatedText was called without a valid creature parameter.")
        return false
    end
    if pos == nil then
        print("Error: doNewSendAnimatedText was called without a valid position parameter.")
        return false
    end

    if tonumber(text) then
        text = tonumber(text)
        if creature:isPlayer() then
            creature:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
        else
            local t = Game.getSpectators(pos, false, true, 0, 7, 0, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
                end
            end
        end
    else
        if creature:isCreature() then
            creature:say(text, TALKTYPE_MONSTER)
        else
            local t = Game.getSpectators(pos, false, true, 0, 7, 0, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:say(text, TALKTYPE_MONSTER, false, spectator, pos)
                end
            end
        end
    end
    return true
end

References, using the TFS WIKI:

Metatable Position.

Metatable Creature:
isPlayer()
isCreature()
say(text, type[, ghost = false[, target = nil[, position]]])

Metatable Player:
sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]])

Metatable Game:
Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]])

Constants:
TalkType
Message
7, 7, 5, 5
also, make sure creature param exists in the first place before checking creature:isCreature()
 
Other question: This old script was befor at lib under functions. But where must I put it in tfs 1.2? Lib and then? Theres not anymore a 050-function lua ( never used tfs 1.2 befor, sorry )

EDIT: added it to compat.lua and tried to check if the script works ingame.. I get this error in console

Error: doNewSendAnimatedText was called without a valid creature parameter.
 
Last edited:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 50)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
function onCastSpell(cid, var)
local mana = 2500000
doPlayerAddMana(cid, mana)
doNewSendAnimatedText(getPlayerPosition(cid),"+"..mana.."", TEXTCOLOR_YELLOW)
return doCombat(cid, combat, var)
end
 
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 50)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
function onCastSpell(cid, var)
    local mana = 2500000
    doPlayerAddMana(cid, mana)
    doNewSendAnimatedText(nil, mana.."", TEXTCOLOR_YELLOW,cid)
    return doCombat(cid, combat, var)
end
 
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 50)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
function onCastSpell(cid, var)
    local mana = 2500000
    doPlayerAddMana(cid, mana)
    doNewSendAnimatedText(nil, mana.."", TEXTCOLOR_YELLOW,cid)
    return doCombat(cid, combat, var)
end

Dont get any error in console now but the animated text does not come up
 
Yes it works for certain function but the function doSendAnimatedText is no longer supported after 9.6 client I believe?
 
Lua:
function doNewSendAnimatedText(pos, text, color, creature)
    local pos = Position(pos)
    if creature and creature:isCreature() then
        if pos == nil then
            pos = Position(creature:getPosition())
        end
    else
        print("Error: doNewSendAnimatedText was called without a valid creature parameter.")
        return false
    end
    if pos == nil then
        print("Error: doNewSendAnimatedText was called without a valid position parameter.")
        return false
    end

    if tonumber(text) then
        text = tonumber(text)
        if creature:isPlayer() then
            creature:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
        else
            local t = Game.getSpectators(pos, false, true, 7, 7, 5, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
                end
            end
        end
    else
        if creature:isCreature() then
            creature:say(text, TALKTYPE_MONSTER_SAY)
        else
            local t = Game.getSpectators(pos, false, true, 7, 7, 5, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:say(text, TALKTYPE_MONSTER_SAY, false, spectator, pos)
                end
            end
        end
    end
    return true
end
 
Last edited:
Lua:
function doNewSendAnimatedText(pos, text, color, creature)
    local pos = Position(pos)
    if creature and creature:isCreature() then
        if pos == nil then
            pos = Position(creature:getPosition())
        end
    else
        print("Error: doNewSendAnimatedText was called without a valid creature parameter.")
        return false
    end
    if pos == nil then
        print("Error: doNewSendAnimatedText was called without a valid position parameter.")
        return false
    end

    if tonumber(text) then
        text = tonumber(text)
        if creature:isPlayer() then
            creature:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
        else
            local t = Game.getSpectators(pos, false, true, 7, 7, 5, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:sendTextMessage(MESSAGE_EXPERIENCE_OTHERS, text, pos, 0, color)
                end
            end
        end
    else
        if creature:isCreature() then
            creature:say(text, TALKTYPE_MONSTER_SAY)
        else
            local t = Game.getSpectators(pos, false, true, 7, 7, 5, 5)
            if t then
                for _, spectator in ipairs(t) do
                    spectator:say(text, TALKTYPE_MONSTER_SAY, false, spectator, pos)
                end
            end
        end
    end
    return true
end


Still does not show the animated text numbers ;d
 
Back
Top