• 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 Function [TFS 1.3] Item abilities via Lua

The items containing the special bonus
if left in the house like this the normal save / load bonus
View attachment 39073

but if we leave it that way
the bonus that exists in the item above the other
start working on the bottom item
View attachment 39074
the workaround that you can do right now until(if) @Delusion confirm this and fix it, is to edit the onMove on player.lua and not allow players to put these special items in house
 
I'm receiving the following error when shutting down the server by ctrl+c:

SIGINT received, shutting game server down...
Saving server...
[Error - mysql_real_query] Query: INSERT INTO tile_store (house_id, data, abilities) VALUES (2107,'/\0\0\0%\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'.\0\0\0┌\0',NULL),(2107,'/\0\0\0█\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'-\0\0\0$\0',NULL),(210
Message: Column 'abilities' cannot be null
[Error - mysql_real_query] Query: INSERT INTO tile_store (house_id, data, abilities) VALUES (2107,'/\0\0\0%\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'.\0\0\0┌\0',NULL),(2107,'/\0\0\0█\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'-\0\0\0$\0',NULL),(210
Message: Column 'abilities' cannot be null
[Error - mysql_real_query] Query: INSERT INTO tile_store (house_id, data, abilities) VALUES (2107,'/\0\0\0%\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'.\0\0\0┌\0',NULL),(2107,'/\0\0\0█\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'-\0\0\0$\0',NULL),(210
Message: Column 'abilities' cannot be null
Shutting down... done!

my tile_store table:
2019-10-27 17_15_52-localhost _ Uniform Server _ sadteam _ tile_store _ phpMyAdmin 4.9.0.1.png

is it normal? (No items are in the houses, they are empty)
 
It's obviously finding some item to serialize in house ID 2107. Without more information, I have no idea.
 
It's obviously finding some item to serialize in house ID 2107. Without more information, I have no idea.
I even deleted that house and it looks for items on others houses, and same if I delete them as well (they have no item whatsoever), my tile_store is empty, my server is for test only, no house was ever bought
 
I'm receiving the following error when shutting down the server by ctrl+c:

SIGINT received, shutting game server down...
Saving server...
[Error - mysql_real_query] Query: INSERT INTO tile_store (house_id, data, abilities) VALUES (2107,'/\0\0\0%\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'.\0\0\0┌\0',NULL),(2107,'/\0\0\0█\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'-\0\0\0$\0',NULL),(210
Message: Column 'abilities' cannot be null
[Error - mysql_real_query] Query: INSERT INTO tile_store (house_id, data, abilities) VALUES (2107,'/\0\0\0%\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'.\0\0\0┌\0',NULL),(2107,'/\0\0\0█\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'-\0\0\0$\0',NULL),(210
Message: Column 'abilities' cannot be null
[Error - mysql_real_query] Query: INSERT INTO tile_store (house_id, data, abilities) VALUES (2107,'/\0\0\0%\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'.\0\0\0┌\0',NULL),(2107,'/\0\0\0█\0',NULL),(2107,'-\0\0\0$\0',NULL),(2107,'-\0\0\0$\0',NULL),(210
Message: Column 'abilities' cannot be null
Shutting down... done!

my tile_store table:
View attachment 39903

is it normal? (No items are in the houses, they are empty)

try
SQL:
ALTER TABLE `tile_store`
CHANGE `abilities` `abilities` blob NULL;
 
Here's a script you can use for an easy "imbue_item" function, it works if the item is equipped or not, and you won't need to add it to movements.xml or weapons.xml. Requires tfs 1.3 for revscriptsys.

Code:
function register_item(id)
    local equipAbility = MoveEvent("equipAbility")
    equipAbility:type("equip")
    equipAbility:id(id)
    equipAbility:register()
   
    local deEquipAbility = MoveEvent("deEquipAbility")
    deEquipAbility:type("deequip")
    deEquipAbility:id(id)
    deEquipAbility:register()
end

function imbue_item(player, item, ability, value, additive)
    additive = additive or false
    local doEquipSlot = nil
   
    for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
        local equip = player:getSlotItem(i)
        if equip ~= nil then
            if equip:getUniqueId() == item:getUniqueId() then
                item:moveTo(Tile(player:getPosition()))
                doEquipSlot = i
                break
            end
        end
    end

    register_item(item:getId())
    if additive then
        item:setAbility(ability, (item:getAbility(ability) or 0) + value)
    else
        item:setAbility(ability, value)
    end

    if doEquipSlot ~= nil then
        item:moveTo(player)
    end
end

function remove_imbue(item, ability)
    item:removeAbility(ability)
end
 
Last edited:
Is it possible to upgrade to the latest version of tfs?
Were you ever able to fix the holy/ice/undead xml stats missing? I've got the same problem and mana drain/health drain have dissapeared as well. Did you use Nekiro's downgrade?
 
Nope, im implement my own custom item system using customattribute, healchange/manachange creaturescript, onMovedItem event, and onlook event to get description, it's like 250 line of code (i own attack attribute, all ress type, percent skill/mlvl/hp/mp condition)
 
Nope, im implement my own custom item system using customattribute, healchange/manachange creaturescript, onMovedItem event, and onlook event to get description, it's like 250 line of code (i own attack attribute, all ress type, percent skill/mlvl/hp/mp condition)
I was able to get the 'normal' resistances back by changing
C++:
size_t combatTypeToIndex(CombatType_t combatType)
{
    switch (combatType) {
        case COMBAT_PHYSICALDAMAGE:
            return 0;
        case COMBAT_ENERGYDAMAGE:
            return 1;
        case COMBAT_EARTHDAMAGE:
            return 2;
        case COMBAT_FIREDAMAGE:
            return 3;
        case COMBAT_UNDEFINEDDAMAGE:
            return 8;
        case COMBAT_LIFEDRAIN:
            return 9;
        case COMBAT_MANADRAIN:
            return 10;
        case COMBAT_HEALING:
            return 11;
        case COMBAT_DROWNDAMAGE:
            return 4;
        case COMBAT_ICEDAMAGE:
            return 5;
        case COMBAT_HOLYDAMAGE:
            return 6;
        case COMBAT_DEATHDAMAGE:
            return 7;
        default:
            return 0;
    }
}

in tools.cpp. I have no idea where undefined, healing, life- and manadrain went though. I'm still working on that.

Edit: I was seemingly able to resolve the issues (manadrain works at least) by performing the source edits here

 
Last edited:
@Infernum i can confirm the problems with the houses. It appears that since you're saving the attribute in the tile, every item that is in the tile gets it when loading the tile.

Same happens if you have multiple itens with attributes stacked, the last one on the stack inherits all previous attributes in itemload
 
@Infernum i can confirm the problems with the houses. It appears that since you're saving the attribute in the tile, every item that is in the tile gets it when loading the tile.

Same happens if you have multiple itens with attributes stacked, the last one on the stack inherits all previous attributes in itemload
I do not work on anything Tibia related at the moment, let alone this outdated piece of poop.

:)
 
I do not work on anything Tibia related at the moment, let alone this outdated piece of poop.

:)
you definetely should reconsider, been using your system for months and lately been working to improve it. Already managed to make it work with every item (not only the registered in movements) but there are still missing some things to be fixed for me to make a pr out of it. It seems that the problem is the missing of
abilStream.write<uint8_t>(0x00); // abilities end when saving item
 
you definetely should reconsider, been using your system for months and lately been working to improve it. Already managed to make it work with every item (not only the registered in movements) but there are still missing some things to be fixed for me to make a pr out of it. It seems that the problem is the missing of
abilStream.write<uint8_t>(0x00); // abilities end when saving item
If I were to ever work on this again, it'd be a complete rewrite to revscripts utilizing CustomAttributes to avoid writing direct serialization and open up infinite possibilities for abilities to be added instead of being limited to 64 bit flags.
You're welcome to share your improvements to the rest of the people here, I'm sure they'd be glad to have them.
 
Back
Top