Jump to content

Question

Posted

hello guys i have a problem ..i have a simple mod like when you flag get pvp circle blue,

 

but this is not a problem cuz this feature work fine .

 

i want to add and pk circle ,like when you make karma get pk circle red, but this is a problem cuz i don't find the line where i can add the code :

 

my pvp blue cricle code is this..

 

 

 

 

package net.sf.l2j.gameserver.model.actor.instance.L2Pcinstance;


public void updatePvPStatus()
{
if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRunning())
return;


if (isInsideZone(ZoneId.PVP))
return;


PvpFlagTaskManager.getInstance().add(this, System.currentTimeMillis() + Config.PVP_NORMAL_TIME);


+ if (getPvpFlag() == 0)
+  {
+          updatePvPFlag(1);
+           setTeam(1);
+          }
+ }
}


public void updatePvPStatus(L2Character target)
{
final L2PcInstance player = target.getActingPlayer();
if (player == null)
return;


if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRunning())
return;


if (isInDuel() && player.getDuelId() == getDuelId())
return;


if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0)
{
PvpFlagTaskManager.getInstance().add(this, System.currentTimeMillis() + ((checkIfPvP(player)) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME));


+ if (getPvpFlag() == 0)
+ {
+              updatePvPFlag(1);
+               setTeam(1);
+          }
+}
}

package net.sf.l2j.gameserver.taskmanager.pvpflagtaskmanager.java

		public void run()
		{
			if (!_pvpFlagTask.isEmpty())
			{
				Long current = System.currentTimeMillis();
				synchronized (this)
				{
					for (L2PcInstance actor : _pvpFlagTask.keySet())
					{
						+   if (current > _pvpFlagTask.get(actor))
						+  {
						+	actor.updatePvPFlag(0);
						+	actor.setTeam(0);
						+	_pvpFlagTask.remove(actor);
						+    }

i need to know where i can add the code for the pk cirlce


10 answers to this question

Recommended Posts

  • 0
Posted (edited)

Under setKarma , setPkKills + 1 ? That's so obvious

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }

Also, you have to reset it <setTeam(0)> when you lose karma, under this method.

public void setKarma(int karma)
Edited by SweeTs
  • 0
Posted

 

Under setKarma , setPkKills + 1 ? That's so obvious

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }

Also, you have to reset it <setTeam(0)> when you lose karma, under this method.

public void setKarma(int karma)

 

 

 

don't work ..cuz i try this line :)

 

http://postimg.org/image/6zdh6awql/

  • 0
Posted (edited)

It's working fine, you simply failed to add properly the code. Also red circle is 2 ;)

i set 2 not 1 i know  the code  for red :)

		// Otherwise, killer is considered as a PKer.
		else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)

		{
			// PK Points are increased only if you kill a player.
			if (target instanceof L2PcInstance)
				setPkKills(getPkKills() + 1);
			if (getPvpFlag() == 0)
			{
		            updatePvPFlag(2);
		            setTeam(2);
		      }


like this ?

	public void setKarma(int karma)
	{
		setTeam(0);
		if (karma < 0)
			karma = 0;
		
		if (_karma > 0 && karma == 0)
		{
			sendPacket(new UserInfo(this));
			broadcastRelationsChanges();
		}
Edited by Tachi
  • 0
Posted

so i add another line here :D

 

l2pcinstance

		
		// Otherwise, killer is considered as a PKer.
		else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
			{
			if (getPvpFlag() == 0)
		            updatePvPFlag(2);
		            setTeam(2);
		      }
		{
			// PK Points are increased only if you kill a player.
			if (target instanceof L2PcInstance)
				setPkKills(getPkKills() + 1);

and this work 

 

http://postimg.org/image/l6yjars3x/

 

 

but after  5-10 second's cirlce going off without leave karma and do nothing

 

http://postimg.org/image/9p6232orn/

 

can you suggest :D?

  • 0
Posted

well the circle as i understand work with flag so if you pk a player you get red name but in background flag work normal so flag after some seconds leave so circle too so in order to keep circle until karma get 0 you must set PvP to 1 (never leave flag) until player clean karma

  • 0
Posted (edited)

2x no.

 

 

Your check MISS LOGIC. Before you are pk, you are flagged already, so how the heck you can be not flagged aka pvp flag == 0 ... ?  :rage:

THINK.

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            setTeam(2);
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }
        if (_karma > 0 && karma == 0)
        {
            sendPacket(new UserInfo(this));
            broadcastRelationsChanges();
            setTeam(0);
        }
Edited by SweeTs
  • 0
Posted

 

2x no.

 

 

Your check MISS LOGIC. Before you are pk, you are flagged already, so how the heck you can be not flagged aka pvp flag == 0 ... ?  :rage:

THINK.

        // Otherwise, killer is considered as a PKer.
        else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
        {
            // PK Points are increased only if you kill a player.
            if (target instanceof L2PcInstance)
                setPkKills(getPkKills() + 1);
            
            // Calculate new karma.
            setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof L2Summon));
            setTeam(2);
            
            // Send UserInfo packet to attacker with its Karma and PK Counter
            sendPacket(new UserInfo(this));
        }
        if (_karma > 0 && karma == 0)
        {
            sendPacket(new UserInfo(this));
            broadcastRelationsChanges();
            setTeam(0);
        }

so i try  this and  is same problem, i get pk ,i get cirlce,after  chracter  close from combat mode cirlce disappear :(

  • 0
Posted

No. You have all info you need. I'm not gonna share full ready to apply code. You only have to setTeam(1) under pvp count and setTeam(2) under pk count. And setTeam(0) in pvptask and setKarma.

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

    • Hello! I am new to l2 server creation and i need your help please!!! I want to make my own l2 interlude c6 server with custom thing in it.  I need help with where to start. What source pack to pick to start and what to do. Please if you can help me i would appreciate it very much !!!
    • Need Discord with rare badge? VISIT US AND SHOP WITH US! NEW STOCK   Aged, Early Supporter Discord Accounts I sell HQ Aged and Early, Discord Accounts that are inactive and not flagged by discord at cheap prices   If you want to contact me, you can add me on discord: worldcoldwar Features: Format - age : email : pass : token Not flagged and undetected by discord HQ % With OGE Emails, password etc can be changed Unverified Early Supporter 24M Boost Badge HypeSquad Events Early Verified Bot Developer Early Supporters SHOP LINK: disvault1.mypaylix.gg/ For PayPal payments, please open a ticket. If you experience any problems with cryptocurrency payments, please open a ticket as well.
    • Tired of frantically switching between windows trying to find that specific Warlock who should be casting saves? Forgot which server you left your Warsmith on? This mod solves these problems! What it does: Turns the boring window title into an information panel: Server Name - Character Name [Class] Real-life examples: - ServerName - HardcoreFarm [Spoilerr] (who's been spoiling for 3 months already) - ServerName - ClericHelper [Buffer] (eternal buffer on standby) - ServerName - MainChar [Gladiator] (main character who's always AFK) Why you need this: For multiboxers - to avoid confusing where the DD is and where the healer is For the forgetful - if your memory is like a goldfish For streamers - viewers immediately see who's on screen For adults - when playing at work and need to quickly hide the window DLL only - no Interface files needed Installation (more complicated than making tea): 1. Download the DLL 2. Drop it into the System folder 3. Launch the client 4. Be amazed how you lived without this before!   Purchase Conditions: Price: 100$ Payment Method: USDT. How to Buy: Contact me on Telegram: @kiselevwv for a quick response. I will answer all your questions and provide additional information if needed. I guarantee functionality at the moment of sale and prompt assistance with setup after purchase.    
    • Hello Everyone   Wts adena  L2 REBORN C5 FRANZ x1 50kk stock 😉   Contact Discord :  topseller4081  
    • tratando de crear un GvE tengo problemas con el scripts como no se mucho de esto me estoy ayudando con IA pero no puedo salir de este bache      [06:19:43]  WARN Quest GvE_AI not found! [06:19:45]  WARN Quest GvE_AI not found! [06:19:50]  WARN Quest GvE_AI not found! [06:25:51]  WARN Quest GvE_AI not found!
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..