• 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!

Item damaged increased

josesaucedo

New Member
Joined
Jun 21, 2013
Messages
20
Reaction score
0
Hello I need help for a script to increase% damage example stone skin amulet
Lua:
you see a stone skin amulet (protection physical +5%, death +5%, +5% damage increased) that has 100 charges left. It weighs 7.60 oz
 
1632818446483.png I'm using the crystal ball, but it doesn't tell me what version it is

Note: When you have the stone skin amulet equipped, your attacks get an increase of 10% and this increase is seen in the description of the object, as long as the object is vanilla and does not have a different description than the default.

This is not a very flexible script but if anyone wants to try it for fun here it is:
Version: TFS 1.3+
data/scripts/stoneskinamulet_increasedmg.lua
Lua:
-- Stone Skin Amulet Damage Increased
ITEM_STONE_SKIN_AMULET = 2197
local hasSSA = function (item)
    return item and item:getId() == ITEM_STONE_SKIN_AMULET
end

local ec = EventCallback

function ec.onLook(player, thing, position, distance, description)
    if thing:isItem() and hasSSA(thing) then
        return description:gsub("protection physical %+%d-%%%, death %+%d+%%", string.format("protection physical +%d%%%%, death +%d%%%%, +5%%%% damage increased", description:match("protection physical %+(%d-)%%, death %+(%d+)%%")))
    end
    return description
end

ec:register(4)

function ec.onTargetCombat(creature, target)
    if creature and target then
        local player = creature:getPlayer()
        if player and hasSSA(player:getSlotItem(CONST_SLOT_NECKLACE)) then
            target:registerEvent("SSADamageIncreasedHP")
            target:registerEvent("SSADamageIncreasedMP")
        end
    end
    return RETURNVALUE_NOERROR
end

ec:register(4)

local applyDamage = function (creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType)
    if attacker and attacker:isPlayer() then
        if hasSSA(attacker:getSlotItem(CONST_SLOT_NECKLACE)) then
            return math.floor(primaryDamage * 1.05), primaryType, math.floor(secondaryDamage * 1.05), secondaryType
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

local creatureEvent = CreatureEvent("SSADamageIncreasedHP")
creatureEvent.onHealthChange = applyDamage
creatureEvent:register()
creatureEvent = CreatureEvent("SSADamageIncreasedMP")
creatureEvent.onManaChange = applyDamage
creatureEvent:register()
 
Last edited:
Back
Top