Jump to content
  • 0

[Help]Java Code request


`NeverMore

Question

Hello Mxc..

 

 

I am Using l2j Freya compiled pack and want to add 1 java code...

 

I had seen this java code on l2sexi and dont know if any other server have it..

 

I did not saw it here shared at all...So i want from some1 help me on how to create it or if it is shared just to post here the link ...

 

 

The Java code i want takes place on an PvP Area,where in that area when a player got killed and press to village doesnt go to nearest vilage but spawns again to that pvp  area  but in different location each time(to avoid farming pvp/pk)

 

For Example There are 2 players in PvP Area ( pvp area lets say it is priv isle warf) and the player 1 kills the player 2,(player 2 got killed on [px 24596 -24657 08956 loc]) then player 2 press To Village and it spawn again on "priv isle warf" but in different locations each time player 2 got killed...

 

On l2sexi i think there was about 4 or 5 differnet locations where this system spawns you after death...

 

 

 

 

Dont know if any1 understand what i am looking for..

 

If no i will try to explain it better..

 

Thanks in advance...

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

You could even create your own zone type and add what you need there. But you need to create the vertices too...

 

he should create a new Zone.

 

here is the basic strukture of a new Zone

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.model.zone.type;

import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;

/**
* @author eKo
*/
public class L2CustomZone extends L2ZoneType
{
  public L2PvpZone(int id)
  {
      super(id);
  }
  
  @Override
  protected void onEnter(L2Character character)
  {
      if (character instanceof L2PcInstance)
      {
          ((L2PcInstance) character).sendMessage("Entered Custom Zone XY.");
      }
  }
  
  @Override
  protected void onExit(L2Character character)
  {
      if (character instanceof L2PcInstance)
      {
          ((L2PcInstance) character).sendMessage("Left Custom Zone XY.");
      }
  }
  
  @Override
  public void onDieInside(L2Character character)
  {
      onExit(character);
  }
  
  @Override
  public void onReviveInside(L2Character character)
  {
      onEnter(character);
  }
}

 

now if you want your char to go back to a spawn after Dead and not to town do this for example

 

add :

static class BackToPvp implements Runnable
{
	private L2PcInstance _activeChar;

	BackToPvp(L2Character character)
	{
		_activeChar = (L2PcInstance) character;
	}

	@Override
	public void run()
	{
		_activeChar.teleToLocation(24596 , -24657, 8956); // Random Locs
	}
}

 

So now we Created a"Option" to Teleport the Player back to a Certain place. But to run this Task we have to add the "Trigger" to start this class

 

ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 2000);

 

 

add it OnExit

 

like this :

 

   @Override
  protected void onExit(L2Character character)
  {
      if (character instanceof L2PcInstance)
      {
          ((L2PcInstance) character).sendMessage("Left Custom Zone XY.");
          ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 2000);
      }
  }

now players will get Ported back to the Set Spawn Location.

 

its just a Simple Example, maybe it helps you understand it a bit more

 

 

 

 

 

Link to comment
Share on other sites

  • 0

Thanks For answers ...!

 

eKo you help me a lot i understand what i must do...

 

i had create new zone name PvpZone

 

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.model.zone.type;

import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.zone.L2ZoneType;
import com.l2jserver.gameserver.ThreadPoolManager;

/**
* @author eKo
*/
public class L2PvpZone extends L2ZoneType
{

   public L2PvpZone(int id)
   {
       super(id);
   }
static class BackToPvp implements Runnable
{
	private L2PcInstance _activeChar;

	BackToPvp(L2Character character)
	{
		_activeChar = (L2PcInstance) character;
	}

	@Override
	public void run()
	{
		_activeChar.teleToLocation(10197 , -23396, -3673); // Random Locs
	}
}
   @Override
   protected void onEnter(L2Character character)
   {
       if (character instanceof L2PcInstance)
       {
           ((L2PcInstance) character).sendMessage("Entered Custom PvP Zone.");
       }
   }
   
   @Override
   protected void onExit(L2Character character)
   {
       if (character instanceof L2PcInstance)
       {
           ((L2PcInstance) character).sendMessage("Left Custom PvP Zone.");

       }
   }
   
   @Override
   public void onDieInside(L2Character character)
   {
       ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 2000);

   }
   
   @Override
   public void onReviveInside(L2Character character)
   {
       onEnter(character);
   }
}

 

The problem is that with this code when some1 kills a player the killed player teleported to that location without to put "To Village" + it is dead...

 

For example you kill me and my body is steal down ... then the system without to put "To Village" teleports my dead body to that location... :S ...

 

 

 

any idea??? ? ...  I Just want to press to village and then teleports me to that location :s ...!

 

 

 

Thanks again

Link to comment
Share on other sites

  • 0

Then show us. ^.^

 

Check This and u will understand.....

 

http://www.l2jserver.com/forum/viewtopic.php?f=73&t=15939

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...