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

    • 🔥 HF Rework Multi-Proff x10 is coming! ⚔️ New Samurai Crow Client ⚔️ Reworked Systems & Progression ⚔️ Updated Instances ⚔️ Classic Multeria Atmosphere 🧪 Pre-OBT is already live! 📅 Official OBT: June 29 🚀 Launch: July 3 🐞 Report bugs during testing and earn valuable rewards at launch! See you on the battlefield! https://rework.multeria.world/
    • PlayCMS - это удобная система управления веб-сайтом, разработанная специально для игровых проектов Lineage 2. CMS позволяет быстро запустить полнофункциональный серверный сайт с регистрацией игроков, личным кабинетом, новостями, рейтингами, магазином, модулями и гибкой панелью администратора. Система ориентирована на владельцев серверов Lineage 2, которым нужен красивый, функциональный и понятный сайт без лишних сложностей.  PlayCMS уже предоставляет базовые функции для управления проектами, такие как публикация новостей, настройка страниц, работа с пользователями, подключение шаблонов, а также установка модулей и плагинов. Ключевые особенности PlayCMS: — удобная административная панель; — регистрация и авторизация игроков; — учетная запись пользователя; — новостные и информационные страницы; — рейтинги игроков и кланов; — поддержка шаблонов дизайна; — установка модулей и плагинов через административную панель; — магазин цифровых продуктов; — категории продуктов; — возможность добавить фавикон; — защита лицензии для административной панели; — адаптация для игровых проектов Lineage 2; — возможность расширения функционала в соответствии с потребностями сервера. PlayCMS подходит как для новых игровых проектов, так и для существующих серверов, которым нужен удобный сайт с современным дизайном и интуитивно понятным управлением. Система проста в настройке и поддерживает индивидуальные шаблоны, дополнительные плагины и модули, что позволяет вам развивать свой сайт параллельно с развитием сервера. PlayCMS — это готовое решение для владельцев серверов Lineage 2, которым нужен красивый, быстрый и функциональный сайт. Демоверсия —  https://demo.playcms.ru/ Я разработчик этого чуда. Я готов выслушать конструктивную критику, а также ваши предложения по улучшению движка. Кроме того, я пишу модули любой сложности для этой CMS. Свяжитесь со мной: Telegram — @playcms       EN   PlayCMS is a user-friendly website management system designed specifically for Lineage 2 gaming projects. The CMS allows you to quickly launch a fully functional server website with player registration, personal account, news, ratings, a store, modules, and a flexible admin panel. The system is focused on Lineage 2 server owners who need a beautiful, functional, and clear website without unnecessary complexity. PlayCMS already provides basic features for project management, such as publishing news, customizing pages, working with users, connecting templates, and installing modules and plugins. Key Features of PlayCMS: — a convenient administrative panel; — player registration and authorization; — user account; — news and information pages; — player and clan ratings; — support for design templates; — installation of modules and plugins through the admin panel; — digital product store; — product categories; — ability to add a favicon; — license protection for the admin panel; — adaptation for Lineage 2 game projects; — the ability to expand functionality to meet the needs of the server. PlayCMS is suitable for both new gaming projects and existing servers that require a user-friendly website with a modern appearance and intuitive management. The system is easy to configure and supports individual templates, additional plugins, and modules, allowing you to develop your website alongside your server. PlayCMS is a ready-made solution for Lineage 2 server owners who need a beautiful, fast, and functional website. Demo - https://demo.playcms.ru/ I am the developer of this miracle. I am ready to listen to constructive criticism, as well as your suggestions for improving the engine. I also write modules of any complexity for this cms. Contact me: Telegram - @playcms   Скачать\Download : https://drive.google.com/file/d/15Az9WVDD4SQNyOPAsXMU4-mGHOiA_U_d/view    
    • To increase visibility and make sure your offer reaches the right audience, I'd recommend exploring the tools at CS2WH. They have a Deals Bot that might help you track market prices and adjust your strategy on the fly. I'm finding their resources super helpful for keeping tabs on the trading scene. Plus, they emphasize safety and provide insights on legal skin trading, which is crucial for maintaining credibility.
    • I'm also trying to contact them, and I only have their Telegram contact, probably the same one as yours, and I haven't received a response in months.
  • 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..