• 0
ThelwHelpRePaidia

Help Assist reward pvp system

Question

Hello i have a problem with this code i get no errors in eclipse but in game it doesnt work..

to Player.java

if (getParty() != null)
		{
			for (Player p : getParty().getMembers())
			{
				if (Config.Synergy_Class.contains(p.getClassId().getId()) && p.isInCombat() && (Rnd.get(100) <= 90))
				{
					p.sendMessage("You have earned a pvp by supporting " + target.getName());
					p.getPvpKills();
				}
			}
		}


and the config
  
  public static List<Integer> Synergy_Class = new ArrayList<>();


  	String Synergy_Class = customs.getProperty("ClassesSupp", "97");
		String[] atdc_splitted = Synergy_Class.split(",");
		for (String s : atdc_splitted)
		{
			Synergy_Class.add(Integer.valueOf(s));
		}

Share this post


Link to post
Share on other sites

10 answers to this question

  • 0
melron    38

what this one supposed to do? Increase pvp in supporter class? if yes
replace
 

p.getPvpKills();

with this

p.setPvpKills(p.getPvpKills() +1);

 

Share this post


Link to post
Share on other sites
  • 0
melron    38
1 hour ago, ThelwHelpRePaidia said:

i've tried it but it doesnt work and like that  xD

then the location of your code is wrong or you do not meet the conditions. add debugs for each boolean for all these 'if' and check out whats going on

Share this post


Link to post
Share on other sites
  • 0
Evie Frye    7

How you expect people to help you? You don't provide any info just some fail coding. 

Where did you place the code? What are your configurations? Does the message appear ? Possibly you've added the code in wrong place

or you ignored the config and you haven't add your class ID in their. Or even worst the config is wrong and u just didn't see the error

because config errors appear upon server load which is barely visible. 

Share this post


Link to post
Share on other sites
  • 0
melron    38
3 minutes ago, Evie Frye said:

How you expect people to help you? You don't provide any info just some fail coding. 

Where did you place the code? What are your configurations? Does the message appear ? Possibly you've added the code in wrong place

or you ignored the config and you haven't add your class ID in their. Or even worst the config is wrong and u just didn't see the error

because config errors appear upon server load which is barely visible. 

holy shit

Share this post


Link to post
Share on other sites
  • 0

1st im getting 0 errors on eclipse and on gameserver

2nd i dont get the message

3rd i placed the code here

public void onKillUpdatePvPKarma(Playable target)
	{
		if (target == null)
			return;
		
		final Player targetPlayer = target.getActingPlayer();
		if (targetPlayer == null || targetPlayer == this)
			return;
		
		// Don't rank up the CW if it was a summon.
		if (isCursedWeaponEquipped() && target instanceof Player)
		{
			CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquippedId);
			return;
		}
		
		// If in duel and you kill (only can kill l2summon), do nothing
		if (isInDuel() && targetPlayer.isInDuel())
			return;
		
		if (EventManager.getInstance().isRunning() && EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRegistered(targetPlayer))
			return;
		
		if (getParty() != null)
		{
			for (Player player : getParty().getMembers())
			{
				if (Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (Rnd.get(100) <= 90))
				{
					player.sendMessage("You have earned a pvp by supporting " + target.getName());
					player.setPvpKills(player.getPvpKills() + 1);
				}
			}
		}
		// If in pvp zone, do nothing.
		if (isInsideZone(ZoneId.PVP) && targetPlayer.isInsideZone(ZoneId.PVP))
		{
			// Until the zone was a siege zone. Check also if victim was a player. Randomers aren't counted.
			if (target instanceof Player && getSiegeState() > 0 && targetPlayer.getSiegeState() > 0 && getSiegeState() != targetPlayer.getSiegeState())
			{
				// Now check clan relations.
				final Clan killerClan = getClan();
				if (killerClan != null)
					killerClan.setSiegeKills(killerClan.getSiegeKills() + 1);
				
				final Clan targetClan = targetPlayer.getClan();
				if (targetClan != null)
					targetClan.setSiegeDeaths(targetClan.getSiegeDeaths() + 1);
			}
			return;
		}

 

Edited by ThelwHelpRePaidia

Share this post


Link to post
Share on other sites
  • 0
Sebana    0

Try add the code after this: 

  // Check if it's pvp (cases : regular, wars, victim is PKer)
  if (checkIfPvP(target) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != Clan.SUBUNIT_ACADEMY && getPledgeType() != Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL))
  {
   if (target instanceof Player)
   {

        //here

 

Share this post


Link to post
Share on other sites
  • 0
melron    38

How many times did you test it? I mean how many kills did you got?

 

As you didnt understood my last suggestion i will explain you:

 

You have to meet 4 conditions in order the party member to get pvp point too.

 

  • Be in party
  • Config got the user class id
  • user is in combat
  • And 90% chance.

 

Are you sure for all these conditions ?

 

Why you do not simply add debugs to check it?

 

if (getParty() != null)
{
	for (Player player : getParty().getMembers())
	{
		final int rnd = Rnd.get(100);
		System.out.println("Checking for " + player.getName() + " Conditions...");
		System.out.println(Config.Synergy_Class.contains(player.getClassId().getId()) ? "Config missing player's class ID!" : " Config got player's ID!");
		System.out.println(player.isInCombat() ? " Player is in combat!" : " Player is not in combat!");
		System.out.println(rnd <= 90 ? " Chance is OK!" : " Chance is not OK! ( " + rnd + "");
		System.out.println(Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (rnd <= 90) ? " Reward can be given!" : " Cannot give the reward!");
		if (Config.Synergy_Class.contains(player.getClassId().getId()) && player.isInCombat() && (rnd <= 90))
		{
			player.sendMessage("You have earned a pvp by supporting " + target.getName());
			player.setPvpKills(player.getPvpKills() + 1);
		}
	}
}
else
	System.out.println("No party found.");

 

Edited by melron

Share this post


Link to post
Share on other sites
  • 0

@melron it's working like this but im getting something that it seems weird i dont get +1 pvp i get the pvps that my party mate has if he has 551 and me 0 if he gets pvp i will go 552

 

Party party = getParty();
				
				if (party != null)
				{
					for (Player partymate : party.getMembers())
					{
						if (partymate == null)
							continue;
						
						if (partymate.getClassId().getId() == 97 && partymate.isInCombat() && partymate.getPvpFlag() > 0)
						{
							if (partymate.isInsideRadius(this, 1100, false, false))
							{
								if (Rnd.nextInt(100) < 100)
								{
									partymate.setPvpKills(partymate.getPvpKills() + 1);
									break;
								}
							}
						}
					}
				}
				
					
					// Add PvP point to attacker.
					setPvpKills(getPvpKills() + 1);

 

Edited by ThelwHelpRePaidia

Share this post


Link to post
Share on other sites
  • 0
tazerman2    18
				for(Player member : getParty().getMembers())
				{
					if(member != null)
					{
						if(member.getClassId().getId() == 97 && member.isInCombat() && member.isInsideRadius(this, 1100, false, false) && Rnd.nextInt(100) < 100)
						{
							setPvpKills(getPvpKills() + 1);
						}
					}
				}

i dont know if help this

Share this post


Link to post
Share on other sites

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