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

Solved [creaturescript] onCombat or onAttack [return true only if damage]

milbradt

New Member
Joined
Dec 25, 2011
Messages
177
Solutions
1
Reaction score
4
Hello o/

How do I return true only if the target lose life?

Ex +-:

Code:
function onCombat(cid, target)
    if "HEALTH_LOSS"(target) then
        print("work")
    end
    return true
end

Solved. Used statsChange.. =\
 
Last edited:
I'm just assuming the current script is working.
Code:
function onCombat(cid, target)
    if "HEALTH_LOSS"(target) then
        print("work")
        return true
    else
        print("not work")
    end
    return false
end
 
no no man .. xD
This is only one example that does not exist.

Code:
if "HEALTH_LOSS"(target) then
This condition does not exist.

I wanted to know a condition to do so.
 
Code:
onStatsChange(cid, attacker, type, combat, value)
    if type == STATSCHANGE_HEALTHLOSS then
        print("work")
    end
    return true
end

onStatsChange(cid, attacker, type, combat, value)
when a creature is attacked or healed or when loses or gain mana/hp by another creature*, somewhat like onCombat/onAttack, but a bit different

PARAMETERS
>cid
- attacked or healed creature

>attacker
-attacker or healer

>type
-type of stat change
STATSCHANGE_HEALTHGAIN = 0
STATSCHANGE_HEALTHLOSS = 1
STATSCHANGE_MANAGAIN = 2
STATSCHANGE_MANALOSS = 3

combat
-type of combat
COMBAT_NONE = 0
COMBAT_PHYSICALDAMAGE = 1
COMBAT_ENERGYDAMAGE = 2
COMBAT_EARTHDAMAGE = 4
COMBAT_POISONDAMAGE = 4
COMBAT_FIREDAMAGE = 8
COMBAT_UNDEFINEDDAMAGE = 16
COMBAT_LIFEDRAIN = 32
COMBAT_MANADRAIN = 64
COMBAT_HEALING = 128
COMBAT_DROWNDAMAGE = 256
COMBAT_ICEDAMAGE = 512
COMBAT_HOLYDAMAGE = 1024
COMBAT_DEATHDAMAGE = 2048

value
-amount of healing/damage
 
Code:
onStatsChange(cid, attacker, type, combat, value)
    if type == STATSCHANGE_HEALTHLOSS then
        print("work")
    end
    return true
end
but as I identify when I took the target's life?

only the player "X" have the registerEvent.
So how do I check if his target lost life?
 
but as I identify when I took the target's life?

only the player "X" have the registerEvent.
So how do I check if his target lost life?
Code:
if type == STATSCHANGE_HEALTHLOSS and getCreatureName(cid):lower() == "cave rat" then
Do you mean like this?
 
Back
Top