Jump to content

Recommended Posts

Posted (edited)

Good night, I come to share a code that I made for my project, I will give a simple tutorial how to use the music part of it.

 

Code: https://pastebin.com/raw/ezfEX1kJ

 

Well I made the code simple and very easy to edit, you only need to edit in one place to add messages, music, PVP amount !!

 

The format is PVP, Message and Music quantity.

 

PVP amount = 2

Generated Message = Double Kill

Music = "" here the music.

DOUBLE_KILL (2, "Double Kill", "YOUR MUSIC"),

 

h9p8okO.jpg

 

The song is on you, I hope you like it and don't forget to like it.

 

here is version 2 in xml and totally redone by Tryskell's tips

 

thanks to @StinkyMadness for the idea of creating in xml

 

Version 2 https://pastebin.com/raw/5cwXuTTc

 

Credits for the idea @Kara`

Unfinished credits @Williams

 

ATTENTION : I'm sorry for some BR messages

Edited by Williams
Posted (edited)

I guess you want to unhardcode that

if (kills.getKills() == 15)

and instead use the highest available number from your enum.

--------

public void setIncreaseKills()

should be renamed

public void increaseSpreeKills()

-------

While not impacting performance with such low amount of options, it is recommended and, you still should

break;

once a valid number has been found on your

for (SpreeKills kills : SpreeKills.values())

To avoid to iterate the whole thing.

-------

You probably want to check if

kills.getSound()

is empty before sending a pointless empty packet.

if (!kills.getSound().isEmpty())
	sendPacket(new PlaySound(kills.getSound()));

------

Your configs are different than the default version. As a share, you should unify them.

+		ENABLE_SPREEKILLS = players.getProperty("EnableSpreeKills", false);
+		SPREEKILLS_REWARD = players.parseIntIntList("RewardSpreeKills", "9209-1");

!=

+EnableSpreeKills = True
+RewardSpreeKills = 9217-5

------

The sound String on your enum is currently empty, and there is no config to edit it. I suppose people have to set their own sounds in the enum, but still you should at least give some default sounds, or at least // quote them somewhere for easier use.

Edited by Tryskell
  • Thanks 1
Posted
1 hour ago, Tryskell said:

I guess you want to unhardcode that


if (kills.getKills() == 15)

and instead use the highest available number from your enum.

--------


public void setIncreaseKills()

should be renamed


public void increaseSpreeKills()

-------

While not impacting performance with such low amount of options, it is recommended and, you still should


break;

once a valid number has been found on your


for (SpreeKills kills : SpreeKills.values())

To avoid to iterate the whole thing.

-------

You probably want to check if


kills.getSound()

is empty before sending a pointless empty packet.


if (!kills.getSound().isEmpty())
	sendPacket(new PlaySound(kills.getSound()));

------

Your configs are different than the default version. As a share, you should unify them.


+		ENABLE_SPREEKILLS = players.getProperty("EnableSpreeKills", false);
+		SPREEKILLS_REWARD = players.parseIntIntList("RewardSpreeKills", "9209-1");

!=


+EnableSpreeKills = True
+RewardSpreeKills = 9217-5

------

The sound String on your enum is currently empty, and there is no config to edit it. I suppose people have to set their own sounds in the enum, but still you should at least give some default sounds, or at least // quote them somewhere for easier use.

 

the bad is trysekll dosent undestand greek but im sure someone can translate him  :P

p.s on topic thank you for share my friend keep on.

Posted
12 hours ago, Tryskell said:

I guess you want to unhardcode that


if (kills.getKills() == 15)

and instead use the highest available number from your enum.

--------


public void setIncreaseKills()

should be renamed


public void increaseSpreeKills()

-------

While not impacting performance with such low amount of options, it is recommended and, you still should


break;

once a valid number has been found on your


for (SpreeKills kills : SpreeKills.values())

To avoid to iterate the whole thing.

-------

You probably want to check if


kills.getSound()

is empty before sending a pointless empty packet.


if (!kills.getSound().isEmpty())
	sendPacket(new PlaySound(kills.getSound()));

------

Your configs are different than the default version. As a share, you should unify them.


+		ENABLE_SPREEKILLS = players.getProperty("EnableSpreeKills", false);
+		SPREEKILLS_REWARD = players.parseIntIntList("RewardSpreeKills", "9209-1");

!=


+EnableSpreeKills = True
+RewardSpreeKills = 9217-5

------

The sound String on your enum is currently empty, and there is no config to edit it. I suppose people have to set their own sounds in the enum, but still you should at least give some default sounds, or at least // quote them somewhere for easier use.

 

topic updated with version 2 at a glance now written in xml

Posted (edited)

Still missing the

break;

Should be

 

+					for (SpreeKills kills : SpreeKillsData.getInstance().getSpreeKills())
+					{
+						if (kills.getKills() == _spreeKills)
+						{
+							World.announceToOnlinePlayers(getName() + " marked " + kills.getMsg(), true);
+							
+							if (!kills.getSound().isEmpty())
+								sendPacket(new PlaySound(2, kills.getSound()));
+							
+							if (kills.getItemId() > 0)
+								addItem("Reward", kills.getItemId(), kills.getItemCount(), null, true);
+							
+							break;
+						}
+					}

-------

 

You could add an empty check for getMsg() use as you did before

 

if (!kills.getMsg().isEmpty())
	World.announceToOnlinePlayers(getName() + " marked " + kills.getMsg(), true);

 

Edited by Tryskell
  • Thanks 1

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

    • https://sms.pro/ — we are an SMS activation platform  seeking partners  mobile number providers  mobile number owners  owners of GSM modems  SIM card owners We process 1,000,000 activations every day.  寻找合作伙伴  手机号码提供商  手机号码持有者  GSM调制解调器持有者  SIM卡持有者 我们每天处理1,000,000次激活。  Ищем партнеров  Владельцы сим карт  провайдеров  владельцев мобильных номеров  владельцев модемов  Обрабатываем от 1 000 000 активаций в день ⚡️ Fast. Reliable.   https://sms.pro/ Support: https://t.me/alismsorg_bot
    • "WHAT I WILL SEE ON NEW SEASON ? *More easy farm and augment than ever before ! *Free VIP characters for everyone for first 2 days after opening ! Improved olympiad engine to work more correctly. 3 New skins / outfits. Fixed raid boss spawns. Fixed olympiad crit errors. New farming Ivory Tower area. Fixed augmentation rate. Increased all mob drops rate by +20%. And much more..."   1. I have clicked VIP 23.01.2026 20:00 a few second after open server. 2 Days is 48h. Now 24.01.2026 I have 17 hours left, so my VIP will expire 08:00 25.01.2026. Where is 12h? SCAM.   2. Where is ivory tower area?   3. When next wipe?   
    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here  https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
  • 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..