Jump to content
  • 0

[Help] Pvp points from Mobs


dymek1984

Question

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.

Link to comment
Share on other sites

Recommended Posts

  • 0

 

 

 


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

Link to comment
Share on other sites

  • 0

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 :).

Link to comment
Share on other sites

  • 0

"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

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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());

Link to comment
Share on other sites

  • 0

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

 

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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 ;]

Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   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

    • just a few things normally the 50/50 means first 50 is collateral in case you decide to go back in your agreement, for "closing" the job, using his time etc... (meaning non-refundable)   the fact that you had to pay for this extra work any amount of money is a joke..   the poor communication from ave side is known nothing new here i guess you knew that already, and no i dont mean his classic behaviour, a professional discusses the timeframes.   there are many (even free) alternatives for updaters and is cheaper to hire somebody to slap your logo in a background..   Note: the video and the discussion made my day both dont know how client works while working on it (for metaman i get it he pays for the service he dont know how it works)   but ave was funny as fuck "i am not client dev either" 
    • You should be thankfull that he even gave u back 100, just because u cant wait, u expect full refund while that guy already almost finished, i think ave is right, i worked with him, no issues ofc delay but thats life 😁  
    • *¶¶¶+2349158681268¶¶¶ Welcome to the home of wealth and fame.*        Many have seek for wealth and it’s quiet a thing of pity +2349158681268 that some do so in wrong places which made it doubtful of the true source and it is at this juncture that i approach you with the right source of wealth which you have really seek for. ZERUZANDAH BROTHERHOOD OCCULT is an association of those that has been blessed by Lord Lucifer zeruzandah the great and have decided to educate the masses on the possible ways of acquiring the wealth, power,protection fame and every other thing you could think of without human sacrifice. Gone are the days when human blood are required for sacrifice here at zeruzandah Brotherhood, human blood sacrifice has been abolished because the money you are seeking for should be used to help and sponsor your loved ones but you have to have it at the back of your mind that there is a very great sacrifice which you must pay to pierce the heart of the spiritual world so that you can be blessed here on human Earth and that sacrifice will be according to what zeruzandah wants you to do which the Grandmaster of this temple will tell you when you’ve been in contact with him. Here at zeruzandah Brotherhood we only demand some sacrificial items and some special animal blood for sacrifice in order to please the Lord Lucifer to bless you here on Earth. If anyone from anywhere tells you that we accept anything money from you in order for you to be initiated into this Brotherhood, inform the TEMPLE GRANDMASTER +2349158681268 zeruzandah Brotherhood do not accept any money from you except you are the one to fund your sacrificial items. Contact the temple Grandmaster at +2349158681268   Spiritual grandmaster of ZERUZANDAH BROTHERHOOD +2349158681268   I WANT TO JOIN SECRET OCCULT FOR MONEY RITUALS IN NIGERIA OR GHANA TO BE RICH AND TO MAKE MONEY, WITH NO HUMAN SACRIFICE OR BLOODSHED CALL +2349158681268 FOR YOUR BUSINESS SUCCESS TO WIN ELECTIONS TO BE FAMOUS AND POWERFUL,   The ZERUZANDAH Brotherhood is a spiritual fraternal society whose aims are the cultivation of Inner Power through the study and practice of esoteric arts for the improvement of body, mind and spirit.   It unites its members in brotherhood and in the quest for wisdom, successful living and finding one’s purpose in life. It has no secret agenda .While it is a deeply spiritual organization, it promote a particular religion or belief.   The Brotherhood transmits an esoteric tradition spanning thousands of years, with a universal vision born in the East and embracing the best of the West in the quest to return to the ancient and original Tao or Source of all wisdom.   WELCOME TO ZERUZANDAH BROTHERHOOD,   The Club of the Rich and Famous; is the world oldest and largest fraternity made up of 3 Millions Members. We are one Family under one father who is the Supreme Being. In ZERUZANDAH OCCULT Brotherhood we believe that we were born in paradise and no member should struggle in this world. Hence all our new members are given Money, Wealth,Fame , Power ETC.   Fear and anxiety has drawn so many people back to unfulfilled dreams and make their quest for wealth and power shambled, it is thing of fact that money ritual Occult is not and can never be a sin because Occult is still a religion despite what ever others are thinking and zeruzandah Brotherhood is here to give life to that dead hope of acquiring your desired wealth,fame and power without human sacrifice. Contact the Spiritual Grandmaster of ZERUZANDAH Brotherhood now at +2349158681268   The wealth of this life goes to those who deserve and desire it by their decision of breaking the wicked chain of poverty. It is actually a thing of fact that poverty is real and it’s not your fault that it exists but however will be your fault and greatest mistake if you allow poverty to exist in your life because of fear. Only the brave makes the move to liberate himself from humiliating nature of poverty…   +2349158681268   You can be rich, wealthy, famous etc without human blood@ZERUZANDAH BROTHERHOOD contact the Spiritual Grandmaster now +2349158681268   The desire to remove the garment of poverty rest on your shoulder and I will advise you do so now by being an initiated member of zeruzandah Brotherhood.   For enquires, contact the Spiritual Grandmaster now@ +2349158681268   The men of the world can only see within the limit of the eye and the things of the spirit are meant for the spirit to see. You can never be that wealthy,rich and famous without controlling the Spiritual wealth and fame that Lucifer the Great Spiritual father offers to those who are humble to him. You have been admiring the wealthy people around you and wish to be so wealthy or more than they do but you are yet to discover the Secret of WEALTH. There so many things known by the rich and the wealthy which the poor don’t know and don’t want to know because of their unnecessary fear. The secret to what you seek is to join a secret occult society.   Call now for enquiries +2349158681268.
    • *¶¶¶+2349158681268¶¶¶ Welcome to the home of wealth and fame.*        Many have seek for wealth and it’s quiet a thing of pity +2349158681268 that some do so in wrong places which made it doubtful of the true source and it is at this juncture that i approach you with the right source of wealth which you have really seek for. ZERUZANDAH BROTHERHOOD OCCULT is an association of those that has been blessed by Lord Lucifer zeruzandah the great and have decided to educate the masses on the possible ways of acquiring the wealth, power,protection fame and every other thing you could think of without human sacrifice. Gone are the days when human blood are required for sacrifice here at zeruzandah Brotherhood, human blood sacrifice has been abolished because the money you are seeking for should be used to help and sponsor your loved ones but you have to have it at the back of your mind that there is a very great sacrifice which you must pay to pierce the heart of the spiritual world so that you can be blessed here on human Earth and that sacrifice will be according to what zeruzandah wants you to do which the Grandmaster of this temple will tell you when you’ve been in contact with him. Here at zeruzandah Brotherhood we only demand some sacrificial items and some special animal blood for sacrifice in order to please the Lord Lucifer to bless you here on Earth. If anyone from anywhere tells you that we accept anything money from you in order for you to be initiated into this Brotherhood, inform the TEMPLE GRANDMASTER +2349158681268 zeruzandah Brotherhood do not accept any money from you except you are the one to fund your sacrificial items. Contact the temple Grandmaster at +2349158681268   Spiritual grandmaster of ZERUZANDAH BROTHERHOOD +2349158681268   I WANT TO JOIN SECRET OCCULT FOR MONEY RITUALS IN NIGERIA OR GHANA TO BE RICH AND TO MAKE MONEY, WITH NO HUMAN SACRIFICE OR BLOODSHED CALL +2349158681268 FOR YOUR BUSINESS SUCCESS TO WIN ELECTIONS TO BE FAMOUS AND POWERFUL,   The ZERUZANDAH Brotherhood is a spiritual fraternal society whose aims are the cultivation of Inner Power through the study and practice of esoteric arts for the improvement of body, mind and spirit.   It unites its members in brotherhood and in the quest for wisdom, successful living and finding one’s purpose in life. It has no secret agenda .While it is a deeply spiritual organization, it promote a particular religion or belief.   The Brotherhood transmits an esoteric tradition spanning thousands of years, with a universal vision born in the East and embracing the best of the West in the quest to return to the ancient and original Tao or Source of all wisdom.   WELCOME TO ZERUZANDAH BROTHERHOOD,   The Club of the Rich and Famous; is the world oldest and largest fraternity made up of 3 Millions Members. We are one Family under one father who is the Supreme Being. In ZERUZANDAH OCCULT Brotherhood we believe that we were born in paradise and no member should struggle in this world. Hence all our new members are given Money, Wealth,Fame , Power ETC.   Fear and anxiety has drawn so many people back to unfulfilled dreams and make their quest for wealth and power shambled, it is thing of fact that money ritual Occult is not and can never be a sin because Occult is still a religion despite what ever others are thinking and zeruzandah Brotherhood is here to give life to that dead hope of acquiring your desired wealth,fame and power without human sacrifice. Contact the Spiritual Grandmaster of ZERUZANDAH Brotherhood now at +2349158681268   The wealth of this life goes to those who deserve and desire it by their decision of breaking the wicked chain of poverty. It is actually a thing of fact that poverty is real and it’s not your fault that it exists but however will be your fault and greatest mistake if you allow poverty to exist in your life because of fear. Only the brave makes the move to liberate himself from humiliating nature of poverty…   +2349158681268   You can be rich, wealthy, famous etc without human blood@ZERUZANDAH BROTHERHOOD contact the Spiritual Grandmaster now +2349158681268   The desire to remove the garment of poverty rest on your shoulder and I will advise you do so now by being an initiated member of zeruzandah Brotherhood.   For enquires, contact the Spiritual Grandmaster now@ +2349158681268   The men of the world can only see within the limit of the eye and the things of the spirit are meant for the spirit to see. You can never be that wealthy,rich and famous without controlling the Spiritual wealth and fame that Lucifer the Great Spiritual father offers to those who are humble to him. You have been admiring the wealthy people around you and wish to be so wealthy or more than they do but you are yet to discover the Secret of WEALTH. There so many things known by the rich and the wealthy which the poor don’t know and don’t want to know because of their unnecessary fear. The secret to what you seek is to join a secret occult society.   Call now for enquiries +2349158681268.
    • Hi, i sell adventurer 77 with some 78 skills, 2 subs done and last sub 60 lvl   perma vip, red cloak, pirate hat and vitallity pots safe email, i use MM Pufa add my discord  _flamber
  • Topics

×
×
  • Create New...