• 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+ movements.xml/weapons.xml attribute items, question/possible ?

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,297
Reaction score
127
Hello i was thinking there is possible way somehow to make that all items kinda works like on movements.xml/weapons.xml ?


I mean, if i make for example new item for example Draggy boots with attributes for example ( protection all, or magic lvls or anything else), i have to register the item into movements.xml or weapons.xml so item works properly right, so...

Maybe there is way to make that any item that has attribute set in THE ITEM it starts working without the line needed to add in movements.xml ?

Any possible way ? Any hints please ?

Thats maybe a possible hint ?

C++:
        bool isItemAbilityEnabled(slots_t slot) const {
            return inventoryAbilities[slot];
        }

Thanks in advance
Vanagas
 
Items are there, because they require vocation/level/slot. Slot can be loaded from items.xml (idk if it's always same as in movements).
I would write it as some script (in PHP/Python/NodeJS) that loads items.xml, movements.xml and weapons.xml and generate list of missing items. That way you could easily control it, version changes on git and detect bugs.

In case of 1.x, there are already functions that give a lot of information about items to Lua. Maybe add functions to get info about loaded weapons/movements and write it in Lua as talkaction (print required .xml changes to console). It could be better, as on new TFS movements can be defined in Lua, not only movements.xml and C++ would know them all after server start.
 
Last edited:
You could make an easy parser for items via revscriptsys and register them like gesior mentioned, the only problem I see is that you would have to remove all the movements inside movements.xml or add some kind of blacklist (so we don't double register itemid's)

example:
Lua:
local range = 65000 -- this would mean we iterate through all itemids from 1 to 65k and look if it's an item we want to register

for i = 1, range do
    local item = ItemType(i)
    if item:getSlotPosition() then
        local equip = MoveEvent()
        equip:type("equip")
        equip:id(i)

        if item:getMinReqLevel() then
            equip:level(item:getMinReqLevel())
        end

        if item:getMinReqMagicLevel() then
            equip:magicLevel(item:getMinReqMagicLevel())
        end

        equip:register()

        local deequip = MoveEvent()
        deequip:type("deequip")
        deequip:id(i)
        deequip:register()
    end
end
 
You could make an easy parser for items via revscriptsys and register them like gesior mentioned, the only problem I see is that you would have to remove all the movements inside movements.xml or add some kind of blacklist (so we don't double register itemid's)

example:
Lua:
local range = 65000 -- this would mean we iterate through all itemids from 1 to 65k and look if it's an item we want to register

for i = 1, range do
    local item = ItemType(i)
    if item:getSlotPosition() then
        local equip = MoveEvent()
        equip:type("equip")
        equip:id(i)

        if item:getMinReqLevel() then
            equip:level(item:getMinReqLevel())
        end

        if item:getMinReqMagicLevel() then
            equip:magicLevel(item:getMinReqMagicLevel())
        end

        equip:register()

        local deequip = MoveEvent()
        deequip:type("deequip")
        deequip:id(i)
        deequip:register()
    end
end
So you say if we do like gesior says, we kinda need to remove the movements.xml ?
 
So you say if we do like gesior says, we kinda need to remove the movements.xml ?
not entirely but you have to think about some way to blacklist all the itemids from movements.xml or you'll end up having errors on startup that you tried to register an itemid twice
 
Back
Top