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

    • buenas no puedo poner el server On para que entren mis amigos   LoginServer # ================================================= # Settings authorization server # ================================================= # Host and port for client connections LoginserverHostname = 127.0.0.1 LoginserverPort = 2106 # Host and port for game servers LoginHost = 192.168.100.25 ( mi Ip interna) LoginPort = 9014     GameServer   # =============================== # Network Configuration Server  # # =============================== # IP which Bind Game server, * - all possible GameserverHostname = * GameserverPort = 7777 # This is transmitted to the clients connecting from an external network, so it has to be a public IP or resolvable hostname ExternalHostname = 186.158.144.71 ( Ip externa ovbio) # This is transmitted to the client from the same network, so it has to be a local IP or resolvable host name InternalHostname = 192.168.100.25 # AdvIpSystem Make more GameServerIDs. Every Ip should be Protected by a DDoS Guard. # Your Server will have Success with this system Online. AdvIPSystem = False # Address \ port LS LoginPort = 9014 LoginHost = 192.168.100.25 LoginUseCrypt = true # How to request ID of LS RequestServerID = 4 # Permission to take a different id, if requested busy AcceptAlternateID = False     en que estaria fallando ?    
    • mporeis na valeis l2jaCis i kapoio etimo project  free sources gia aCis edw https://acis.i-live.eu/index.php?topic=1974.0 server install ktl edw https://acis.i-live.eu/index.php?topic=10190.0 an dn vgaleis akrh steile mou discord margazeas2
    • 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.
  • 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..