Jump to content

Recommended Posts

Posted

Hello , latest not share done so i will share a shit now .. its nothing to be serius with .. just some small crappy codes that will make your server great :D

 

Lets start ,

 

*L2PcInstance

 

find

public void increasePvpKills()

 

you will see under it thoose

 

{
        // Add karma to attacker and increase its PK counter
        setPvpKills(getPvpKills() + 1);
        CustomHeroSystem();

         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
        sendPacket(new UserInfo(this));
        sendPacket(new ExBrExtraUserInfo(this));
    }

 

Now , after this you have to add

 

public void CustomHeroSystem()
    {
    	L2PcInstance activeChar = L2PcInstance.getClient().getActiveChar();
    	
        if (activeChar.getPvpKills() >= 5000)
        {
        	activeChar.sendMessage("You are now a server hero for beign so great fighter!");
      Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");
        	activeChar.setHero(true); 
        }

 

 

 

If it gives you errors in announcements , you simple press right click on the error and select import announcements , and TADAMM

 

 

ps , code is tested on L2JServer Gracia Final part ;) thanks!

Posted

fix the typo on the

activeChar.sendMessage("You are now a server hero for beign so great fighter!");

beign =P

 

Thanks for sharing it for mxc.

Added at the list.

Posted

I've told you EXACTLY the same thing with your previous share..

 

So what this code does as we see it now.. Each time someone with more than 5000 pvps gets a pvp, he's being announced as a hero. Which is wrong. Should be displayed only the first time.

 

Anyway thanks for trying, but try more & improve it =)

Posted

put a check if the char is already a hero? it can cause some NPE's and this what fakoykas said :)

 

if (!activeChar.isHero() && activeChar.getPvpCount() >= 5000)

{

;

}

Posted

put a check if the char is already a hero? it can cause some NPE's and this what fakoykas said :)

 

if (!activeChar.isHero() && activeChar.getPvpCount() >= 5000)

{

;

}

Exactly what i told him at his other hero-related share. But he doesn't want to listen =(

Posted

put a check if the char is already a hero? it can cause some NPE's and this what fakoykas said :)

 

if (!activeChar.isHero() && activeChar.getPvpCount() >= 5000)

{

;

}

 

ahh you are right. sorry :d (my mistake)

Posted

Ok.. here's how it should be :D

 

public void CustomHeroSystem()

   {

       if (!isHero() && getPvpKills() == 5000)

       {

          //announce & message ONLY when they reach 5000 pvp.

          sendMessage("You are now a server hero for being so great fighter!");

          Announcements.getInstance().announceToAll(getName() + " Is now a server's hero!");

          setHero(true);

       }

 

and Now in EnterWorld.java

 

    if (!activeChar.isHero() && activeChar.getPvPKills > 5000)

          setHero(true);

 

So now the announce is only been announced if the char is not hero already and ONLY when he reaches 5000 pvps..

Also he doesn't lose hero at his relogin =)

 

Regards.

Posted

Ok.. here's how it should be :D

 

public void CustomHeroSystem()

    {

        L2PcInstance activeChar = L2PcInstance.getClient().getActiveChar();

        if (!activeChar.isHero() && activeChar.getPvpKills() == 5000)

        {

          //announce & message ONLY when they reach 5000 pvp.

          activeChar.sendMessage("You are now a server hero for being so great fighter!");

          Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");

          activeChar.setHero(true);

        }

 

and Now in EnterWorld.java

 

    if (!activeChar.isHero() && activeChar.getPvPKills > 5000)

          setHero(true);

 

So now the announce is only been announced if the char is not hero already and ONLY when he reaches 5000 pvps..

Also he doesn't lose hero at his relogin =)

 

Regards.

 

the only problem with this is this only for enterworld not after they make the pvp.

also you missed an if(activeChar == null) check.

 

Posted

the only problem with this is this only for enterworld not after they make the pvp.

also you missed an if(activeChar == null) check.

Check the whole topic, it's just an addition to what HαRǾC« shared.

 

He has already added the method after setPvpKills(getPvpKills() + 1); so activeChar == null is not needed and neither in enterworld is needed as they are already there =)

Posted

Check the whole topic, it's just an addition to what HαRǾC« shared.

 

He has already added the method after setPvpKills(getPvpKills() + 1); so activeChar == null is not needed and neither in enterworld is needed as they are already there =)

 

i checked and i dont see the npe check it needs to be in the public void CustomHeroSystem() because okay the activeChar is defined but the null check no

Posted

Stef u cant get an npe if its already hero...

 

Definition of NPE: A null value where it shoulnt be null. full name of NPE = Null Pointer Exception extended class of RuntimeException.

 

And Inter.. u dont need a null check...

 

whats so hard?

L2PcInstance.java:

public void parsePvPCustomHero()
{
       if (!isHero() && getPvpKills() >= 5000)
       {
          //announce & message ONLY when they reach 5000 pvp.
          sendMessage("You are now a server hero for being such a great fighter!");
          Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");
          setHero(true);
       }
}

EnterWorld.java

// You know the deal...
activeChar.parsePvPCustomHero();

 

And everything is manage in pc instance doooh!!

Is that hard?

 

Anyway nice work HαRǾC« ur getting better and better, keep it up :P

PS: And it shoud be getPvpKills() >= 5000 (biger or equal) else it will give hero status only if the player has 5000 if its 5001 bby hero :D

Posted

Stef u cant get an npe if its already hero...

 

Definition of NPE: A null value where it shoulnt be null. full name of NPE = Null Pointer Exception extended class of RuntimeException.

 

And Inter.. u dont need a null check...

 

whats so hard?

L2PcInstance.java:

public void parsePvPCustomHero()
{
        if (!isHero() && getPvpKills() >= 5000)
        {
           //announce & message ONLY when they reach 5000 pvp.
           sendMessage("You are now a server hero for being such a great fighter!");
           Announcements.getInstance().announceToAll(activeChar.getName() + "Is now a server's hero!");
           setHero(true);
        }
}

EnterWorld.java

// You know the deal...
activeChar.parsePvPCustomHero();

 

And everything is manage in pc instance doooh!!

Is that hard?

 

Anyway nice work HαRǾC« ur getting better and better, keep it up :P

PS: And it shoud be getPvpKills() >= 5000 (biger or equal) else it will give hero status only if the player has 5000 if its 5001 bby hero :D

 

still only for enterworld not by instant after the pvp...and yes you can use the isHero() to avoid the null check anyway the check method should be in the increasePvpKills() too

Posted

omg dude.. u just add in increasePvpKills() the call method: parsePvPCustomHero().

And its instantly after pvp doooh... besides that u dont need that check into increasePvpKills() if u can use it in parsePvPCustomHero(), it keeps the code clean... lolz

And also isHero is not a null check wtf ?:D that !ishero has to return false so that a normal hero dosent get parsed for nothing... and also its there if the player is already hero by pvp.. to skip the parsing method that way its more efficient.. dooh >.>

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

    • Only 3 days left and we'll start with some events, you can check our Discord for more info!
    • 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.
    • I agree, l2damage crap to compare to l2java which was the father of pvp servers and till this days people playing there for good time.
    • 📝 Registration — Account Registration Creating a new player account. Usually includes: login password password confirmation email Result: a new record is created in the accounts table (loginserver). 🔑 Change Password — Password Change The player changes the password knowing the current one. Required: current password new password new password confirmation Result: the password field is updated in the accounts table. ♻️ Password Recovery — Password Reset If the player forgot the password. Implementation only via email: the player enters their login, email the system sends an email with a link or code the player opens the link / enters the code sets a new password Result: the password is updated in the accounts table.   All fields are validated (required, format, length, uniqueness, security checks).   Price: 80$   and i can rewrite script for PTS server.   Contacts:   Telegram Discord
  • 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..