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

Lua All players do the same damage to a monster

Mr.Caffeine

Member
Joined
Nov 4, 2018
Messages
50
Reaction score
14
Hello, I would like an help in an event script for monsters that ignores the player's damage, so all the attack that the monster suffers is the same number through a configurable value. Regardless player's level and equipment.

For example, I would like to configure so that all hit damage suffered by this monster is awalys "100" is it possible to do this?

Lua:
function onStatsChange(cid, attacker, type, combat, value)
    if isPlayer(attacker) and isMonster(cid) and type == STATSCHANGE_HEALTHLOSS then
    print("x")
    local customdamage =  100
           doTargetCombatHealth(attacker, cid, combat, -customdamage, -customdamage, 255)
    return false
    end
return true
end
 
Last edited:
Solution
You basically have everything you need already.

Just add a check for the damage you want to go through.

Also, only register it to the monster not the player.
XML:
<script>
    <event name="onStatsChange_damage100only" />
</script>
Lua:
function onStatsChange(cid, attacker, type, combat, value)
    if type == STATSCHANGE_HEALTHLOSS and value ~= 100 then
        if isPlayer(attacker) then -- only changes the damage if it's a player attacking
            print("x")
            value = 100
            doTargetCombatHealth(attacker, cid, combat, -value, -value, CONST_ME_HEARTS)
            return false
        end
    end
    return true
end

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,699
Solutions
408
Reaction score
3,811
You basically have everything you need already.

Just add a check for the damage you want to go through.

Also, only register it to the monster not the player.
XML:
<script>
    <event name="onStatsChange_damage100only" />
</script>
Lua:
function onStatsChange(cid, attacker, type, combat, value)
    if type == STATSCHANGE_HEALTHLOSS and value ~= 100 then
        if isPlayer(attacker) then -- only changes the damage if it's a player attacking
            print("x")
            value = 100
            doTargetCombatHealth(attacker, cid, combat, -value, -value, CONST_ME_HEARTS)
            return false
        end
    end
    return true
end
 
Solution
Top