Jump to content
  • 0

[HELP] help for this pls


Question

Posted

i there i will add a config like

 

100 PvP & 100 PK = Noble.

 

so just dont know how make the double check i tryed like this :

 

public void increasePvpKills(L2Character target)

{

if (target instanceof L2PcInstance

&& AntiFeedManager.getInstance().check(this, target))

{

// Add karma to attacker and increase its PK counter

setPvpKills(getPvpKills() + 1);

 

if (Config.ALLOWNOBLEPVPPK)

{

increaseNoblekills(getPvpKills());

broadcastUserInfo();

};

 

// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter

sendPacket(new UserInfo(this));

sendPacket(new ExBrExtraUserInfo(this));

}

}

 

and pvp :

 

public void increasePkKillsAndKarma(L2Character target)

{

int baseKarma           = Config.KARMA_MIN_KARMA;

int newKarma            = baseKarma;

int karmaLimit          = Config.KARMA_MAX_KARMA;

 

int pkLVL               = getLevel();

int pkPKCount           = getPkKills();

 

int targLVL             = target.getLevel();

 

int lvlDiffMulti = 0;

int pkCountMulti = 0;

 

// Check if the attacker has a PK counter greater than 0

if (pkPKCount > 0)

pkCountMulti = pkPKCount / 2;

else

pkCountMulti = 1;

 

if (pkCountMulti < 1)

pkCountMulti = 1;

 

// Calculate the level difference Multiplier between attacker and killed L2PcInstance

if (pkLVL > targLVL)

lvlDiffMulti = pkLVL / targLVL;

else

lvlDiffMulti = 1;

 

if (lvlDiffMulti < 1)

lvlDiffMulti = 1;

 

// Calculate the new Karma of the attacker : newKarma = baseKarma*pkCountMulti*lvlDiffMulti

newKarma *= pkCountMulti;

newKarma *= lvlDiffMulti;

 

// Make sure newKarma is less than karmaLimit and higher than baseKarma

if (newKarma < baseKarma)

newKarma = baseKarma;

if (newKarma > karmaLimit)

newKarma = karmaLimit;

 

// Fix to prevent overflow (=> karma has a  max value of 2 147 483 647)

if (getKarma() > (Integer.MAX_VALUE - newKarma))

newKarma = Integer.MAX_VALUE - getKarma();

 

// Add karma to attacker and increase its PK counter

setKarma(getKarma() + newKarma);

if (target instanceof L2PcInstance

&& AntiFeedManager.getInstance().check(this, target))

setPkKills(getPkKills() + 1);

 

if (Config.ALLOWNOBLEPVPPK)

{

increaseNoblekills(getPkKills());

broadcastUserInfo();

};

 

// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter

sendPacket(new UserInfo(this));

sendPacket(new ExBrExtraUserInfo(this));

}

 

public void increaseNoblekills(int i)

{

if (getPvpKills() == (Config.PVPNOBLE) && getPkKills() == (Config.PKNOBLE));

setNoble(true);

sendMessage("Congratulations you Reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and Recived Nobless");

}

 

 

the orange thing is no error but if he get 100 pvps and have 0 pk they get the noble so what i have todo ?

 

in config i have 100 pvp  & 100 pk.

 

thanks for help

 

 

 

14 answers to this question

Recommended Posts

  • 0
Posted

in increaseNoblekills

change that if to

if(getPvpKills()>=(Config.PVPNOBLE)&&getPkKills()>=(Config.PKNOBLE));{

setNoble(true);

sendMessage("Congratulations you Reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and Recived Nobless");

}

 

also u can do check if player isnt nobles atm

 

thats all, check it, tell me if its working :)

  • 0
Posted

what exactly is not working with it? its still like before that every1 who have just 100+ pvps are getting nobles even with having 0 pks or what?

  • 0
Posted

are u sure that they are getting blessing of nobless and all things that nobless is giving and not only the message? also check if this config is working good, if its tested and its still not working good then delete line setNoble(true); and check if they are getting noblesses(just to see if this is giving it and not something else), if u did that and they are not getting noblesses anymore then i dont know :/

  • 0
Posted

thats the problem at the stats 2pvp 0 pk they get noble and the message so anything will not really check

 

maybe the part of getPvpKills and getPkKills

 

becurse the NobleKills is in increasePvpKills and in increasePkKills.

 

so someone can help me

  • 0
Posted

write there something like:

System.out.println("1"+getPvpKills());

System.out.println("2"+getPkKills());

System.out.println("3"+Config.PKNOBLE);

System.out.println("4"+Config.PVPNOBLE);

thats what i always do to check something :)

later in console check the numbers they return

  • 0
Posted

First it should be

 

public void increaseNoblekills()
  {
     if ((getPvpKills() == (Config.PVPNOBLE)) && (getPkKills() == (Config.PKNOBLE)));
     {
        setNoble(true);
        sendMessage("Congratulations you Reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and Recived Nobless");
     }
  }

 

-----

 

Second, your code means : if you get 100 pvp and 100 pks, go noble. You think it's good but it's not. Your code doesn't think about if one value is higher than that. Your condition can be fill ONLY IF BOTH PVP/PKKILLS = 100, which is nearly impossible to do.

 

So rethink your idea better cause it's crappy atm :).

 

Instead of == use >= for both pks and pvp stuff.

 

public void increaseNoblekills()
  {
     if ((getPvpKills() >= (Config.PVPNOBLE)) && (getPkKills() >= (Config.PKNOBLE)));
     {
        setNoble(true);
        sendMessage("Congratulations, you reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and received Noblesse status.");
     }
  }

 

-----

 

Third you don't need to do that : increaseNoblekills(int i), as i is never used. Clean both increaseNoblekills(getPvpKills()); for increaseNoblekills();

  • 0
Posted

mine:

if(getPvpKills()>=(Config.PVPNOBLE)&&getPkKills()>=(Config.PKNOBLE));{
setNoble(true);
sendMessage("Congratulations you Reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and Recived Nobless");
}

yours

      if ((getPvpKills() >= (Config.PVPNOBLE)) && (getPkKills() >= (Config.PKNOBLE)));
      {
         setNoble(true);
         sendMessage("Congratulations, you reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and received Noblesse status.");
      }

its same but nvm

  • 0
Posted
Third you don't need to do that : increaseNoblekills(int i), as i is never used. Clean both increaseNoblekills(getPvpKills()); for increaseNoblekills();

 

if i add this with getpvpkills than he dont check pks

 

or i am wrong ?

  • 0
Posted

mine:

if(getPvpKills()>=(Config.PVPNOBLE)&&getPkKills()>=(Config.PKNOBLE));{
setNoble(true);
sendMessage("Congratulations you Reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and Recived Nobless");
}

yours

     if ((getPvpKills() >= (Config.PVPNOBLE)) && (getPkKills() >= (Config.PKNOBLE)));
     {
        setNoble(true);
        sendMessage("Congratulations, you reached "+ Config.PVPNOBLE +" PvPs and "+ Config.PKNOBLE +" PKs and received Noblesse status.");
     }

its same but nvm

 

Use code tags then I will see your code next time :D.

 

And red, you're wrong.

 

About the fact it doesn't works, verify if your lovely config is set to True and not False. It has no reason to don't work.

 

The broadcastUserInfo has to be put in the increaseNoblekills() method aswell. It's called anytime else.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • if you are sending him clients i have no words mate that means you know him.
    • Looking to hire a skilled L2J developer or team to build a custom private server for solo play with advanced server-side AI bots. This is NOT for public launch — just a self-hosted project where I can simulate a full L2 experience alone or with a few friends. 🔹 What I Need A private L2J server ( High Five preferred, newer versions can work as well) with bots that: Farm 24/7 on their own (solo or in bot parties) Can be invited into party and follow basic orders (attack, follow, res, heal, etc.) Are able to join Olympiad, fight with proper logic (per class), and rank up Can coordinate for Raid Bosses (check spawn, move, assist, heal, DPS, etc.) Act like real players: town routines, rebuffing, restocking, even chatting if possible Have different roles: tanks, healers, nukers, archers, etc. Can interact through simple in-game commands or NPC interface 🔹 Your Job Set up the server and geodata Integrate a scalable bot system (written in Java or scriptable) Write clean, modular AI behavior (farming, PvP, party play, raid logic, etc.) Allow me to control/assign bots easily (in-game or config) Bonus: basic UI or GM panel for bot config 🔹 Payment Serious budget for serious work PayPal, crypto, or preferred method Project-based or hourly, negotiable Milestone-based OK 🔹 Contact Send me: Your experience with L2J or similar projects Any bot/AI systems you've built before Estimated timeframe Pricing expectations
    • Yeah, it’s wild how much gambling has changed. When I was growing up, even scratch-off tickets felt like a big thing, but now with so many casino apps and betting sites, it’s just everywhere. I know a few people who got caught up in online slots during lockdown and really struggled to stop, just because it was always on their phone.   I stick to in-game stuff like skin trading for games like CS2 or Dota, which to me feels less risky, especially if you know the value of the items. If you’re curious how these trades work or want to see some guides, just visit website—there’s a lot of info about trading without real gambling involved.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock