• 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+ Custom attributes?

mRefaat

Marketing and Coding
Joined
Jan 18, 2014
Messages
854
Solutions
3
Reaction score
141
Location
Egypt
Hello

i am using TFS 1.3 and added these custom attributes (boost and reflect) from this PR made by Nekiro
I tested reflect and it is working as it should but boost attribute not working.
When i add for example: boost percent all value 50, 100, or 200 I can’t see any change in my damage or healing.
Also when i put boost percent all or reflect percent/chance all on an item it shows every combat percent on it not like when i add protection all, it shows protection all words only not like this.
XML:
12:09 You see boots of haste (reflect physical 100%, energy 100%, earth 100%, fire 100%, undefined 100%, lifedrain 100%, manadrain 100%, healing 100%, drown 100%, ice 100%, holy 100%, death 100%, reflect physical chance 50%, energy chance 50%, earth chance 50%, fire chance 50%, undefined chance 50%, lifedrain chance 50%, manadrain chance 50%, healing chance 50%, drown chance 50%, ice chance 50%, holy chance 50%, death chance 50%, boost physical +200%, energy +200%, earth +200%, fire +200%, undefined +200%, lifed

    <item id="2195" name="boots of haste">
        <attribute key="weight" value="750" />
        <attribute key="slotType" value="feet" />                      
        <attribute key="speed" value="40" />
        <attribute key="criticalhitchance" value="100" />
        <attribute key="criticalhitamount" value="100" />
        <attribute key="lifeleechchance" value="100" />
        <attribute key="lifeleechamount" value="100" />
        <attribute key="manaleechchance" value="100" />
        <attribute key="manaleechamount" value="100" />
        <attribute key="reflectpercentall" value="100" />
        <attribute key="reflectchanceall" value="50" />
        <attribute key="boostpercentall" value="200" />
        <attribute key="showattributes" value="1" />
    </item>
Can someone help me with that?
The description and functionality of boost attribute.
 
Are you adding this item to movements.xml? If your compilation has such attributes already added, it should work if you just add this item to movements.
 
my item is well added to movements.xml , using onDeEquipItem and onEquipItem function
Look till now I didn’t find a way to make it work.
Idk really if it has a problem but can add something with on health change to boost dmg.
 
Look till now I didn’t find a way to make it work.
Idk really if it has a problem but can add something with on health change to boost dmg.
it seems to be good , but i don't know why it doesn't work.
maybe we are missing something ? that's why i want any experts to help me
@Nekiro
 
Last edited:
it seems to be good , but i don't know why it doesn't work.
maybe we are missing something ? that's why i want any experts to help me
Yes it seems to be good but as I remember I checked it many times if something was missing but didn’t find any.
I hope someone can help you.
I am not using it anymore.
 
Yes it seems to be good but as I remember I checked it many times if something was missing but didn’t find any.
I hope someone can help you.
I am not using it anymore.
using other attributes to increase magic damage by percent ?
that's what i mainly want to do .
 
how to use in total damage increase ?
Well,
You can use onEquip/onDeEquip script to give the player a storage based on items.
Value of this storage = the extra damage percent.
Now you have to make a creature event script to give the extra damage using this storage value.

Lua:
-- HealthChange damage increase event

local eventHpChange = CreatureEvent("DamageIncreaseHP")
eventHpChange:type("healthChange")

function eventHpChange.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker:isPlayer() then -- only buff players
        if primaryType and secondaryType ~= COMBAT_HEALING then -- does not equal healing "damage"
            local damage = attacker:getStorageValue(STORAGE) -- storage value
            if damage >= 1 then
                local newPrimaryDmg = math.ceil(primaryDamage + (primaryDamage * (damage / 100)))
                local newSecondaryDmg = math.ceil(secondaryDamage + (secondaryDamage * (damage / 100)))
                return newPrimaryDmg, primaryType, newSecondaryDmg, secondaryType, origin
            end
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType, origin 
end

eventHpChange:register()

-- ManaChange damage increase event
local eventMpChange = CreatureEvent("DamageIncreaseMP")
eventMpChange:type("manaChange")

function eventMpChange.onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker:isPlayer() then -- only buff players
        if primaryType and secondaryType ~= COMBAT_HEALING then -- does not equal healing "damage"
            local damage = attacker:getStorageValue(STORAGE) -- storage value
            if damage >= 1 then
                local newPrimaryDmg = math.ceil(primaryDamage + (primaryDamage * (damage / 100)))
                local newSecondaryDmg = math.ceil(secondaryDamage + (secondaryDamage * (damage / 100)))
                return newPrimaryDmg, primaryType, newSecondaryDmg, secondaryType, origin
            end
        end
    end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin 
end

eventMpChange:register()

It is a revscript, so you just add it into data/scripts
Post automatically merged:

@SanSero
This part for onEquip/onDeEquip:
You can use your own storage.

Lua:
local config = {
    [2361] = {damageincrease = 5}, -- frozen starlight = 5% extra damage
    [2123] = {damageincrease = 10} -- ring of the sky = 10% extra damage
}


function onEquip(player, item, slot, isCall)
    if isCall == false then
        player:setStorageValue(STORAGE, player:getStorageValue(STORAGE) + config[item:getId()].damageincrease) -- add damage increase
    end
    return true
end

function onDeEquip(player, item, slot)
    player:setStorageValue(STORAGE, player:getStorageValue(STORAGE) - config[item:getId()].damageincrease) -- remove damage increase
    return true
end

and XML part

XML:
<movevent event="Equip" itemid="2361" slot="ammo" function="onEquipItem" script="script.lua" />
<movevent event="DeEquip" itemid="2361" slot="ammo" function="onDeEquipItem" script="script.lua" />
<movevent event="Equip" itemid="2123" slot="ring" function="onEquipItem" script="script.lua" />
<movevent event="DeEquip" itemid="2123" slot="ring" function="onDeEquipItem" script="script.lua" />
 
Last edited:
Well,
You can use onEquip/onDeEquip script to give the player a storage based on items.
Value of this storage = the extra damage percent.
Now you have to make a creature event script to give the extra damage using this storage value.

Lua:
-- HealthChange damage increase event

local eventHpChange = CreatureEvent("DamageIncreaseHP")
eventHpChange:type("healthChange")

function eventHpChange.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker:isPlayer() then -- only buff players
        if primaryType and secondaryType ~= COMBAT_HEALING then -- does not equal healing "damage"
            local damage = attacker:getStorageValue(STORAGE) -- storage value
            if damage >= 1 then
                local newPrimaryDmg = math.ceil(primaryDamage + (primaryDamage * (damage / 100)))
                local newSecondaryDmg = math.ceil(secondaryDamage + (secondaryDamage * (damage / 100)))
                return newPrimaryDmg, primaryType, newSecondaryDmg, secondaryType, origin
            end
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end

eventHpChange:register()

-- ManaChange damage increase event
local eventMpChange = CreatureEvent("DamageIncreaseMP")
eventMpChange:type("manaChange")

function eventMpChange.onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker:isPlayer() then -- only buff players
        if primaryType and secondaryType ~= COMBAT_HEALING then -- does not equal healing "damage"
            local damage = attacker:getStorageValue(STORAGE) -- storage value
            if damage >= 1 then
                local newPrimaryDmg = math.ceil(primaryDamage + (primaryDamage * (damage / 100)))
                local newSecondaryDmg = math.ceil(secondaryDamage + (secondaryDamage * (damage / 100)))
                return newPrimaryDmg, primaryType, newSecondaryDmg, secondaryType, origin
            end
        end
    end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end

eventMpChange:register()

It is a revscript, so you just add it into data/scripts
Post automatically merged:

@SanSero
This part for onEquip/onDeEquip:
You can use your own storage.

Lua:
local config = {
    [2361] = {damageincrease = 5}, -- frozen starlight = 5% extra damage
    [2123] = {damageincrease = 10} -- ring of the sky = 10% extra damage
}


function onEquip(player, item, slot, isCall)
    if isCall == false then
        player:setStorageValue(STORAGE, player:getStorageValue(STORAGE) + config[item:getId()].damageincrease) -- add damage increase
    end
    return true
end

function onDeEquip(player, item, slot)
    player:setStorageValue(STORAGE, player:getStorageValue(STORAGE) - config[item:getId()].damageincrease) -- remove damage increase
    return true
end

and XML part

XML:
<movevent event="Equip" itemid="2361" slot="ammo" function="onEquipItem" script="script.lua" />
<movevent event="DeEquip" itemid="2361" slot="ammo" function="onDeEquipItem" script="script.lua" />
<movevent event="Equip" itemid="2123" slot="ring" function="onEquipItem" script="script.lua" />
<movevent event="DeEquip" itemid="2123" slot="ring" function="onDeEquipItem" script="script.lua" />
thank you for your help , i will try it :)
 
Back
Top