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

How does onStatsChange work?

Shinmaru

エロルアー Scripter!
Joined
Aug 20, 2007
Messages
1,988
Reaction score
88
Location
Puerto Rico
Just as the title suggests "How does onStatsChange work?", please explain each parameter(except cid and attacker) and if you can give me an example that would help much better.

Thanks!
 
What I understand about it...
Lua:
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
*I suppose it's like that

PARAMETERS
>cid - attacked or healed creature

>attacker
-attacker or healer

>type
-type of stat change
can be:
Lua:
STATSCHANGE_HEALTHGAIN = 0
STATSCHANGE_HEALTHLOSS = 1
STATSCHANGE_MANAGAIN = 2
STATSCHANGE_MANALOSS = 3

combat
-type of combat
can be:
Lua:
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
 
Back
Top