Hi, Friends!
I'm making modifications on the L2JRoboto.
Which I'm implementing a method where if the character dies I will revive him in a city.
Class : FakePlayerAI
protected void toVillageOnDeath() {
Location location = MapRegionTable.getInstance().getLocationToTeleport((Creature)this._fakePlayer, MapRegionTable.TeleportType.TOWN);
if (this._fakePlayer.isDead() && !this._fakePlayer.isInsideZone(ZoneId.FLAG) && !Config.FAKE_PLAYER_RETURNS_TO_FARM_ZONE)
this._fakePlayer.doRevive();
this._fakePlayer.getFakeAi().teleportToLocation(location.getX(), location.getY(), location.getZ(), 20);
}
protected void rebuffAfterDeathAndTeleportBack() {
switch (this._fakePlayer.getClassId()) {
case ARCHMAGE:
case SOULTAKER:
case HIEROPHANT:
case ARCANA_LORD:
case CARDINAL:
case MYSTIC_MUSE:
case ELEMENTAL_MASTER:
case EVAS_SAINT:
case STORM_SCREAMER:
case SPECTRAL_MASTER:
case SHILLIEN_SAINT:
case DOMINATOR:
case DOOMCRYER:
this._fakePlayer.getFakeAi().applyDefaultBuffs();
break;
case DUELIST:
case DREADNOUGHT:
case PHOENIX_KNIGHT:
case SWORD_MUSE:
case HELL_KNIGHT:
case SPECTRAL_DANCER:
case EVAS_TEMPLAR:
case SHILLIEN_TEMPLAR:
case TITAN:
case MAESTRO:
case SAGGITARIUS:
case ADVENTURER:
case WIND_RIDER:
case MOONLIGHT_SENTINEL:
case GHOST_HUNTER:
case GHOST_SENTINEL:
case FORTUNE_SEEKER:
case GRAND_KHAVATARI:
this._fakePlayer.getFakeAi().applyDefaultBuffs();
break;
}
teleportBackFarmzone();
}
static int[] spawnloc2 = Config.SPAWN_FAKE_LOC2;
static int[] spawnloc1 = Config.SPAWN_FAKE_LOC1;
static int radius = 10000;
protected void teleportBackFarmzone() {
if (spawnloc2[0] >= spawnloc1[0])
spawnloc2[0] = spawnloc1[0] - 100;
if (spawnloc2[1] >= spawnloc1[1])
spawnloc2[1] = spawnloc1[1] - 100;
if (spawnloc1[2] >= spawnloc2[2])
spawnloc1[2] = spawnloc2[2] - 100;
int x = Rnd.get(spawnloc2[0], spawnloc1[0]);
int y = Rnd.get(spawnloc2[1], spawnloc1[1]);
int z = Rnd.get(spawnloc1[2] + 20, spawnloc2[2] + 20);
this._fakePlayer.getFakeAi().teleportToLocation(x, y, z, 20);
}
Config.java
public static boolean FAKE_PLAYER_RETURNS_TO_FARM_ZONE;
public static int[] SPAWN_FAKE_LOC2;
public static int[] SPAWN_FAKE_LOC1;
FAKE_PLAYER_RETURNS_TO_FARM_ZONE = fakeplayer.getProperty("FakePlayerReturnFarmzone", true);
SPAWN_FAKE_LOC1 = fakeplayer.getProperty("FakeSpawnLocation1", new int[] { 148989, -168447, 2008 });
SPAWN_FAKE_LOC2 = fakeplayer.getProperty("FakeSpawnLocation2", new int[] { 147208, -171816, 2248 });
What happens to me is that the characters, when they die, come back to life all the time in the area but repeated as the image shows.
http://prntscr.com/r5ploz
Could you help me to see the error?
Thank you.