Jump to content
  • 0

[Help] pvp for all players in party


Question

Posted

Hello.

I would like to do the trick on the server, for everyone in the party got a pvp point when one of them kills the player.

 

Starting in L2PcInstance under  this line --> "public boolean doDie(L2Character killer)"

and if yes how to check if player is in range?

8 answers to this question

Recommended Posts

  • 0
Posted

like that?

Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revision 286)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -5955,6 +5955,26 @@

		if (killer != null)
		{
+			if(killer instanceof L2PcInstance)
+			{
+				L2Party party = killer.getParty();
+				if (party != null)
+				{
+					for(L2PcInstance PartyMember : party.getPartyMembers())
+					{
+						if(PartyMember.isInsideRadius(this, 1000, true, false) && PartyMember != killer)
+						{
+							PartyMember.setPvpKills(PartyMember.getPvpKills() + 1);
+							
+						}
+					}
+				}
+			}
+			
			//Bugfix pet killers
			if(killer instanceof L2SummonInstance)
			{


  • 0
Posted

is working but pvp points for party member appear when log out and log in not in real time,

 

i have thinking something about fame

 

now have this in L2PcInstance

 

			

		if (killer instanceof L2PcInstance && getPvpFlag() > 0)
					{
					   L2PcInstance kill = (L2PcInstance) killer;
					   int pointsToAdd = (int) (_fame*0.10);
					   int pointsToRemove = _fame - pointsToAdd < 0 ? 0 : _fame - pointsToAdd;
					   kill.setFame(kill.getFame() + pointsToAdd);
					   setFame(pointsToRemove);
					   killer.sendMessage("You have earned " + pointsToAdd + " Fame Points from " + getName() + "");
		               killer.broadcastPacket(new MagicSkillUse(killer, 23021, 1, 0, 0));
		       		{
       					if(killer instanceof L2PcInstance)
		 			{
		    				L2Party party = killer.getParty();
		    				if (party != null)
		    				{
		    					for(L2PcInstance PartyMember : party.getPartyMembers())
		    					{
		    						if(PartyMember.isInsideRadius(this, 1000, true, false) && PartyMember != killer)
		    						{
		    							PartyMember.setPvpKills(PartyMember.getPvpKills() + 1);
		    				}
		    			}
		    		}
				}
		    }
		 }


and howto do to distribute fame and pvp

i mean if in party is 4 players so get 10% points (divide by 4) and give 1 pvp to all players in party [in real time]

hope understand me,

  • 0
Posted

Idk much about java i just want to add that fame and pvp for all players in party, so im NooB if going about java.

So if u can help me i will be happy, and no need to by in real time. once a player must sign out  ;D

  • 0
Posted

Hello again

 

i used your code to improve mine but have bug

but I have a problem when the killer is alone, he gets 5% of the fame of the player who lost

when the killer is in the party also gets 5% of his fame and memberd party gets 5% share in the number of players in a party

 

should be so -> when a player is in the party gets 5% divided by number of players in a party

 

+			
+						if (killer instanceof L2PcInstance && getPvpFlag() > 0)
+						{
+						 
+						   L2PcInstance kill = (L2PcInstance) killer;
+						   int pointsToAdd = (int) (_fame*0.05);
+						   int pointsToRemove = _fame - pointsToAdd < 0 ? 0 : _fame - pointsToAdd;
+						   kill.setFame(kill.getFame() + pointsToAdd);
+						   kill.setSp(kill.getSp() + pointsToAdd);
+						   setFame(pointsToRemove);
+						   killer.sendMessage("You have earned " + pointsToAdd + " Fame Points from " + getName() + "");
+			               killer.broadcastPacket(new MagicSkillUse(killer, 23021, 1, 0, 0));
+			       		{
+			       		
+			       		}
+
+					    {
+       					if(killer instanceof L2PcInstance && getPvpFlag() > 0)
+			 			{
+			    				L2Party party = killer.getParty();
+			    				if (party != null)
+			    				{
+			    					for(L2PcInstance PartyMember : party.getPartyMembers())
+			    					{
+			    						if(PartyMember.isInsideRadius(this, 1600, true, false) && PartyMember != killer)
+			    						{
+			    							int numberToAdd = (int) (_fame*0.05/party.getMemberCount());
+			    							PartyMember.setFame(PartyMember.getFame() + numberToAdd);
+			    							PartyMember.setSp(PartyMember.getSp() + numberToAdd);
+			    							int pointsToRemove1 = _fame - numberToAdd < 0 ? 0 : _fame - numberToAdd;
+			    							setFame(pointsToRemove1);
+			    							PartyMember.setPvpKills(PartyMember.getPvpKills() + 1);
+			    							PartyMember.sendMessage("You have earned " + numberToAdd + " Fame Points from " + getName() + "");
+			    							PartyMember.broadcastPacket(new MagicSkillUse(killer, 23021, 1, 0, 0));
+			    				}
+			    			}
+			    		}
+					}
+			    }
+			 }

 

when i enter "L2Party party = killer.getParty();" for killer have error in console andcode dont work

 

something like that :

 

+			
+						if (killer instanceof L2PcInstance && getPvpFlag() > 0)
+						{
+						   L2Party party = killer.getParty();
+						   L2PcInstance kill = (L2PcInstance) killer;
+						   int pointsToAdd = (int) (_fame*0.05/party.getMemberCount());
+						   int pointsToRemove = _fame - pointsToAdd < 0 ? 0 : _fame - pointsToAdd;
+						   kill.setFame(kill.getFame() + pointsToAdd);
+						   kill.setSp(kill.getSp() + pointsToAdd);
+						   setFame(pointsToRemove);
+						   killer.sendMessage("You have earned " + pointsToAdd + " Fame Points from " + getName() + "");
+			               killer.broadcastPacket(new MagicSkillUse(killer, 23021, 1, 0, 0));
+			       		{
+			       		
+			       		}
+
+					    {
+       					if(killer instanceof L2PcInstance && getPvpFlag() > 0)
+			 			{
+			    				
+			    				if (party != null)
+			    				{
+			    					for(L2PcInstance PartyMember : party.getPartyMembers())
+			    					{
+			    						if(PartyMember.isInsideRadius(this, 1600, true, false) && PartyMember != killer)
+			    						{
+			    							int numberToAdd = (int) (_fame*0.05/party.getMemberCount());
+			    							PartyMember.setFame(PartyMember.getFame() + numberToAdd);
+			    							PartyMember.setSp(PartyMember.getSp() + numberToAdd);
+			    							int pointsToRemove1 = _fame - numberToAdd < 0 ? 0 : _fame - numberToAdd;
+			    							setFame(pointsToRemove1);
+			    							PartyMember.setPvpKills(PartyMember.getPvpKills() + 1);
+			    							PartyMember.sendMessage("You have earned " + numberToAdd + " Fame Points from " + getName() + "");
+			    							PartyMember.broadcastPacket(new MagicSkillUse(killer, 23021, 1, 0, 0));
+			    				}
+			    			}
+			    		}
+					}
+			    }
+			 }

 

probably a mess in the code too much, but it works so far.

  • 0
Posted

+						   L2Party party = killer.getParty();
+						   L2PcInstance kill = (L2PcInstance) killer;
+						   int pointsToAdd = (int) (_fame*0.05/party.getMemberCount());
+

that will give you NPE if the killer doesnt have party

  • 0
Posted

know that, so in first code is w/o party but give me bug, because player with and without party gets the same points, and should get as much as others in the party.

 

player without party = 5%

player with party = 5% divide by "MemberCount()"

 

 

  • 0
Posted
+						if (killer instanceof L2PcInstance && getPvpFlag() > 0)
+						{
+						   L2Party party = killer.getParty();
+						   L2PcInstance kill = (L2PcInstance) killer;
+						   int pointsToAdd;
+						   if (party == null)
+						   {
+						   	pointsToAdd = (int) _fame*0.05;
+						   }
+					           else
+						   {
+							pointsToAdd = (int) (_fame*0.05/party.getMemberCount());
+						   }
+						   
+						   int pointsToRemove = _fame - pointsToAdd < 0 ? 0 : _fame - pointsToAdd;
+						   kill.setFame(kill.getFame() + pointsToAdd);
+						   kill.setSp(kill.getSp() + pointsToAdd);
+						   setFame(pointsToRemove);
+						   killer.sendMessage("You have earned " + pointsToAdd + " Fame Points from " + getName() + "");

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • The Return of L2Elixir – A Legacy Reborn in 2025 Read more features: https://l2elixir.org/features/ It’s time to relive the magic. Many of you remember L2Elixir, first launched in 2008 – a server that brought players together, created friendships, rivalries, and unforgettable memories. For two+ incredible years, until its closure in 2010, Elixir was more than just a server… it was home. In 2018, a fake project borrowed the name and damaged that legacy, but the true memories of L2Elixir never died. Today, in 2025, we are proud to announce that a new dedicated team has taken up the mantle to bring L2Elixir back to life – with respect for the past and a fresh vision for the future.   What to Expect We’re not here to be “just another server.” Our mission is to bring back nostalgia with innovation, offering a unique progression experience: Interlude-Like start, capturing that classic old-school feeling. A natural evolution into Gracia Final. Followed by Gracia Epilogue, keeping the journey alive without losing balance. This is not a copy-paste server – it’s a carefully crafted world designed to honor the spirit of Lineage II while introducing fresh ideas to keep the gameplay alive and rewarding. Why L2Elixir? A balanced environment where community comes first. A project built with passion, not profit. A server that values longevity, fairness, and nostalgia.   📅 Launch Date & Details Closed Beta: Online. Open Beta & Rewards: November 15 & 21:00 UTC +2 Launch: November 28 & 21:00 UTC +2   🔗 Join the Community Be part of history once again. Follow our Discord, join the discussion, and prepare to step back into the world where legends were made.   https://l2elixir.org/ https://discord.gg/5ydPHvhbxs L2Elixir 2025 – Honoring the Past. Building the Future.
    • 10-24-2025 - OUR TOPIC IS RELEVANT! CONTACT US BY THE CONTACTS BELOW
    • Can someone decompile in classes this LineageSkilleffect.u ? I am willing to pay if needed,  protocol god any. https://wormhole.app/BEj0pr#osVXtnL9Q-AmmVmxOcEZfw
    • I didn't have the key for the cache too i just writen random things, then the second time i opened it i didn't need to use the serial key again
    • estoy montandolo en mi win10pro jaja descargue tu rar y ahora no puedo iniciar la cache ya que pide una key serial podrias ayudarme asi lo monto para jugar solo  en el server.exe tambien me pide un serial   
  • 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