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

Help Fix All

GOD Esteve

New Member
Joined
May 18, 2011
Messages
87
Reaction score
1
First i will try to explain what i need, the script should heal 30% of damage when hit a player or a monster and for this i make that scripts

<event type="statschange" name="ItemRegen" script="MEUS/itemregen.lua"/>

registerCreatureEvent(cid, "ItemRegen")

function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) == true then
if(getPlayerSlotItem(attacker, 3).itemid == 12685) then
dmg = math.ceil(value*(30/100))
doCreatureAddHealth(attacker, dmg)
end
end
return TRUE
end

But the problem it`s that the script only work with player and with monster don`t make nothing,

TFS 0.3.7
 
Code:
local percentage = 30
local equippedItemId = 12685
local slotId = 3

function onStatsChange(cid, attacker, type, combat, value)
    local damage = math.ceil( value * ( percentage / 100 ) )
    if isPlayer(attacker) then
        if getPlayerSlotItem(attacker, slotId).itemid ~= equippedItemId then
            return false
        end
    end
    doCreatureAddHealth(attacker, damage)
    return true
end
 
Last edited:
Code:
local percentage = 30
local equippedItemId = 12685
local slotId = 3

function onStatsChange(cid, attacker, type, combat, value)
    local damage = math.ceil( value * ( percentage / 100 ) )
    if isPlayer(attacker) then
        if getPlayerSlotItem(attacker, slotId).itemid ~= equippedItemId then
            return false
        end
    end
    doCreatureAddHealth(attacker, damage)
    return true
end

I try that what u say but steel same, when hit monster don`t make nothing
 
According to the map editor 12685 is a timber wall, what item do you think 12685 represents?

New item, it`s a backpack that i create in version 8.6 but also don`t work with any item that already exist like an MPA one of many that i test only heal if damage in a players.
 
Back
Top