PDA

View Full Version : Loot drop modifications


vacare
02-07-2015, 11:09 PM
Hello,

So I am playing around with various settings, and I've bumped into the first one that has stumped me. It is the loottable/lootdrop system. (Using Cavemandude's 8-15-14 PEQ files and the EqEmu source from about a week ago)

Just for some background, I have read this (which seems to be the most recent forum update on the topic) thread:

http://www.eqemulator.org/forums/showthread.php?t=35770

And I have read the EqEmu/Server source code in loottables.cpp

However, when I change the values, the loot doesn't behave as I would expect, given the code and the description. I will use an example to illustrate what I'm doing, and what I expect, to hopefully make it easier for someone to tell me what I'm doing wrong:

Let's take the "a_large_skeleton" spawns in "najena" zone. They conveniently spawn right inside the front door, and they conveniently all use the same loottable, id=10813.

Now, I have tried many approaches, but the one that I am using now has modified loottable 10813 to have a droplimit=0, mindrop=0, multiplier=1, and probability=100 for all three entries.

Inside the AddLootTableToNPC method:


for (uint32 i=0; i<lts->NumEntries; i++) {
for (uint32 k = 1; k <= lts->Entries[i].multiplier; k++) {
uint8 droplimit = lts->Entries[i].droplimit;
uint8 mindrop = lts->Entries[i].mindrop;

//LootTable Entry probability
float ltchance = 0.0f;
ltchance = lts->Entries[i].probability;

float drop_chance = 0.0f;
if(ltchance > 0.0 && ltchance < 100.0) {
drop_chance = (float)zone->random.Real(0.0, 100.0);
}

if (ltchance != 0.0 && (ltchance == 100.0 || drop_chance <= ltchance)) {
AddLootDropToNPC(npc, lts->Entries[i].lootdrop_id, itemlist, droplimit, mindrop);
}
}
}


It looks like every lootdrop entry in the loottable_entries should get added, since every ltchance will be equal to 100 (probability column), and we'll pass a 0 for both droplimit and mindrop to AddLootDropToNPC.

So now let's look at my lootdrop values. Loottable 10813 has three lootdrop entries: 17698, 150473, and 150474.

I have set all (57) of those lootdrop entries to have an itemcharges=1, chance=100, disabled_chance=0, minlevel=0, maxlevel=127, and multiplier=1 values.

Now, taking that inside AddLootDdropToNPC, I would expect this loop to be hit since droplimit and mindrop are both set to 0 for all entries:


if(droplimit == 0 && mindrop == 0) {
for(uint32 i = 0; i < lds->NumEntries; ++i) {
int charges = lds->Entries[i].multiplier;
for(int j = 0; j < charges; ++j) {
if(zone->random.Real(0.0, 100.0) <= lds->Entries[i].chance) {
const Item_Struct* dbitem = GetItem(lds->Entries[i].item_id);
npc->AddLootDrop(dbitem, itemlist, lds->Entries[i].item_charges, lds->Entries[i].minlevel,
lds->Entries[i].maxlevel, lds->Entries[i].equip_item > 0 ? true : false, false);
}
}
}
return;
}


So this looks like it should loop through every item in the loopdrop entry, and have a 100% chance (since all chance values are 100) to add 1 (the charges) of that item to the NPC's item list (inside AddLootDrop).

But when I stop and restart the world and eqlaunch, log into Najena, and kill a large skeleton, I am getting fairly normal looking drops - for example, sometimes they drop nothing, usually they drop only one thing.

What I would expect, given these values and the code, would be to have 57 items on the skeleton (equal to the number of items on the lootdrop entries) when it dies.

Can someone tell me what I am missing?

Thanks for any help!

Uleat
02-07-2015, 11:28 PM
Did you re-run shared_mem.exe?

vacare
02-07-2015, 11:41 PM
I had not! I knew it was likely a cache issue, but I wasn't sure where the cache was or how to reset it! I now remember shared_memory.exe ... thank you so much! That did the trick, and now it works like a charm!

And let me just say, you people reading the support forums are awesome :)

Thanks again!