Jump to content
  • 0

[Help] Pk in PvP Mod ?


Question

Posted

any ideas where can be problem when ppl fight in pvp mod and some time they become PK when kill his enemy ?

 

Not every time they become PK but many time that happen

10 answers to this question

Recommended Posts

  • 0
Posted
  On 5/26/2012 at 1:58 PM, adenaman said:

in pk method of l2pcinstance check if they are in event and just return, that should fix it

i dont see nothing critical there what can bug pvp mod

  • 0
Posted

when you say pvp mod you mean pvp stance or some pvp event?

 

anyway this is the important code section of l2PcInstance:

 

public void onKillUpdatePvPKarma(L2Character target)
{
	if (target == null) return;
	if (!(target instanceof L2Playable)) return;

	L2PcInstance targetPlayer = target.getActingPlayer();

	if (targetPlayer == null) return;                                          // Target player is null
	if (targetPlayer == this) return;                                          // Target player is self

	if (isCursedWeaponEquipped())
	{
		CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquippedId);
		// Custom message for time left
		// CursedWeapon cw = CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId);
		// SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.THERE_IS_S1_HOUR_AND_S2_MINUTE_LEFT_OF_THE_FIXED_USAGE_TIME);
		// int timeLeftInHours = (int)(((cw.getTimeLeft()/60000)/60));
		// msg.addItemName(_cursedWeaponEquipedId);
		// msg.addNumber(timeLeftInHours);
		// sendPacket(msg);
		return;
	}

	// If in duel and you kill (only can kill l2summon), do nothing
	if (isInDuel() && targetPlayer.isInDuel()) return;

	// If in Arena, do nothing
	if (isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP))
		return;

	// Check if it's pvp
	if (
			(
					checkIfPvP(target) &&            //   Can pvp and
					targetPlayer.getPvpFlag() != 0   //   Target player has pvp flag set
			) ||                                     // or
			(
					isInsideZone(ZONE_PVP) &&         		 //   Player is inside pvp zone and
					targetPlayer.isInsideZone(ZONE_PVP) 	 //   Target player is inside pvp zone
			)
	)
		increasePvpKills(target);
	else
		// Target player doesn't have pvp flag set
	{
		// check about wars
		if (targetPlayer.getClan() != null && getClan() != null
				&& getClan().isAtWarWith(targetPlayer.getClanId())
				&& targetPlayer.getClan().isAtWarWith(getClanId())
				&& targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY
				&& getPledgeType() != L2Clan.SUBUNIT_ACADEMY)
		{
			// 'Both way war' -> 'PvP Kill'
			increasePvpKills(target);
			return;
		}

		// 'No war' or 'One way war' -> 'Normal PK'
		if (targetPlayer.getKarma() > 0)                                        // Target player has karma
		{
			if (Config.KARMA_AWARD_PK_KILL)
				increasePvpKills(target);
		}
		else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma
		{
			increasePkKillsAndKarma(target);
			//Unequip adventurer items
			checkItemRestriction();
		}
	}

if your problem is with pvp flag, then check that your code is same than this (or maybe is some pvp flag update problem)

 

else if its the event, just add some check like duel's one

 

else i didnt get the question :s

  • 0
Posted
  On 5/26/2012 at 4:28 PM, adenaman said:

when you say pvp mod you mean pvp stance or some pvp event?

 

anyway this is the important code section of l2PcInstance:

 

public void onKillUpdatePvPKarma(L2Character target)
{
	if (target == null) return;
	if (!(target instanceof L2Playable)) return;

	L2PcInstance targetPlayer = target.getActingPlayer();

	if (targetPlayer == null) return;                                          // Target player is null
	if (targetPlayer == this) return;                                          // Target player is self

	if (isCursedWeaponEquipped())
	{
		CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquippedId);
		// Custom message for time left
		// CursedWeapon cw = CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId);
		// SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.THERE_IS_S1_HOUR_AND_S2_MINUTE_LEFT_OF_THE_FIXED_USAGE_TIME);
		// int timeLeftInHours = (int)(((cw.getTimeLeft()/60000)/60));
		// msg.addItemName(_cursedWeaponEquipedId);
		// msg.addNumber(timeLeftInHours);
		// sendPacket(msg);
		return;
	}

	// If in duel and you kill (only can kill l2summon), do nothing
	if (isInDuel() && targetPlayer.isInDuel()) return;

	// If in Arena, do nothing
	if (isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP))
		return;

	// Check if it's pvp
	if (
			(
					checkIfPvP(target) &&            //   Can pvp and
					targetPlayer.getPvpFlag() != 0   //   Target player has pvp flag set
			) ||                                     // or
			(
					isInsideZone(ZONE_PVP) &&         		 //   Player is inside pvp zone and
					targetPlayer.isInsideZone(ZONE_PVP) 	 //   Target player is inside pvp zone
			)
	)
		increasePvpKills(target);
	else
		// Target player doesn't have pvp flag set
	{
		// check about wars
		if (targetPlayer.getClan() != null && getClan() != null
				&& getClan().isAtWarWith(targetPlayer.getClanId())
				&& targetPlayer.getClan().isAtWarWith(getClanId())
				&& targetPlayer.getPledgeType() != L2Clan.SUBUNIT_ACADEMY
				&& getPledgeType() != L2Clan.SUBUNIT_ACADEMY)
		{
			// 'Both way war' -> 'PvP Kill'
			increasePvpKills(target);
			return;
		}

		// 'No war' or 'One way war' -> 'Normal PK'
		if (targetPlayer.getKarma() > 0)                                        // Target player has karma
		{
			if (Config.KARMA_AWARD_PK_KILL)
				increasePvpKills(target);
		}
		else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma
		{
			increasePkKillsAndKarma(target);
			//Unequip adventurer items
			checkItemRestriction();
		}
	}

if your problem is with pvp flag, then check that your code is same than this (or maybe is some pvp flag update problem)

 

else if its the event, just add some check like duel's one

 

else i didnt get the question :s

i mean when players make normal pvp in normal zone when they are all flag and some time they become PK

 

did u see something wrong here ?

 

public void onKillUpdatePvPKarma(L2Character target)
{
	if (target == null) return;
	if (!(target instanceof L2PlayableInstance)) return;

	if (_inEventCTF || _inEventTvT)
		return;
	if (_inEventFOS) return;

	if (_inEventVIP)
	{
		increasePvpKills(target);
		return;
	}

	L2PcInstance targetPlayer = null;
	if (target instanceof L2PcInstance)
		targetPlayer = (L2PcInstance)target;
	else if (target instanceof L2Summon)
		targetPlayer = ((L2Summon)target).getOwner();

	if (targetPlayer == null) return;                                          // Target player is null
	if (targetPlayer == this) return;                                          // Target player is self

	if (isCursedWeaponEquiped())
	{
		CursedWeaponsManager.getInstance().increaseKills(_cursedWeaponEquipedId);
		return;
	}

	// If in duel and you kill (only can kill l2summon), do nothing
	if (isInDuel() && targetPlayer.isInDuel()) return;
        
	if (Config.L2F_ENABLE_EVENT_ENGINE==true)
        {
	if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRegistered(targetPlayer))
					return;
        }
        // If in Arena, do nothing
	if (isInsideZone(ZONE_PVP) || targetPlayer.isInsideZone(ZONE_PVP))
		return;

        // Check if it's pvp
	if ((checkIfPvP(target) && targetPlayer.getPvpFlag() != 0 ) || ( isInsideZone(ZONE_PVP) && targetPlayer.isInsideZone(ZONE_PVP)))
	{
            increasePvpKills(target);  
	}
	else
	{
            // check about wars
            if (targetPlayer.getClan() != null && getClan() != null)
            {
                if (getClan().isAtWarWith(targetPlayer.getClanId()))
                {
                    if (targetPlayer.getClan().isAtWarWith(getClanId()))
                    {
                        // 'Both way war' -> 'PvP Kill'
                    	increasePvpKills(target);
                        return;
                    }
                }
            }

            // 'No war' or 'One way war' -> 'Normal PK'
		if (targetPlayer.getKarma() > 0)                                        // Target player has karma
		{
			if ( Config.KARMA_AWARD_PK_KILL )
			{
				increasePvpKills(target);
			}
		}
		else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma
		{
			increasePkKillsAndKarma(targetPlayer.getLevel(),target);
		}
	}
}

  • 0
Posted
  On 5/26/2012 at 5:39 PM, Ventic said:

can you explain better your problem?

when someone pk or pvp someone their status doesn't get updated?

 

when few players make pvp in any zone some time when u kill flag players u are become PK

 

so u kill flaed player and u are PK 

 

not every time but many time that happen

  • 0
Posted
  On 5/26/2012 at 5:49 PM, Ventic said:

seems your updatePkStatus ( or something like this ) is wrong or idea my idea?

i didnt see something wrong with can make this bug

because i ask if someone was have same problem or can give any idea

where can be problem or how to detect how that happen or something else

  • 0
Posted
  On 5/26/2012 at 6:33 PM, adenaman said:

about flag update you can try to log getPvpFlagLasts() and pvpStatus

nothing happen still no idea how that happen

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

    • L2 PVPTOP - HTML DESIGN    
    • Do not trust this guy, he will scam you. I have sent proof to the mods, I have posted proof on another thread and I can send proof to anyone who DMs me. Avoid this guy. So not only did he scam me out of $51 USDTthen delete his messages and blocked me (I have proof) . You can see his Facebook group is constantly changing names depending on his most current scam. If you see this message and you still decide to go forward with sending your money to him, that’s on you. I can’t stress this enough. This guy is a scammer. 
    • So Goldbar thinks that deleted his side of the conversation makes it easier to claim he didn’t scam me. But I sent him $51 USDT to his ERC-20 account it was verified, he acted like it was fine but then deleted his messages and blocked me. Seriously do not trust this guy. 
    • Hi everyone, let me introduce myself—I'm Martin, a junior developer. I'm diving into the world of L2 servers, and honestly, I'm super overwhelmed about where to start learning the right way to set up, configure, and run a server. There are so many datapacks—free, private—but it's so much that my head feels like it's going to explode. I'm currently looking for someone or an active project willing to take me on as an intern. I'm not looking to make money—I'm just here to learn and grow out of pure passion for L2. I've already been working with L2jMobius H5. I managed to edit the Community Board, add a buffer, GM Shop, and teleports. I've also created custom NPCs for the GM Shop, and imported new custom weapons and armors—complete with original glow effects, like the Valakas and Antharas weapons. But there's still a lot I don't know, and it can get overwhelming. That’s why I’m looking for someone—or an active non-profit project—willing to take me on as an intern. I’m not looking to make money; I just want to learn, contribute, and grow out of pure passion for L2. If you’re working on a project and could use a motivated learner who’s eager to help, I’d love to connect!
    • Our next easy-botting project, Kain, is right around the corner! Launching tomorrow, Saturday, April 26th at 9:00 ET (UTC -4)! If you haven’t, check out the features and join our Discord to catch up on the latest drama. See you very soon! Read more about L2Toggle and Kain on our site and forum!  
  • Topics

×
×
  • Create New...