L2JMobius

High Five Not instant to village when died on instances

slayerofdark · 7 · 2504

Offline slayerofdark

  • Heir
  • **
    • Posts: 23
Hello everyone, i want to make players died in instances to have some time or have to press to village and not insta tp them outside of instance. Anyone know where to look?

Also when reenter to instance and kill boss it saw notice 0 sec and tp out and they dont get drops. please anyone.


Offline slayerofdark

  • Heir
  • **
    • Posts: 23
I found the solution to not insta tp out.
Instance.java
Code: [Select]
/**
* This method is called when player dies inside instance.
* @param player
*/
public void notifyDeath(Player player)
{
if (!player.isOnEvent() && (_ejectTime > 0))
{
// Send message
final SystemMessage sm = new SystemMessage(SystemMessageId.IF_YOU_ARE_NOT_RESURRECTED_WITHIN_S1_MINUTES_YOU_WILL_BE_EXPELLED_FROM_THE_INSTANT_ZONE);
sm.addInt(_ejectTime / 60 / 1000);
player.sendPacket(sm);

// Start eject task
_ejectDeadTasks.put(player.getObjectId(), ThreadPool.schedule(() ->
{
if (player.isDead() && (player.getInstanceId() == _id))
{
player.setInstanceId(0);
if (_exitLocation != null)
{
player.teleToLocation(_exitLocation, true);
}
else
{
player.teleToLocation(TeleportWhereType.TOWN);
}
}
}, _ejectTime));
}
}
changed to
Code: [Select]
/**
* This method is called when player dies inside instance.
* @param player
*/
public void notifyDeath(Player player)
{

}
After delete only this player get message you have 0 minutes to get resurected xD something wrong on timer.
Code: [Select]
// Start eject task
_ejectDeadTasks.put(player.getObjectId(), ThreadPool.schedule(() ->
{
if (player.isDead() && (player.getInstanceId() == _id))
{
player.setInstanceId(0);
if (_exitLocation != null)
{
player.teleToLocation(_exitLocation, true);
}
else
{
player.teleToLocation(TeleportWhereType.TOWN);
}
}
}, _ejectTime));
}

The problem i have now is when kill zaken or freya hall of suffering (kamaloka works fine give 5 minutes after boss death)test with normal chars message come notice: 0 seconds remaing and no drops recieved ( i know i can make autoloot on bosses and prob solved, but i dont want to i want to find out why it is happening) no error on code.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16010
What value is _ejectTime?
Maybe neeeds milliseconds? seconds? minutes?


Offline slayerofdark

  • Heir
  • **
    • Posts: 23
config.java
Code: [Select]
EJECT_DEAD_PLAYER_TIME = generalConfig.getInt("EjectDeadPlayerTime", 1);maybe that "1" is the problem idk. I haven't changed anything.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16010
In General.ini

# When a player dies, is removed from instance after a fixed period of time.
# Time in seconds.
# Default: 60
EjectDeadPlayerTime = 60

Try this.
Code: [Select]
Index: java/org/l2jmobius/Config.java
===================================================================
--- java/org/l2jmobius/Config.java (revision 10272)
+++ java/org/l2jmobius/Config.java (working copy)
@@ -2080,7 +2080,7 @@
  INSTANCE_FINISH_TIME = generalConfig.getInt("DefaultFinishTime", 5);
  RESTORE_PLAYER_INSTANCE = generalConfig.getBoolean("RestorePlayerInstance", false);
  ALLOW_SUMMON_IN_INSTANCE = generalConfig.getBoolean("AllowSummonInInstance", false);
- EJECT_DEAD_PLAYER_TIME = generalConfig.getInt("EjectDeadPlayerTime", 1);
+ EJECT_DEAD_PLAYER_TIME = generalConfig.getInt("EjectDeadPlayerTime", 60) * 1000;
  ALLOW_LOTTERY = generalConfig.getBoolean("AllowLottery", true);
  ALLOW_RACE = generalConfig.getBoolean("AllowRace", true);
  ALLOW_WATER = generalConfig.getBoolean("AllowWater", true);