• 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+ How to show animated text when removing an object from a corpse

Mateus Robeerto

Excellent OT User
Joined
Jun 5, 2016
Messages
1,337
Solutions
71
Reaction score
697
Location
ლ(ಠ益ಠლ)
does anyone know this script? if yes, please convert to tfs 1.2
the script is simple, I like it
Lua:
function onRemoveItem(moveitem, tileitem, pos)
    if moveitem.itemid >= 1 and moveitem.itemid <= 30000 then
        doSendAnimatedText(pos,getItemName(moveitem.itemid), TEXTCOLOR_ORANGE)
    end
end



I put this area by accident, please can some adm or mods move it to another support area thanks
 
Last edited:
Solution
can i put it anywhere data/events/scripts/player.lua?
was that I put it at the end before end
and it didn't work in the game, nothing error on the console
That goes inside the onMoveItem event.
Here's an example:

Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    -- onMoveItem Event
    if fromCylinder and fromCylinder:isItem() then
        if fromCylinder:getId() == 3065 then
            if toCylinder ~= fromCylinder then
                player:say(string.format("x%d %s", count, item:getName()), TALKTYPE_MONSTER_SAY, false, nil, fromCylinder:getPosition())
            end
        end
    end
    return true
end

You also need to activate the event in events.xml...
What do you want in your script for TFS 1.2 ?
I guess u are using DashPota
@Mateus Robeerto
I want to convert to tfs 1.2 by celehore yes, I've tried without success
Lua:
function onRemoveItem(creature, moveitem, tileitem, pos)
    if moveitem.itemid >= 1 and moveitem.itemid <= 30000 then
        Game.sendAnimatedText(creature:getPosition(),getItemName(moveitem.itemid), TEXTCOLOR_ORANGE)
    end
end


Code:
function onRemoveItem(creature, item, tile, fromPosition, toPosition)
    local itemid = item.itemid
    if itemid >= 1 and itemid <= 30000 then
        Game.sendAnimatedText(creature:getPosition(), getItemName(itemid), TEXTCOLOR_ORANGE)
    end
end

I tried several without success!!
 
new interface should be
function onRemoveItem(moveitem, tileitem, pos)

So I guess.. this would work?
Might get an error with TEXTCOLOR_ORANGE tho.

Lua:
function onRemoveItem(moveitem, tileitem, pos)
    local itemId = moveitem:getId()
    if itemId >= 1 and itemId <= 30000 then
        Game.sendAnimatedText(tileitem:getPosition(), ItemType(itemId):getName(), TEXTCOLOR_ORANGE)
    end
    return true
end
 
new interface should be
function onRemoveItem(moveitem, tileitem, pos)

So I guess.. this would work?
Might get an error with TEXTCOLOR_ORANGE tho.

Lua:
function onRemoveItem(moveitem, tileitem, pos)
    local itemId = moveitem:getId()
    if itemId >= 1 and itemId <= 30000 then
        Game.sendAnimatedText(tileitem:getPosition(), ItemType(itemId):getName(), TEXTCOLOR_ORANGE)
    end
    return true
end
thank you very much for your help, your script did not work, no errors appeared in the console ;/
 
thank you very much for your help, your script did not work, no errors appeared in the console ;/
Add some prints then.

Figure out what's wrong.

Lua:
function onRemoveItem(moveitem, tileitem, pos)
    print("----")
    print(moveitem:getId())
    local itemId = moveitem:getId()
    if itemId >= 1 and itemId <= 30000 then
        Game.sendAnimatedText(tileitem:getPosition(), ItemType(itemId):getName(), TEXTCOLOR_ORANGE)
    end
    return true
end
 
does anyone know this script? if yes, please convert to tfs 1.2
the script is simple, I like it
Lua:
function onRemoveItem(moveitem, tileitem, pos)
    if moveitem.itemid >= 1 and moveitem.itemid <= 30000 then
        doSendAnimatedText(pos,getItemName(moveitem.itemid), TEXTCOLOR_ORANGE)
    end
end



I put this area by accident, please can some adm or mods move it to another support area thanks
missing tileitem tag in xml:
XML:
<movevent event="RemoveItem" uniqueid="0" actionid="0" itemid="0" tileitem="1" script="your_script.lua" />

Lua:
Your script
 
Add some prints then.

Figure out what's wrong.

Lua:
function onRemoveItem(moveitem, tileitem, pos)
    print("----")
    print(moveitem:getId())
    local itemId = moveitem:getId()
    if itemId >= 1 and itemId <= 30000 then
        Game.sendAnimatedText(tileitem:getPosition(), ItemType(itemId):getName(), TEXTCOLOR_ORANGE)
    end
    return true
end
console.png
when I kill a monster and I tried to move an item inside the dead body... it only appeared on the console kk,, it didn't appear in the game
missing tileitem tag in xml:
XML:
<movevent event="RemoveItem" uniqueid="0" actionid="0" itemid="0" tileitem="1" script="your_script.lua" />

Lua:
Your script
maybe this tag is incorrect? id 3065 is dead body
<movevent event="RemoveItem" tileitem="1" itemid="3065" script="loote.lua"/>

what is ? what should i put?
uniqueid="0" actionid="0
 
I thought you were adding an actionId to the Tile, for Tiles you need the label I mentioned before.
For an item, you just need to specify the itemId and the script, and that's it.

data/movements/movements.xml
XML:
<movevent event="RemoveItem" itemid="3065" script="test.lua" />

data/movements/scripts/test.lua
Lua:
function onRemoveItem(moveItem, tileItem, pos)
    print(moveItem, tileItem, pos)
    return true
end

asfdsfdsfds.gif

This is totally unnecessary:
if moveitem.itemid >= 1 and moveitem.itemid <= 30000 then
Why do we want to know if itemid is greater than or equal to 1 and if it is less than or equal to 30000 if we already know that 3065 meets this criteria? It's not like the item will have an ID of 10000000 one day and 564535643 the next day XD.

One more thing I noticed is that you use the function doSendAnimatedText, obviously this function does not exist, and in case you have implemented it in your sources, you are probably using OTC, because in CIPClient there are no animated texts.
 
I thought you were adding an actionId to the Tile, for Tiles you need the label I mentioned before.
For an item, you just need to specify the itemId and the script, and that's it.

data/movements/movements.xml
XML:
<movevent event="RemoveItem" itemid="3065" script="test.lua" />

data/movements/scripts/test.lua
Lua:
function onRemoveItem(moveItem, tileItem, pos)
    print(moveItem, tileItem, pos)
    return true
end

View attachment 75160

This is totally unnecessary:
if moveitem.itemid >= 1 and moveitem.itemid <= 30000 then
Why do we want to know if itemid is greater than or equal to 1 and if it is less than or equal to 30000 if we already know that 3065 meets this criteria? It's not like the item will have an ID of 10000000 one day and 564535643 the next day XD.

One more thing I noticed is that you use the function doSendAnimatedText, obviously this function does not exist, and in case you have implemented it in your sources, you are probably using OTC, because in CIPClient there are no animated texts.
my font does have doSendAnimatedText ( I found "Game.sendAnimatedText" in data\lib\compat\compat.lua)
tell us exactly what you want the script to do!
For me I liked this script yes... my ot is based on "lord of the rings" custom map xD. that I showed the video is very old ot version 7.92 by evolutions ( Xidaozu), I already changed to tfs 1.2 it's almost ready 90%.. I want to finish it soon before posting ot online
if there is no way, that I'm going to give up on this script, thank you very much for the help force!
 
my font does have doSendAnimatedText ( I found "Game.sendAnimatedText" in data\lib\compat\compat.lua)

For me I liked this script yes... my ot is based on "lord of the rings" custom map xD. that I showed the video is very old ot version 7.92 by evolutions ( Xidaozu), I already changed to tfs 1.2 it's almost ready 90%.. I want to finish it soon before posting ot online
if there is no way, that I'm going to give up on this script, thank you very much for the help force!
Maybe something like this could work for you?

data/events/scripts/player.lua
Lua:
-- onMoveItem Event
if fromCylinder and fromCylinder:isItem() then
        if fromCylinder:getId() == 3065 then
            if toCylinder ~= fromCylinder then
                player:say(string.format("x%d %s", count, item:getName()), TALKTYPE_MONSTER_SAY, false, nil, fromCylinder:getPosition())
            end
        end
    end
sadsadsa.gif
 
Maybe something like this could work for you?

data/events/scripts/player.lua
Lua:
-- onMoveItem Event
if fromCylinder and fromCylinder:isItem() then
        if fromCylinder:getId() == 3065 then
            if toCylinder ~= fromCylinder then
                player:say(string.format("x%d %s", count, item:getName()), TALKTYPE_MONSTER_SAY, false, nil, fromCylinder:getPosition())
            end
        end
    end
View attachment 75189
can i put it anywhere data/events/scripts/player.lua?
was that I put it at the end before end
and it didn't work in the game, nothing error on the console
 
can i put it anywhere data/events/scripts/player.lua?
was that I put it at the end before end
and it didn't work in the game, nothing error on the console
That goes inside the onMoveItem event.
Here's an example:

Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    -- onMoveItem Event
    if fromCylinder and fromCylinder:isItem() then
        if fromCylinder:getId() == 3065 then
            if toCylinder ~= fromCylinder then
                player:say(string.format("x%d %s", count, item:getName()), TALKTYPE_MONSTER_SAY, false, nil, fromCylinder:getPosition())
            end
        end
    end
    return true
end

You also need to activate the event in events.xml
Here's an example:
XML:
<event class="Player" method="onMoveItem" enabled="1" />
 
Solution
That goes inside the onMoveItem event.
Here's an example:

Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    -- onMoveItem Event
    if fromCylinder and fromCylinder:isItem() then
        if fromCylinder:getId() == 3065 then
            if toCylinder ~= fromCylinder then
                player:say(string.format("x%d %s", count, item:getName()), TALKTYPE_MONSTER_SAY, false, nil, fromCylinder:getPosition())
            end
        end
    end
    return true
end

You also need to activate the event in events.xml
Here's an example:
XML:
<event class="Player" method="onMoveItem" enabled="1" />
now it works perfectly thanks a lot
 
Back
Top