Jump to content

Recommended Posts

Posted

Hello again !

 

I decided to re-share this code , ( i got many pm's requesting it )

 

So :

 


I want to share here , a mod i used to use on my server !

 

It is a custom PvP Zone That have some nice features to enjoy PvP's !

 

 

This Zone have :

 

1)Auto Nobless every time you die

2)Auto Flag on Enter

3)When you die , you have the oportunity to write .res and automatically you will respawed into the PvP zone on random locations !

 

For Example ,

 

Player2 got killed from player1

 

Then he have 2 options !

 

1st ) Is to press to village , and go to nearest town

2nd) is to write .res and re-spawned ( with auto noblesse ) into pvp zone  in different location each time !

 

 

In order to use .res feature player will need some Gold knight ( You can change this )

 

 

Ok , credits are mine (*NeverMore*)

 

 

How to apply ?

 

1) Create a new voicedcommandhandler with name Res.java and inside put this code :

 

/*
* 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 handlers.voicedcommandhandlers;

import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;


/**
* *NeverMore*
*
*/
public class Res implements IVoicedCommandHandler
{
    private static final String[] VOICED_COMMANDS = { "res" };

    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {    
        if (command.equalsIgnoreCase("res"))
        {
              if (!activeChar.isAlikeDead())
              {
                 activeChar.sendMessage("You cannot be ressurected while alive.");
                 return false;
              }
           if(activeChar.isInOlympiadMode())
              {
              activeChar.sendMessage("You cannot use this feature during olympiad.");
             return false;
           }
           if(activeChar.isInJail())
             {
              activeChar.sendMessage("You cannot use this command while you are in Jail.");
             return false;
           }
           if(activeChar.isInDuel())
            {
             activeChar.sendMessage("You cannot use this feature during Duel.");
            return false;
          }
          if(activeChar.isFestivalParticipant())
           {
            activeChar.sendMessage("You cannot use this feature during a Festival.");
           return false;
          }
          if(activeChar.inObserverMode())
           {
            activeChar.sendMessage("You cannot use this feature during Observer Mode.");
           return false;
          }
           if(activeChar.getInventory().getItemByItemId(3483) == null)
           {
              activeChar.sendMessage("You need 500 or more Gold Knights to use the .res");
             return false;
           }   
       	if(activeChar instanceof L2PcInstance && ((L2PcInstance)activeChar).getWorldRegion().containsZone(5555))
       	{
              activeChar.sendMessage("You have been ressurected!");
              activeChar.getInventory().destroyItemByItemId("root", 3483, 500, activeChar, activeChar.getTarget());
              activeChar.doRevive();
              activeChar.broadcastUserInfo();
              activeChar.sendMessage("Good Fight !");     
        }
       	else 
       	{
       		activeChar.sendMessage(".res can only be used in PvP Area");
       	}
        }
       return true;
    }
    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }

}

 

2)Now we need to import the vcm , so go to data/scripts/handlers/MasterHandler.java apply this code :

 

@@ -250 +258 @@
import handlers.voicedcommandhandlers.Lang;
+import handlers.voicedcommandhandlers.Res;
import handlers.voicedcommandhandlers.Wedding;

@@ -555 +570 @@

private static void loadVoicedHandlers()
{	
      +VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Res());
	if (Config.L2JMOD_ALLOW_WEDDING)
		VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Wedding());

 

 

3)Create a new zone type with name L2CustomPvP.java and inside put this code :

(+++ java/com/l2jserver/gameserver/model/zone/type/L2CustomPvP.java)

 

/*
* 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.ThreadPoolManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.zone.L2SpawnZone;
import com.l2jserver.util.Rnd;


/**
* An Custom PvP Zone
*
* @author  NeverMore
*/
public class L2CustomPvP extends L2SpawnZone
{
//Ramdom Locations configs
    private static int[] _x = {11551, 10999, 10401};
    private static int[] _y = {-24264, -23576, -24030};
    private static int[] _z = {-3644, -3651, -3660 };

public L2CustomPvP(int id)
{
	super(5555);
}

@Override
protected void onEnter(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, true);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

       if (character instanceof L2PcInstance)
       {
    	   ((L2PcInstance) character).sendMessage("You enter a PvP Area");
           ((L2PcInstance) character).setPvpFlag(1);	           
       }
}

@Override
protected void onExit(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, false);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);

	if (character instanceof L2PcInstance)
	{
		((L2PcInstance) character).stopNoblesseBlessing(null);
		((L2PcInstance) character).setPvpFlag(0);
    	((L2PcInstance) character).sendMessage("You exit from a PvP Area");
	}
}

static class BackToPvp implements Runnable
{
	private L2Character _activeChar;

	BackToPvp(L2Character character)
	{
		_activeChar = character;
	}

        @Override
        public void run()
        {
            int r = Rnd.get(3);
            _activeChar.teleToLocation(_x[r] , _y[r], _z[r]); 
        }
}

@Override
public void onDieInside(L2Character character)
{
       if (character instanceof L2PcInstance)
       {
       }
}

@Override
public void onReviveInside(L2Character character)
{
        ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 500);
        ((L2PcInstance) character).isNoblesseBlessed();
}
}

 

4) Now we should change the Zone Type of the area  ( I use Primeval Isle Warf )

go to : data/zones/peace_zones.xml and aply this code :

 

@@ -834 +847 @@
-	<zone name="primeval_peace1" type="PeaceZone" shape="NPoly" minZ="-4290" maxZ="-1290"> <!-- [20_17] -->
-		<node X="10408" Y="-27395" />
-		<node X="12065" Y="-25334" />
-		<node X="12223" Y="-23159" />
-		<node X="10424" Y="-22340" />
-		<node X="9566" Y="-23131" />
-		<node X="9290" Y="-24261" />
-	</zone>
-	<zone name=" primeval_peace2" type="PeaceZone" shape="NPoly" minZ="-4792" maxZ="208"> <!-- [20_17] -->
-		<node X="4850" Y="-4736" />
-		<node X="7294" Y="-4712" />
-		<node X="8529" Y="-820" />
-		<node X="3615" Y="-737" />
-	</zone>
+	<zone name="primeval_peace1" type="CustomPvP" shape="NPoly" minZ="-4290" maxZ="-1290"> <!-- [20_17] -->
+		<node X="10408" Y="-27395" />
+		<node X="12065" Y="-25334" />
+		<node X="12223" Y="-23159" />
+		<node X="10424" Y="-22340" />
+		<node X="9566" Y="-23131" />
+		<node X="9290" Y="-24261" />
+	</zone>
+	<zone name=" primeval_peace2" type="CustomPvP" shape="NPoly" minZ="-4792" maxZ="208"> <!-- [20_17] -->
+		<node X="4850" Y="-4736" />
+		<node X="7294" Y="-4712" />
+		<node X="8529" Y="-820" />
+		<node X="3615" Y="-737" />
+	</zone>

 

 

Here is an example , on how to add the coordinates

 

loc 1  x=1 y=2 z=3

loc 2  x=4 y=5 z=6

loc 3  x=7 y=8 z=9

 

you should make it like this

 

 

 

 private static int[] _x = {1, 4, 7};
    private static int[] _y = {2, 5, 8};
    private static int[] _z = {7, 8, 9 };

 


 

UPDATE 1

 

 

I test it on H% and it is not working as it is

 

So Here is the new coded with simple changes to work fine at H5 ! [3rd Step ONLY]

 

/*
* 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.ThreadPoolManager;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.util.Rnd;


/**
* An Custom PvP Zone
*
* @author  NeverMore
*/
public class L2CustomPvP extends L2RespawnZone
{
//Ramdom Locations configs
    private static int[] _x = {11551, 10999, 10401};
    private static int[] _y = {-24264, -23576, -24030};
    private static int[] _z = {-3644, -3651, -3660 };

public L2CustomPvP(int id)
{
	super(5555);
}

@Override
protected void onEnter(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, true);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, true);

       if (character instanceof L2PcInstance)
       {
    	   ((L2PcInstance) character).sendMessage("You enter a PvP Area");
           ((L2PcInstance) character).setPvpFlag(1);	           
       }
}

@Override
protected void onExit(L2Character character)
{
	character.setInsideZone(L2Character.ZONE_PVP, false);
	character.setInsideZone(L2Character.ZONE_NOSUMMONFRIEND, false);

	if (character instanceof L2PcInstance)
	{
		((L2PcInstance) character).stopNoblesseBlessing(null);
		((L2PcInstance) character).setPvpFlag(0);
    	((L2PcInstance) character).sendMessage("You exit from a PvP Area");
	}
}

static class BackToPvp implements Runnable
{
	private L2Character _activeChar;

	BackToPvp(L2Character character)
	{
		_activeChar = character;
	}

        @Override
        public void run()
        {
            int r = Rnd.get(3);
            _activeChar.teleToLocation(_x[r] , _y[r], _z[r]); 
        }
}

@Override
public void onDieInside(L2Character character)
{
       if (character instanceof L2PcInstance)
       {
       }
}

@Override
public void onReviveInside(L2Character character)
{
        ThreadPoolManager.getInstance().scheduleGeneral(new BackToPvp(character), 500);
        ((L2PcInstance) character).isNoblesseBlessed();
}
}

 


 

UPDATE 2

 

 

Here is a small fix if you want players to stay Flagged 10 seconds after they exit my Custom Pvp Zone

 

Index: trunk/L2J_Server/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- trunk/L2J_Server/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (revision 308)
+++ trunk/L2J_Server/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (revision 309)
@@ -657,13 +657,17 @@
    {
        updatePvPFlag(1);

-       _PvPRegTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PvPFlag(), 1000, 1000);
+       if (_PvPRegTask == null)
+           _PvPRegTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PvPFlag(), 10000, 10000);
    }

    public void stopPvpRegTask()
    {
        if (_PvPRegTask != null)
+       {
            _PvPRegTask.cancel(true);
+           _PvPRegTask = null;
+       }
    }

    public void stopPvPFlag()

 

PS: Dont forget to Start Flag onExit !

Posted

I won't use it but If you tested it and it works then I gratz you.

AND I'll award you if a member test it and say it works because it's the 1st cool share I see for Freya - Hi5

Works 100 % because i use it ..!

 

But ok , if any1 tested reply with results ;)

Posted

FOR ME WORKS.. !!! Cool Share M8!! Keep It Up!!

Np ! Report me any prob , to fix it ;)

im gonna test this and if it works im gonna use it on my server you should protect this with 100 post or something :D

Done !

 

 

Thanks for good words !

Posted

You just took this code http://l2jfrozen.com/index.php?topic=4869.0

and you removed some parts.Not really smart.And this won't work btw.You get the flag but on kill you got karma

 

also another one is here http://www.-leeching-.net/forum/index.php?topic=11648.0

 

First of all , i dont use IL and i even not have an account on this forum ... ( l2j frozen )

Second,

.Res command can be made this way . . . if you know something more edvance then tell me  ;)

(For Example if i ask some1 make me this command he will make it this way) [ i quess ]

 

And about Gp share is completely different ... if you know java and read my code you will understand what i mean !

I am not a leeacher and everyone here know it ;)

 

Thanks for reply !

Posted

You just took this code http://l2jfrozen.com/index.php?topic=4869.0

and you removed some parts.Not really smart.And this won't work btw.You get the flag but on kill you got karma

 

also another one is here http://www.-leeching-.net/forum/index.php?topic=11648.0

lol i cant believe that nevermore is leacher

i saw his post in L2 Dev help section about this mod

and i am  sure its done by him 100%

 

On topic : nice share it work in freya l2jserver last  rev ?

Posted

lol i cant believe that nevermore is leacher

i saw his post in L2 Dev help section about this mod

and i am  sure its done by him 100%

 

On topic : nice share it work in freya l2jserver last  rev ?

 

;)

 

Yes it should work and for latest rev ;) If you have any prob , post it here to help you !

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • 🍂 The cost on Vibe-sms is dropping, like autumn leaves falling from the trees.     It’s a little sad to watch the last days of summer fade away with its warmth, but that’s how the world works  every season has its own rules. The same goes for our prices: they are gradually but steadily going down, opening up new opportunities and great deals. 💸   🌍 USA is already at the minimum, and Europe, Asia, and dozens of other countries will follow soon. Don’t miss out  fresh rates are waiting for you!   Website link — https://vibe-sms.net/ Our Telegram channel — https://t.me/vibe_sms
    • You didn't tell me anywhere that you wanted core.jar as proof, I have everything ready for an independent developer to review. All the conversations, all your edits. I won't settle anything with you, so you can threaten me again and damage my name.
    • So what? Did i say anything wrong? You have no idea what source/compile is. I still wait for your .jar or source to be posted since you say i destroyed the compiled version of yours. Why you don't post it? Are you afraid that people will just see few addon lines and you did not even know that your source and compiled had different things? I should not even waste 2 minute to fix your raidboss_spawnlist thing.    Your mentally ill. What you posted is our primary deal nothing against me.  Because all he does is post whatever i write as if i hide and i did not say any mod to join and check my discord. i want him actual post something against me or any offenses i did. I also requested him several hours ago to post his .jar where my code "HACKED" his server but he wont post.    Nobody should allow open a random topic and cause issues to other's life without proofs. I demand punishment and soon unless he post evidence that i hurt his server or left him or did not make what he asked. 
    • guys it is probably a misunderstanding if it was windows he would have solve it since its not windows and from the paraphrasing of the developer who eventually fixed the server   the problem was from guessing the login server was not properly opening or already crashed, so the gameserver probably loaded because he was generating logs, and then stopped, my guess is still there was no login to connect and made exits, still this is a guess because i have only saw some logs and images   in one side nobody would destroy a server for this amount of money in the other side he had no experience with the operating system, and i find this logical, i am also still giving some tutorials in the topic owner so he can learn how to compile and not need the help of others, i still believe this can be solved for both parties if they behave   in the end nobody wants to cause bad to another so as i say in my starting point, it is probably a misunderstanding
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock