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.

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

    • I decided to write some beautiful custom fantasy stories about the beautiful world of Lineage 2 and its oldschool territories. Fictional theme, not related to the real lore of Lineage 2. Besides, everyone has read the real ones. Whenever I have a new story I will post. So without further delay:   The Boat Blessed by Einhasad (Story written by me, proof-reading only by AI) Part 1: The Stranger and Einhasad One beautiful morning, Orcis the clan leader and Chapan, the beautiful female bishop, were sitting in Giran Harbor waiting for the boat. "I have a feeling that this will be a great day, beautiful lady," Orcis told Chapan. The boat arrived, and on top of it stood a stranger. "Ahoy, fellas!" he called out, giving them a high five. "Ahoy... stranger," replied Chapan. "What brings you to this boat?" asked the stranger. "We want to travel the world," said Chapan. "And we want to conquer it all," added Orcis. The stranger looked at them both and said, "I'm in a good mood today, so I will share something with you. Einhasad came to me yesterday and gave me wisdom—wisdom that will let you explore and allow you to conquer. Here, let me show you." The stranger stepped off the boat. Then he stepped back on. He lifted his right foot to step off again, but he didn't; he only pretended to, stepping right back onto the boat instead. He repeated the motion with his right foot again and again. Orcis and Chapan laughed, but the ferryman was furious. "Why are you pretending to disembark while staying on the boat?" shouted the ferryman. "Stop being a fool and either stay on or off! You're making me dizzy acting like a clown!" The stranger stepped off the boat. As he was escorted away from the furious ferryman, he whispered to Chapan, "You can do this dance too. It's funny—try it." As the ferryman and the stranger walked away, Orcis and Chapan started doing the foolish move. They stepped onto the boat, pretended to return to shore, only to place their foot back on the boat at the last moment. They did it many times and had great fun. As they were playing through this crazy dance routine on the boat, something magical happened: Einhasad appeared in front of them. "I see you have found wisdom," Einhasad said. "I will allow you your wisdom, but you are never to step on the boat more than 127 times. And you must never go to the man who lives forever alone on the Primeval Isle, for he can see through your dance and will not like it." Einhasad vanished, the boat departed, and our comedic duo continued their journey... Part 2: The Greatest Healer and the Castle Lord Two days later, a boat arrived at Rune Harbor. Off it stepped an orc and a healer. "You take the town, lady—find a mercenary to help you. I will go take the castle," said the orc. A couple of minutes later, the lone orc appeared at a siege-battered castle. The defenders were repairing the fortress after successfully repelling an attacking force. They saw the orc walking toward the castle with small, steady steps and laughed at him. "Who dares walk against the mightiest clan alone?" The orc continued on his path until he was close to the defenders. Bows were armed; swords were unsheathed. The defenders lunged at the orc, only to find it impossible to hit him. Their weapons could not touch his skin or armor and were instantly repelled. They chased behind the orc, who proceeded into the engraving room and began commune with the artifact, all while the defenders tried in vain to slash and blunt him. Nothing landed—not a single blow. The orc was casting as peacefully as if he were in town, completely uninterrupted. "Masters, masters!" a voice shouted. "I bring bad news from the city! There is a female healer—she came with an orc and a mercenary. They killed the guards, wiped out our force, and took over the city!" "How could that be?" said the castle masters, momentarily forgetting that an orc was actively taking their castle. "The healer, masters! The healer—she can't be killed! Our swords slip right off her armor!" Before they could respond, the engraving completed. "I am now your master, your voice, your ruler," the orc declared. "Bow before me, for I am blessed by Einhasad and I am immortal!" Part 3: The Sanctuary of Primeval Isle Three days later, a female human healer stepped off the boat onto Primeval Isle. She had fool-stepped on the boat 126 times now, taking care never to exceed 127—for as Einhasad had warned, doing so would make her mortal again. "I seek the ruler of this island, for he is to bow before me," she announced. Suddenly, an arrow flew through the dense foliage of Primeval Isle. It pierced straight through the healer's armor and crushed her to the ground. As her eyes closed in her final moments, she heard the voice of Einhasad echo the old warning given to them days ago: "Primeval Isle is sacred. The man who lives there forever has made it so—for I might not have given him wisdom, but I have given him luck." The End   The Man at Primeval Isle Word reached the newly crowned King of the Aden territory—Orcis the Orc—about the tragic end of his beloved Chapan, who had dared to set foot upon the fog-shrouded shores of Primeval Isle. A thousand bards sang in the grand halls, yet not a single melody could soothe the sovereign's profound rage and grief. Days bled into weeks. The court watched their ruler wither in inconsolable silence, until a lone traveler requested an audience at the castle gates. "My Lord," the captain of the guard announced, kneeling before the throne. "A wanderer demands entry. He claims to hold the key to the island." "The island?" Orcis grunted, his voice like grinding stone. "He speaks of a way to walk upon those cursed sands untouched by mortality... and to face the solitary warden who governs the primeval wild." "Bring him in," ordered the King. When the stranger approached the dais, Orcis instantly recognized the weathered face. It was the enigmatic figure from Giran Harbor—the nomad who had first taught them the strange ritual of steps that granted them divine immunity. The wanderer bowed low, but Orcis raised a hand. "Rise, old friend. This kingdom was forged on the strange wisdom you shared. Speak. What do you know of the island’s master?" The stranger leaned in, his eyes gleaming with secret knowledge. "The warden believes his sanctuary is absolute, my King—that the ancient currents protecting his domain cannot be broken by the dance of the harbor," the stranger whispered. "Yet in his pride, he misjudged the rhythm of the crossing. He guards against those who linger in the threshold...   ... but he never foresaw what happens when the voyage comes to its absolute end."
    • I messaged him on Discord and he blocked me 🤷‍♂️
    • Alisa selling why u dont buy from her?
  • 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..