Jump to content
  • 0

[Help] Pvp points from Mobs


Question

Posted

Hello i have pvp points on my server. From each killed pleyera gets his 10% pvpPoints and that points has stored in db new column in characters

Wanna know how to add these points to the mobs and get them together with exp and sp.

but if exp is set to 7000 is a mob would give me 7 pvppoints.

hope u understand me cuz my english is more funny than the understandable.

Recommended Posts

  • 0
Posted

 

 

 


public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();

	if (player != null)
	{
		int numberToAdd = 500;
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));

		if (player.getParty() != null)
		{

			numberToAdd = (500/(player.getParty().getMemberCount()));
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				if  (!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, player, member, true));
				{
				member.setPvpPoints(member.getPvpPoints() + numberToAdd);
				member.sendMessage("You have earned " + numberToAdd + " PvP Points");
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));

				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
				}
			}
		}
		else
		{
			player.setPvpPoints(player.getPvpPoints() + numberToAdd );
			player.sendMessage("You have earned " + numberToAdd + " PvP Points");				
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

		}
	}

	RaidBossSpawnManager.getInstance().updateStatus(this, true);
	return true;
}

 

the same as in the previous post

  • 0
Posted

if  (!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, player, member, true));

 

Try to explain with words what does this line. Explain all, variables, [glow=red,2,300]symbols[/glow] (one word is important in this post).

 

Basically, your code is good, but you do a mistake. Check again the important word of the post.

 

Another thing I can say to help you. Basically, the code works if you're FAR but not if you're NEAR. It means the range checker works (if it wasn't working at all, you will never have points in party), but not like you want. Why ? This was another big tip :).

  • 0
Posted

"if (!Util[util is class for calculating x, y, z, range angle etc for object from L2Object].checkIfInRange(range from object1 to object2, object1, object2, include zAxis[false or true]   ));"  

 that is my thinking on this

 

for me i think important word is "count members in range"

 

 

 

and the whole time I think on this

  • 0
Posted

Well I give you the answer because you're blind or you don't know the use of this symbol.

 

The "!" located before "Util." means basically "if it's not / different of". Aka it's reverse the condition true/false.

 

So your check means currently : if the range is more than 1400/1600, give pvp points to each members. If the range is lower, skip the statement.

 

So if you're far of the killer, it will be true, when you're near the killer, it will be false. And it's why you earn rewards from far and not near.

 

Delete the symbol to make the correct check.

 

And merry christmas :p.

  • 0
Posted

Merry chrismas for you too ;]

I can not think, it hurts my tooth, broke a bone tomorrow I have to go to work.

And i do as u wrote removed "!" and effect the same.

and it does not matter whether the member is near or far.

  • 0
Posted

Let's see what can be wrong :

 

- this formula isn't the good one ;

- checkIfInRange is broken ;

- The range put in config (in this case, ALT_PARTY_RANGE2) is too low ;

- you're not in the good range ingame, so basically even if it works you think it's broken.

- you didn't updated your l2jserver.jar but think you did ;

- you found a way to make another error correcting this one ;

 

------

 

Here is a code showing you the use (basically, pick a random party member in range)

 

	private L2PcInstance getCheckedRandomMember(int ItemId, L2Character target)
{
	List<L2PcInstance> availableMembers = new FastList<L2PcInstance>();
	for (L2PcInstance member : getPartyMembers())
	{
		if (member.getInventory().validateCapacityByItemId(ItemId) &&
				Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true)) availableMembers.add(member);
	}
	if (!availableMembers.isEmpty()) return availableMembers.get(Rnd.get(availableMembers.size()));
	else return null;
}

 

That removes those points :

- this formula isn't the good one ;

- checkIfInRange is broken ;

 

The others errors are users errors, so guess what :D.

 

Another thing, rewrite your code like that :

 

					if  (Util.checkIfInRange(Config.ALT_PARTY_RANGE2, player, member, true));
				{
				     member.setPvpPoints(member.getPvpPoints() + numberToAdd);
				     member.sendMessage("You have earned " + numberToAdd + " PvP Points");
				}

				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));

				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());

  • 0
Posted

I do not know what I do, but I do not want to give up. In addition, the tooth hurts my head, I have the impression that you matches.

do not know the fundamentals of programming in Java.

 


public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();

	if (player != null)
	{

		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));

		if (player.getParty() != null)
		{			
		List<L2PcInstance> availableMembers = new FastList<L2PcInstance>();
		for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				int numberToAdd = (500/(player.getParty().getMemberCount()));
				if (Util.checkIfInRange(Config.ALT_PARTY_RANGE2, player, member, true)) availableMembers.add(member);
				member.setPvpPoints(member.getPvpPoints() + numberToAdd);
				member.sendMessage("You have earned " + numberToAdd + " PvP Points");
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));

				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
			}
			if (!availableMembers.isEmpty()) return availableMembers.get(availableMembers.size()) != null;
			else return null != null;
		}		



 

Do not compile with this code cuz "if (!availableMembers.isEmpty()) return availableMembers.get(availableMembers.size()) != null;" < -- here eclipse give me quick fix [insert null check]

here the same "else return null != null;"     -      It is strange, but I will not contradict with the eclipse.

 

Or not what you meant and I'm stupid;] If I did everything wrong gives it a rest

 

 

Edit; i read yor edit and did as written,  but unfortunately the same story

 

  • 0
Posted

Ouahou, perhaps you should take some time. You know, it's pointless to code if you are ill or if you can't think correctly.

 

Just re-think to the code in some days, you melt all what I said and it's not good.

 

The first code I posted was only to show one use of checkIfInRange, nothing more. Just saying "heeee, the code is used in this method, so it should normally work".

 

Edit your previous code to remove this crappy code and put the updated version.

 

And forget Java for 2-3 days. To avoid mental self-side issues :P.

  • 0
Posted

Hello how do you feel in the new year? ;]

I wrote a post on l2jforum for help and now have this code;

 

	@Override
public boolean doDie(L2Character killer)
{
	if (!super.doDie(killer))
		return false;

	L2PcInstance player = null;
	if (killer instanceof L2PcInstance)
		player = (L2PcInstance) killer;
	else if (killer instanceof L2Summon)
		player = ((L2Summon) killer).getOwner();

	if (player != null)
	{
		broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));
		if (player.getParty() != null)
		{
			int numberToAdd = 500 /player.getParty().getMemberCount();
			for (L2PcInstance member : player.getParty().getPartyMembers())
			{
				RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
				if(member.isNoble())
					Hero.getInstance().setRBkilled(member.getObjectId(), this.getNpcId());
                  if (Util.checkIfInRange(Config.ALT_PARTY_RANGE2, this, member, true))
                	
                   {
                	  member.setFame(member.getFame() + numberToAdd);
                      member.sendMessage("You have earned " + numberToAdd + " Fame Points");
                   }
                
			}
		}
		else
		{
			RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
			if(player.isNoble())
				Hero.getInstance().setRBkilled(player.getObjectId(), this.getNpcId());

               if  (Util.checkIfInRange(Config.ALT_PARTY_RANGE2, this, player, true))
               {
                   player.setFame(player.getFame() + 500);
                   player.sendMessage("You have earned " + 500 + " Fame Points");
               }
		}
	}

	RaidBossSpawnManager.getInstance().updateStatus(this, true);
	return true;
}

 

 

This code works like this: The player does not get PvP Points out of the range, but the Rb killer gets only half cuz 2 players is in party

Noe need added code here

 

int numberToAdd = 500 / ??? );

 

??? = get int members in range

  • 0
Posted

Any error with this code ?

 

Btw, some parts are useless. So I don't think it comes from L2Jserver forum :P.

 

And they changed PvPKill for Fame.

 

Use indentation too, it's boring to read broken code.

  • 0
Posted

I changed to fame  so as not to explain too much

but I gave up. I added the item to  drop  for the bosses, who can replace for pvp points.

Sorry I took your time and nothing came, and thank you very much for the Java science ;]

  • 0
Posted

I changed to fame  so as not to explain too much

but I gave up. I added the item to  drop  for the bosses, who can replace for pvp points.

Sorry I took your time and nothing came, and thank you very much for the Java science ;]

 

w_w

 

Anyway, when you will be more experienced, you will see it wasn't an hard code.

 

Sometimes you have to give up to find the solution.

 

Don't hesitate to re-post if you got problems anew.

  • 0
Posted

Hi have one more question how add here

 

      if (killer != null)
      {
         L2PcInstance pk = killer.getActingPlayer();
            {
                       // if the victim was pvpflagged
                       if (getPvpFlag() != 0)
                       {
                             int pointsToAdd = (int) (_pvpPoints*0.10);
                             int pointsToRemove = _pvpPoints - pointsToAdd < 0 ? 0 : _pvpPoints - pointsToAdd;

                            // remove points to the victims and add points to the killer.
                             pk.setpvpPoints(pk.getpvpPoints() + pointsToAdd);
                             setpvpPoints(pointsToRemove);
                        }

 

int pointsToAdd = (int) (_pvpPoints*0.10); but no more than 1000 points

I tried to do it myself but I do not know where I am proud to idea

  • 0
Posted

You have to use math min.

 

http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Math.html

 

static double 	min(double a, double b)
         Returns the smaller of two double values.

 

If A value is higher than B value, it will return B value.

 

There aren't a lot of example in L2J, but still there are some (like 2 database connections minimum using math max).

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

    • Dear partners! At the moment, we are in great need of the following items: TikTok Ads and Google Ads advertising accounts with an ad limit starting from $100. Countries: Europe, USA, Asia Contact us via the contacts in the thread or in this post. We look forward to cooperating! Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing our products and services: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in September! You can also use the first-purchase promo code: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply write your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." — you need to post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts & Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear partners! At the moment, we are in great need of the following items: TikTok Ads and Google Ads advertising accounts with an ad limit starting from $100. Countries: Europe, USA, Asia Contact us via the contacts in the thread or in this post. We look forward to cooperating! Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing our products and services: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in September! You can also use the first-purchase promo code: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply write your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." — you need to post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts & Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Hey everyone, I’m thrilled to introduce our upcoming server, Dragon‑Network, built on the powerful Interlude+ chronicle and crafted for serious PvP, balanced progression and community fun. Below you’ll find all the key details — rates, features, event structure, and why this will be your next home for Lineage 2. 📅 Grand Opening November 21, 2025 — mark the date, rally your friends, prepare your gear. The realm opens, and the wars begin. ⚙️ Rates & Server Setup XP: 10× Chronicle: Interlude+ (expanded from our previous server) PvP-focused content, daily events, and reward-rich systems These core settings ensure you’ll feel progress and power, without losing the depth of classic Interlude. 🎯 Features & Highlights Based on our features page: Alternative class change quests: skip the lengthy standard quests by collecting tradable items dropped by monsters. Dragon-Network Full Interlude+ content: Kamaloka, Labyrinth, Pailaka quests, Hellbound Island, S80 items, Attribute system, Isle of Prayer hunting zone, siegeable fortresses and more. Dragon-Network Daily Team vs Team (TvT) events: prove your worth, climb the ranks and earn valuable rewards. Dragon-Network Balanced PvP mechanics: custom sub-stack features, armor mastery rules, optimized skill effects — all to keep the fight fair and skill-based. Dragon-Network Other extras: Raid Bosses with defined respawn times, rich loot systems, improved QOL features like improved buffs, combo songs/dances, tattoo system, etc. Dragon-Network 🎮 Why This Server Matters You’re playing Interlude+, but with modern enhancements — classic content with new mechanics, not a simple resurrect of the old. PvP and events are daily and structured, so you don’t wait weeks to engage. We’ve designed progression to be meaningful: rewards, class changes, content unlocks all move you forward without feeling pay-to-win. Community-first: Whether you enter solo or with friends, you’ll find team action, clans forming, and events where everyone has a chance to shine. 🗺 What to Do Next Visit our website: dragon-network.eu (check out the “Features” tab for full details) Prepare your Master Account, get your clan or buddies ready. On launch day (Nov 21), log in early, grab your spot, participate in the first TvT, and start building your legacy. Get ready — the gates open soon. The grind begins. The battles await. Will you rise to become legend on Dragon-Network? 🐉 Feel free to ask any questions below or share this post with your friends. Let’s make this launch one to remember.
    • NFT gifts on Telegram are already here! Buy Stars at SOCNET — the black background can be yours today! Purchase existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium, and react to messages in channels! Low prices, many payment methods, and other cool and unique features! Try it today — SOCNET STARS BOT Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and beneficial purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing our products and services: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in September! You can also use the first-purchase promo code: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply write your username after registration on our website in the following format: "SEND ME BONUS, MY USERNAME IS..." — you need to post it in our forum thread! 3. Get $1 for your first SMM Panel trial: just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts & Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • NFT gifts on Telegram are already here! Buy Stars at SOCNET — the black background can be yours today! Purchase existing gifts in the official store using Telegram Stars, pay for subscriptions, donate to games and projects, pay for Premium, and react to messages in channels! Low prices, many payment methods, and other cool and unique features! Try it today — SOCNET STARS BOT Active links to SOCNET stores: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and beneficial purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We would like to present to you the current list of promotions and special offers for purchasing our products and services: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, bot) in September! You can also use the first-purchase promo code: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10–20% discount — simply write your username after registration on our website in the following format: "SEND ME BONUS, MY USERNAME IS..." — you need to post it in our forum thread! 3. Get $1 for your first SMM Panel trial: just open a ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Stars purchasing bot! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh Contacts & Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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