Which function called when character dying?
Posted: Thu Sep 19, 2019 10:28 pm
Which function called when character dying from mob or other character? I tried to modify public boolean doDie(L2Character killer) but it not works.. I need in moment when character dies. I want to check some abnormal effects on them, but in doDie() it not possible.
And why function setIsDead() working on clear server, when no one character connected? L2Character called not only for characters?
Abnormal logic :'| How much instances of L2Character works on server?
Code: Select all
public boolean doDie(L2Character killer) {
final TerminateReturn returnBack = EventDispatcher.getInstance().notifyEvent(new OnCreatureKill(killer, this), this, TerminateReturn.class);
if ((returnBack != null) && returnBack.terminate()) {
return false;
}
// killing is only possible one time
synchronized (this) {
if (isDead()) {
return false;
}
LOG.info("TRYING TO SEARCH NOOBLE BUFF..");
// now reset currentHp to zero
setCurrentHp(0);
setIsDead(true);
}
// Set target to null and cancel Attack or Cast
setTarget(null);
// Stop movement
stopMove(null);
// Stop HP/MP/CP Regeneration task
getStatus().stopHpMpRegeneration();
stopAllEffectsExceptThoseThatLastThroughDeath();
calculateRewards(killer);
// Send the Server->Client packet StatusUpdate with current HP and MP to all other L2PcInstance to inform
broadcastStatusUpdate();
// Notify L2Character AI
if (hasAI()) {
getAI().notifyEvent(CtrlEvent.EVT_DEAD);
}
if (getWorldRegion() != null) {
getWorldRegion().onDeath(this);
}
getAttackByList().clear();
if (isChannelized()) {
getSkillChannelized().abortChannelization();
}
return true;
}
Abnormal logic :'| How much instances of L2Character works on server?