Lua Function [TFS 1.3] Item abilities via Lua

Evil Puncker

I'd rather kiss a rattlesnake
Joined
May 30, 2009
Messages
5,925
Best answers
33
Reaction score
1,874
Location
160,54,7
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
 

Evil Puncker

I'd rather kiss a rattlesnake
Joined
May 30, 2009
Messages
5,925
Best answers
33
Reaction score
1,874
Location
160,54,7
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)
 
OP
Delusion

Delusion

Divine Intellect
Support Team
Joined
Feb 14, 2015
Messages
5,340
Best answers
528
Reaction score
3,068
It's obviously finding some item to serialize in house ID 2107. Without more information, I have no idea.
 

Evil Puncker

I'd rather kiss a rattlesnake
Joined
May 30, 2009
Messages
5,925
Best answers
33
Reaction score
1,874
Location
160,54,7
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
 

pepsiman

---
Joined
Nov 17, 2017
Messages
122
Best answers
5
Reaction score
66
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;
 

sharinn

Premium User
Premium User
Joined
Aug 27, 2011
Messages
39
Best answers
1
Reaction score
8
Is it possible to upgrade to the latest version of tfs?
 

Danga

New Member
Joined
Aug 24, 2016
Messages
1
Best answers
0
Reaction score
0
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:

Dries390

New Member
Joined
Sep 8, 2007
Messages
26
Best answers
1
Reaction score
3
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?
 

sharinn

Premium User
Premium User
Joined
Aug 27, 2011
Messages
39
Best answers
1
Reaction score
8
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)
 

Dries390

New Member
Joined
Sep 8, 2007
Messages
26
Best answers
1
Reaction score
3
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:
Top