Jump to content
  • 0

[Drop System] Item Selection


Question

Posted

Hello, guys.

It might be a stupid question but I didn't find antyhing useful in the web. I have one unclear point about l2 drop system.
As I undestand there are categories. Each category has chance to be selected randomly. And each category has one or more items within. But only one item could drop from the category. And that's what confuses me. For example, category has 4 items: item1 with 5% chance, item2 with 10% chance, item 3 with 25% chance and item4, item5 both with 30%.
And the random number is 15. Which item should be selected and how??? For me it looks logically if every item with chance > random chance should be selected but as I unsdenstood correcly this is not the case: only one item from category goes to the ground. But what kind of calculations can handle that? :poker face: 

 

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

Content within group is 100% and chance is cumulative.

 

double totalChance = 0;

final double random = (Rnd.nextDouble() * 100);

for (Item item : getItemOfGroup())

{

totalChance += item.getChance();

if (totalChance > random)

{

drop(item);

break;

}

}

Edited by Sdw
  • 0
Posted

Content within group is 100% and chance is cumulative.

 

double totalChance = 0;

final double random = (Rnd.nextDouble() * 100);

for (Item item : getItemOfGroup())

{

totalChance += item.getChance();

if (totalChance > random)

{

drop(item);

}

}

Oh I see. At the first glance it looked weird for me but now I see how the items with the same chance could be dropped  ^-^ 

Thank you)

  • 0
Posted (edited)

Forgot to break the loop !

Yes, I noticed it but it's still clear how to selecte the item (even if in the code above it'll drop multiple of them) ).

Edited by newrostman
Guest
This topic is now closed to further replies.


  • Posts

    • We are entering another season, the year 2026, which marks 20 years since the beginning of preparations for the first Chronicle server - Gracia Final.     The plans are the same as 20 years ago: to prepare a new generation of the game with the help of our edited game client, New Era.   There will be special new locations and dungeons for solo players and clans, clan quests and a clan shop, as well as special items and jewelry with attributes.     Enjoy the game at Dark Dragon             https://www.darkdragon.club/wp-content/uploads/2025/12/Dark_Dragon_login_New_Era.mp4    
    • Coming soon — New Year promotions across the entire SOCNET ecosystem We are preparing special offers, bonuses, and surprises across all our projects. Follow updates on our social media — you definitely don’t want to miss them. News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh
    • Coming soon — New Year promotions across the entire SOCNET ecosystem We are preparing special offers, bonuses, and surprises across all our projects. Follow updates on our social media — you definitely don’t want to miss them. News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh
    • We are looking for partners and account suppliers for cooperation We are open to partnerships with reliable account suppliers for the following services: ➡ Tinder ➡ Badoo ➡ Bumble ➡ Hinge ➡ Happn ➡ Meetic ➡ VK Dating ➡ LINE ➡ Snapchat ➡ Reddit ➡ LinkedIn ➡ Instagram ➡ Facebook ➡ Threads ➡ Google ADS ➡ E-mails ➡ WhatsApp ➡ Twitter We are considering long-term cooperation, stable volumes, and mutually beneficial terms. If you have any offers — we will be glad to discuss the details. Contact us using the details below. ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Hello Alisa, do you know where is the "auto target" when other enemy attack you?, is in dll but idk wich is the binary code
  • 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