Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-06-2011, 10:46 AM
image
Demi-God
 
Join Date: Jan 2002
Posts: 1,290
Default

for (int32 i=0; i<lts->NumEntries; i++) {
for (int32 k = 1; k <= lts->Entries[i].multiplier; k++) {
if ( MakeRandomInt(0,99) < lts->Entries[i].probability) {
AddLootDropToNPC(npc,lts->Entries[i].lootdrop_id, itemlist);
}
}

pretty much:
- For each lootdrop entry that exists on the mob we iterate (tied to whatever x loottable).
- Then inside each lootdrop, we iterate x times (multiplier).
- Inside the nested for loop we use a random 0-99, if the value is less than the probability you set, we attempt to spawn an item from that lootdrop.

In AddLootDropToNPC (determine the actual item):
- We add up the all the 'chance' values into totalchance (of each item in lootdrop_entries).
- To hit a good chance (its a RandomInt 0-totalchance). The random value must be chance=0 OR chance=100 OR this is the only item in the table (totalchance=itemchance) OR finally the random value is less than the current item chance. The first item that hits one of these conditions is your result. These should order as they are in the DB (so the first lootdrop_entries entry for this lootdrop in the db is the first item entry we check).
__________________
www.eq2emu.com
EQ2Emu Developer
Former EQEMu Developer / GuildWars / Zek Seasons Servers
Member of the "I hate devn00b" club.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:30 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3