Jump to content
  • 0

Question

Posted

hello how i can make this code for only monster with 22587 id only and not all monsters its for cancel cast:

 
if ((target.isRaid() && target.isMonster()) || target.isInvul() || (init <= 0))
{
return false; // No attack break
}

 

Recommended Posts

  • 0
Posted

 

hello how i can make this code for only monster with 22587 id only and not all monsters its for cancel cast:

 
if ((target.isRaid() && target.isMonster()) || target.isInvul() || (init <= 0))
{
return false; // No attack break
}

 

i didnt understand what you want to do but to add id so you must start your code

if (getNpcId() == 22587
  • 0
Posted

 

i didnt understand what you want to do but to add id so you must start your code

if (getNpcId() == 22587

Ok though i am not really confidend i think i get the base idea so i will try giving you some tips:

 

So from my understanding you want this code to function not for all Monsters but only for 22587 but 22587 is defined as a Monster or isn't it?

So  you will have to create a definition for this just like Reborn said if(getNpcId) == blabla.

So i will tell it to you in pseudoce:

If target isMonster then getNpcId blabla

 

return

 

this will make the code work for a monster with the specific NpcId or atleast i believe it to be so if i am mistaken please correct :P

 

  • 0
Posted

i want to add the id of mob inside this code and remove isMonster because i want it for one monster only this code is inside Formulas.java

I gave you the answer change israid with ismonster and add first if((getnpcid() == id && target.israid())

  • 0
Posted

ty guys for the tips but when i add getNpcId  it says method is undefined for formulas

Lets give this a shot go to your gameserver.model.actor  and create this

public int getNpcId()
{
return getTemplate().getNpcId();
}
 
save and try it again this will create a public intiger for the getNpcId... i am really not the best guy to ask here but you could give it a shot i mean nothing to lose :P
  • 0
Posted (edited)

 

hello how i can make this code for only monster with 22587 id only and not all monsters its for cancel cast:

 
     
if ((target.isRaid() || target.isInvul() || (init <= 0))
      if (target instanceof L2Npc)
      {
           L2Npc mob = (L2Npc) target;

           if (mob.getNpcId() == 323232)
               return false; // No attack break
      }

 

 

I don't know in which file this code exist, or what project is but try it.

Edited by AccessDenied
  • 0
Posted (edited)

You don't need to edit the check with isRaid and isInvul (Unless you want them completely removed)

All you have to do is add a new check like this:
 


if (target instanceof L2Npc && ((L2Npc)target).getId() == 22587)
{          
    return false; // No attack break
} 

Additionally do not forget to add this import at the very beginning of the class:
 

import com.l2jserver.gameserver.model.actor.L2Npc; 

That should work (At least it does for me and I think I use a similar project to yours).

Edited by Meydex
  • 0
Posted (edited)

i want to add the id of mob inside this code and remove isMonster because i want it for one monster only this code is inside Formulas.java

wut..

 

Dunno...,since u want it for 1 monster and its && ,there is no reason to worry for it.It will work.U just need to add && getId() == theidyouwant.(It will check if its monster and if its 1 and if the id is the specific it,1 and 1 = 1.

The check will return 0 if its not the chosen mob,so it will work only for that mob.

Edited by bravetobe

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

    • Inventory restock: Premium business accounts are now available.   ✔ Wallester Business EU 🇪🇺|💳 Unlimited virtual cards, physical cards, 🏦 multi-currency IBAN, ₿ crypto & stablecoin deposits. ✔ Stripe Business UK 🇬🇧|💳 Instant virtual cards (Visa/Mastercard), high-conversion checkout, multi-currency payouts, ₿ crypto payments, no-code payment links. ✔ Mercury Business US 🇺🇸|🏦 US checking & savings, 💳 unlimited virtual cards, domestic & International wires, native stablecoin settlement. ✔ Payset Business EU 🇪🇺|🏦 Multiple IBANs, UK sort code, SEPA Instant, 💳 unlimited virtual cards, multi-currency accounts. ✔ Novo Business US 🇺🇸|🏦 Business checking account, ACH payments & invoicing, 💳 virtual & physical cards, novo boost.
    • Let me see if I understand correctly, older gentlemen, when a newcomer shows up to create modern things with the help of AI, doing what you charge them to do, you point the finger and laugh. I believe that's why everything is stagnant. The product isn't for programming experts, it's for newcomers. Don't buy from you if they can do it themselves using this base. You're going to deliver a similar product, maybe even worse than this one, so why are you complaining? PowerShell, as you well know, started with it, then came new platforms and new apps, new creation models, all with different languages; I chose the simplest one for my taste. This is about being organized and knowing how to choose the right words for each situation. It's not 100%, but it already gives a good impression. Nothing is 100%, so a topic written by AI, and all the code that you charge an absurd amount for to prohibit and sell hacks, could be open source so that everyone can create new practices, new models, new information for passing packets, prohibiting the use of cheats that cause server owners to break so much. Let's remember that the Admin doesn't always shut down the server; it's the players who find problems and take advantage by buying and reselling items, and they say that the GM shuts down the server every week, but that's a lie. What they do is duplicate items with packages and sell them, but perhaps this could give some future developers a starting point to create their own protection following the model in the initial documentation. Because none of you answer a question from a newbie, you think you're superior because you have knowledge, but with AI, people like that can have the same knowledge as you, but with less practice. And if they practice a lot, 10,000 hours, they can be as good as all of you older developers in the L2J field.
    • ✨ Exclusive Offer for Marketplace Growth 🔥 Elevate your performance with a premium bonus. 💲 Top up your balance with $100 or more and receive an additional $5 credit — seamlessly added to your account. ⭐️ Designed for those who value efficiency, scale, and results. ⚡️ Effortless. Refined. Effective. 💥 Enhance your strategy today 💥
  • 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..