|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Archive::General Discussion Archive area for General Discussion's posts that were moved here after an inactivity period of 90 days. |

11-26-2002, 01:52 AM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
Loot tables
Is it just me, or are loot tables worse than ever? Loot is showing up in excessive amounts on #npcstats (Like 10 rat meat on a rat) and nothing at all is showing up when you loot the corpse, though the corpse refuses to poof...
|

11-26-2002, 01:59 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
2 things here.. they implemented way to high of a loot modifer with the 3.13 version ( * 10 chance) which is good for the planes, but crappy everywhere else, and the latest patch compressed the loot packets and an offset.
My version where I set the loot modifier to 2-3 via a database variable drops pretty well at a decent frequency, if you want to fix it , at the end of loottables.cpp, change this.
if( (rand()%100) < (atoi(row[4]) * 10) )
to something more like
if( (rand()%100) < (atoi(row[4]) * 3) )
I made a eq.variable called lootdropmod so you could tweak this number to account for low or high loot chances in a database.
Also, to see the loot on the corpse, you'll need to use the patch prior to the last one until the loot strut is fixed.
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
|

11-26-2002, 02:12 AM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
Shouldn't you know, the database number for amount determine how many weapons a kobold can have?
I guess I'll just remove the multiplier.
|

11-26-2002, 02:16 AM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
Even without the multiplier, stuff's all messed up. Why isn't the amount modifier working? I mean, I don't want to have 10 low chances of a weapon dropping from a zombie, I want one fairly high.
And chance isn't working at all, heh. Really rare drops are 100% to appear.
|
 |
|
 |

11-26-2002, 02:28 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Theres 2 different ones..
This ones checks for multiple drop items (like spider silk)
if (RunQuery(query, MakeAnyLenString(&query, "SELECT loottable_id, lootdrop_id, multiplier, probability FROM loottable_entries WHERE loottable_id=%i", loottable_id), errbuf, &result)) {
safe_delete(query);
while ((row = mysql_fetch_row(result))) {
int multiplier = atoi(row[2]);
for (int i = 1; i <= multiplier; i++) {
if ((rand() % 1)*100 < atoi(row[3])) {
AddLootDropToNPC(atoi(row[1]), itemlist);
}
}
}
This one calculates whether a mob has an item on its item chance list..
if (RunQuery(query, MakeAnyLenString(&query, "SELECT lootdrop_id, item_id, item_charges, equip_item, chance FROM lootdrop_entries WHERE lootdrop_id=%i", lootdrop_id), errbuf, &result))
{
delete[] query;
while ((row = mysql_fetch_row(result)))
{
if( (rand()%100) < (atoi(row[4]) * 10) )
{
int32 itemid = atoi(row[1]);
const Item_Struct* dbitem = database.GetItem(itemid);
if (dbitem == 0)
{
The 2nd one is the one to tweak. You get 10 chances on 10 low chance weapons because thats the way the emulator is currently coded. To do it the way you suggest, we'd need to implement it the way quester suggest, put items in to LOOTITEMGROUPS, say a Rusty Weapon group, then roll once on that table for a random item off it. A much better way to do it, but would require changes to the loot tables in the database and a new table for the groups. Not hard to do, just will take some work, its definately the way to go though
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
|
 |
|
 |

11-26-2002, 03:27 AM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
Look, say I have the loot drop group ElementalLordLoot, with the items WaterCrown (Chance 70) and FireCrown (Chance 30)
This used to work so that you had 70% chance at the Water Crown and 30% chance at the Fire Crown for each amount in the loot tables setup, and that the chance of getting the item at all was determined by the chance in loot tables.
Now, it seems to be all messed up.
|
 |
|
 |

11-26-2002, 04:02 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
If thats the case, then your multiplier should be 1, and you
have the chance set at 70 and 30 in the lootdrop table.
Or, you have it set for 7 and 3, and use a multiplier of 10.
Then, if rand%100 < (chance)*mult, you'll have the item added to the npc.
But, this isnt exclusive, it will roll once for every item on the loottable , rather than rolling for an item from a group, then rolling a rand to determine which item from the group you will get. The way it is now, theres a chance you end up with both of them, 1 , or nothing.
The better way would be..
30 % chance of getting a crown
Roll a 20.
Get a crown, now determine which one.
Roll a 80
80 corresponds to the 70-100 range for getting the Fire crown, so thats added to the npc.
Its working ok on my server, though i dont like the implementation as it works right now.
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
|
 |
|
 |
 |
|
 |

11-26-2002, 12:14 PM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
Okay, I don't wtf whoever wrote that code was smoking, but here's a fixed version that works as desired above:
Code:
if ((rand()%100) < atoi(row[3])) {
AddLootDropToNPC(atoi(row[1]), itemlist);
}
And:
Code:
void Database::AddLootDropToNPC(int32 lootdrop_id, ItemList* itemlist) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
int32 chancepool = 0;
int32 items[50];
int32 itemchance[50];
int16 itemcharges[50];
int8 i = 0;
for (int m=0;m < 50;m++)
{
items[m]=0;
itemchance[m]=0;
itemcharges[m]=0;
}
if (RunQuery(query, MakeAnyLenString(&query, "SELECT lootdrop_id, item_id, item_charges, equip_item, chance FROM lootdrop_entries WHERE lootdrop_id=%i", lootdrop_id), errbuf, &result))
{
delete[] query;
while (row = mysql_fetch_row(result))
{
items[i] = atoi(row[1]);
itemchance[i] = atoi(row[4]) + chancepool;
itemcharges[i] = atoi(row[2]);
chancepool += atoi(row[4]);
i++;
}
int32 res = rand()%chancepool;
i = 0;
while (items[i] != 0)
{
if (res <= itemchance[i])
break;
else
i++;
}
const Item_Struct* dbitem = database.GetItem(items[i]);
if (dbitem == 0)
{
cerr << "Error in AddLootDropToNPC: dbitem=0, item#=" << items[i] << ", lootdrop_id=" << lootdrop_id << endl;
}
else
{
ServerLootItem_Struct* item = new ServerLootItem_Struct;
item->item_nr = dbitem->item_nr;
item->charges = itemcharges[i];
item->equipSlot = 0;
(*itemlist).Append(item);
}
mysql_free_result(result);
}
else
{
cerr << "Error in AddLootDropToNPC query '" << query << "' " << errbuf << endl;
delete[] query;
return;
}
return;
}
|
 |
|
 |
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:45 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |