Jump to content
  • 0

Where to find player death


Question

Posted

Hello,

 

If anyone could tell me where to find in l2j java files.

I want to make the player drop something from PVP or PK from the winning player's inventory.

 

Thanks alot!

13 answers to this question

Recommended Posts

  • 0
Posted

Hello,

 

If anyone could tell me where to find in l2j java files.

I want to make the player drop something from the pvp or pk.

 

Thanks alot!

L2PcInstance  doDie()

  • 0
Posted

sorry, i meant...drop something from PVP or PK from the winning player's inventory.

Get doDie() and make a random chance of player dropping a specific item.

  • 0
Posted

it is a custom feature in ZeRo*'s pack!

i dont know how he did that !

better ask him..

Its very simple actually. I did it in many other posts roby, sorry but I wont make people their code anymore. If you want special features make them, I'm here to offer support not to dev for you people ;)

  • 0
Posted

Ok, so this is the function.

 

 

I'll have to remove this "(!isInsideZone(ZONE_PVP) || pk == null) &&" (from the first if statement).

 

From what I can tell this is the only modification needs to be made. Am I correct ?

Thank you again.

 

 

private void onDieDropItem(L2Character killer)

{

if (atEvent || killer == null)

            return;

 

L2PcInstance pk = killer.getActingPlayer();

if (getKarma() <= 0 && pk != null

                && pk.getClan() != null && getClan() != null

                && (

                pk.getClan().isAtWarWith(getClanId())

                        // || this.getClan().isAtWarWith(((L2PcInstance)killer).getClanId())

                  )

          )

return;

 

if ((!isInsideZone(ZONE_PVP) || pk == null) && (!isGM() || Config.KARMA_DROP_GM))

{

boolean isKarmaDrop = false;

boolean isKillerNpc = (killer instanceof L2Npc);

int pkLimit = Config.KARMA_PK_LIMIT;

 

int dropEquip          = 0;

int dropEquipWeapon    = 0;

int dropItem            = 0;

int dropLimit          = 0;

int dropPercent        = 0;

 

if (getKarma() > 0 && getPkKills() >= pkLimit)

{

isKarmaDrop = true;

dropPercent = Config.KARMA_RATE_DROP;

dropEquip = Config.KARMA_RATE_DROP_EQUIP;

dropEquipWeapon = Config.KARMA_RATE_DROP_EQUIP_WEAPON;

dropItem = Config.KARMA_RATE_DROP_ITEM;

dropLimit = Config.KARMA_DROP_LIMIT;

}

else if (isKillerNpc && getLevel() > 4 && !isFestivalParticipant())

{

dropPercent = Config.PLAYER_RATE_DROP;

dropEquip = Config.PLAYER_RATE_DROP_EQUIP;

dropEquipWeapon = Config.PLAYER_RATE_DROP_EQUIP_WEAPON;

dropItem = Config.PLAYER_RATE_DROP_ITEM;

dropLimit = Config.PLAYER_DROP_LIMIT;

}

 

            int dropCount = 0;

while (dropPercent > 0 && Rnd.get(100) < dropPercent && dropCount < dropLimit)

{

                int itemDropPercent = 0;

List<Integer> nonDroppableList = new FastList<Integer>();

List<Integer> nonDroppableListPet = new FastList<Integer>();

 

nonDroppableList = Config.KARMA_LIST_NONDROPPABLE_ITEMS;

nonDroppableListPet = Config.KARMA_LIST_NONDROPPABLE_ITEMS;

 

for (L2ItemInstance itemDrop : getInventory().getItems())

{

// Don't drop

if (

itemDrop.isShadowItem() || // Dont drop Shadow Items

!itemDrop.isDropable() ||

itemDrop.getItemId() == 57 || // Adena

itemDrop.getItem().getType2() == L2Item.TYPE2_QUEST ||                  // Quest Items

nonDroppableList.contains(itemDrop.getItemId()) ||                      // Item listed in the non droppable item list

nonDroppableListPet.contains(itemDrop.getItemId()) ||                  // Item listed in the non droppable pet item list

getPet() != null && getPet().getControlItemId() == itemDrop.getItemId() // Control Item of active pet

) continue;

 

if (itemDrop.isEquipped())

{

// Set proper chance according to Item type of equipped Item

                        itemDropPercent = itemDrop.getItem().getType2() == L2Item.TYPE2_WEAPON ? dropEquipWeapon : dropEquip;

getInventory().unEquipItemInSlotAndRecord(itemDrop.getLocationSlot());

}

else itemDropPercent = dropItem; // Item in inventory

 

// NOTE: Each time an item is dropped, the chance of another item being dropped gets lesser (dropCount * 2)

if (Rnd.get(100) < itemDropPercent)

{

dropItem("DieDrop", itemDrop, killer, true);

 

if (isKarmaDrop)

_log.warning(getName() + " has karma and dropped id = " + itemDrop.getItemId() + ", count = " + itemDrop.getCount());

else

_log.warning(getName() + " dropped id = " + itemDrop.getItemId() + ", count = " + itemDrop.getCount());

 

dropCount++;

break;

}

}

}

}

}

 

  • 0
Posted

yes but I don't want the player to drop if he's in town. (other players can make mob trains...). Any ideas ?

 

add a check for TOWN_ZONE and you are done

  • 0
Posted

I tried to modify from this "else if (isKillerNpc && getLevel() > 4 && !isFestivalParticipant())" to this " else if (getLevel() > 4 && !isFestivalParticipant())

but it doesn't work.

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..