Loottables
1.
Lets take Gynok Moltor for example: He got 2 lootdrops : 2885 and 90097, but... 2885 has a probability of 50 and 90997 a probability of 100. Is this supposed to work? Is the probability added up to 150 and then divided? Or is the lootdrop 90997 always rolled and 2885 does not have any chance to drop? 2. Can I make a lootdrop with a probability of 1/1000 for example? 3. Another question: I saw loottables with only 1 lootdrop in it, which sometimes got a probability below 100. Well, thats okay as some mobs arent supposed to drop loot every time. But what about the "chance" column in the lootdrop_entries table? Do the chances sum need to be 100? |
1. 2885
50 means its a 50% chance it will be picked, if it does, then it looks in the loot entries which on mine has a 5or6% chance to drop one of the rusty weapons, 90097 is 100, so will always get selected, and one of the two rings will get selected, as they are set 50/50 - so you will always get one of them if you changes the multiplier to 2, then you always get 2 rings 2. you could, just give it low odds, 5% probability of being picked 5% chance of dropping the item ( that isn't the math, play around with it ) 3. as explained above, and no, chance dosn't have to =100 that is why sometimes you will get nothing from that loot entry |
Thank you very much! :)
|
Maybe I am misunderstanding the explanation above, but this is how it works:
The chance field of the lootdrop_entries table does not have to equal 100. No matter what the total is for all entries in that lootdrop_id, the chance is basically a percentage of the total of the entries. Here are some examples: 1. If there is only 1 lootdrop entry, the chance is 100% no matter if you set it to 1 or to 100. 2. If there are 3 loot drop entries that you want to all have equal drop chances, you can set each to 33, or you can set each to 100 or any other equal value and the chance will be divided equally. 3. If you have 3 entries and 1 is 100 and the other 2 are 50, then 1 of them will have 50% chance while the other 2 have 25% chance each. Basically, it just totals up the chances and randoms and sees if the random outcome is less than the chance of the entry it is checking. |
And the chance column works the same way as the probability column?
If thats really the way it works, then do I really always get 2 items of one lootdrop when the multiplier is set to 2? Wouldnt it be more random if I can get 0-2 items of a lootdrop, setting the multplier to 2 and the lootdrop entries to a max total chance of 50? Or is THAT handled with probability? |
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). |
Yeah, that explanation pretty much covers it all. The only correction I would make is about this:
Quote:
On the question of multiple drops; that is set in the lootable_entries table with the multiplier and probability fields. So, if you want 0 to 2 possible drops from your lootdrop_id, you can set the multiplier to 2, then the probability to anything from 1 to 99 depending on how often you want 1 or 2 to drop. The multiplier is the max possible items from the lootdrop_id that can be dropped, and the probability is the chance for each multiplier to drop. If you set the multiplier to 10 and the probability to 10%, you would probably average about 1 drop per kill (in theory anyway), but could be anywhere from 0 to 10 at any time. |
I am enlightened now ;)
well, almost... lootdrop example: lootdrop1 multiplier 1 prob 50 lootdrop2 multiplier 2 prob 100 so 3 lootdrop rolls altogether, right? lets say first roll is 43, it yields an item from lootdrop1, the other 2 rolls dont matter, cause its a guaranteed drop, makes a total of 3 item drops...? Now to the chances. Does the current server release really favors items on top of the list or not? I remember reading an older post from you, trevius, about that topic... |
SELECT lootdrop_id, item_id, item_charges, equip_item, chance FROM lootdrop_entries WHERE lootdrop_id=%i order by chance desc
Thats the actual mysql query to get the lootdrop entries. They are added into memshare this way (so first result from this query is pos 0, second is position 1, etc.). Unless there is something else Trevius is talking about. |
Here is the code that handles the loot drops being added. Note the part highlighted in green where it picks a random entry from the total number of entries to start at and resets it back to 0 if it rolls past the end of the list.
loottables.cpp Code:
// Called by AddLootTableToNPC And yes, Zothen, your example of having 3 drops from that setup is correct. With those settings, you could have either 2 or 3 drops, depending on if the 50% probability one wins the roll or not. |
Gotcha. nm
|
Thank you both very much! That was very helpful.
|
I'm pretty sure I understand all of this conversation and it's right in line with what I figured out on my own, but I must be missing something because I can't seem to get my new loot to drop. My goal was this: Get all the mobs that are supposed to drop the "ornate defiant scepter" (item ID: 50557) to drop it.
I started by trying to get Hill Giants in Rathe Mts to drop it 100% of the time, just so I could see it drop and then I'd back the % off to about 5. Here's what I did: 1. Add an entry into lootdrop_entries. the previous high value was 90495 so I made mine 90496: insert into lootdrop_entries (lootdrop_id, item_id, item_charges, equip_item, chance) VALUES (90496, 50557, 1, 0, 100); [Aside: does 'equip_item' mean the hill giant would have it equipped as his weapon?] 2. figure out that hill giants in rathe mts all use the same loot table (1839): SELECT npc_types.id,npc_types.name,npc_types.loottable_id FROM npc_types JOIN spawnentry ON npc_types.id=spawnentry.npcID JOIN spawn2 ON spawnentry.spawngroupID = spawn2.spawngroupID JOIN zone ON spawn2.zone = zone.short_name where npc_types.name='a_hill_giant' and short_name='rathemtn'; 3. Add a new entry into that loot table for my new loot drop, giving it a 100% chance of dropping: insert into loottable_entries (loottable_id, lootdrop_id, multiplier, probability) VALUES (1839, 90496, 1, 100); That seems pretty straight-forward to me, but none of my hill giants have dropped a scepter. What did I do wrong? |
quetark, you appear to be missing the lootdrop entry. Try this:
Code:
INSERT INTO `lootdrop` (`id`, `name`) VALUES (90496, 'HG'); |
Also make sure you restarted your server after you added the loot tables so they can take effect.
|
All times are GMT -4. The time now is 11:06 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.