PDA

View Full Version : Akka's Diablo Loot Generator Script


Akkadius
05-13-2014, 01:59 AM
This thing is pretty much the shit, it's a few years old but I've compiled it for all the people who have been wanting it over the years.

It is as is, have fun.

http://wiki.eqemulator.org/p?Diablo_Loot_Generator_Script&frm=Main--Perl_Plugins_Master_Reference

:D

knowom
05-13-2014, 03:13 AM
It's just a Perl script that reads from a database table and then does insane amounts of loops based on criteria.


Sounds need on the topic of randomization. For me personally my ideal randomization tool would just to select random 1-10, 1-100, or random 1-1000 and have a button to click to do that to a individual stat selected this could then either be added to the stat value or determine the stat value. It would be endlessly fun and a great way to spice up loot tables.

I liked how randomization was handled in UO for magic items. It wasn't so all over the place in terms of "RNG is RNG" randomization Diablo's known for.

http://wiki.uosecondage.com/Item_ID

Akkadius
05-13-2014, 03:17 AM
Sounds need on the topic of randomization. For me personally my ideal randomization tool would just to select random 1-10, 1-100, or random 1-1000 and have a button to click to do that to a individual stat selected this could then either be added to the stat value or determine the stat value. It would be endlessly fun and a great way to spice up loot tables.

I liked how randomization was handled in UO for magic items. It wasn't so all over the place in terms of "RNG is RNG" randomization Diablo's known for.

http://wiki.uosecondage.com/Item_ID

Huh? You could easily extend this to have that functionality. Not making a whole lot of sense.

Splose
05-13-2014, 03:51 AM
Sounds need on the topic of randomization. For me personally my ideal randomization tool would just to select random 1-10, 1-100, or random 1-1000 and have a button to click to do that to a individual stat selected this could then either be added to the stat value or determine the stat value. It would be endlessly fun and a great way to spice up loot tables.

I liked how randomization was handled in UO for magic items. It wasn't so all over the place in terms of "RNG is RNG" randomization Diablo's known for.

http://wiki.uosecondage.com/Item_ID

http://jaredblakedicroce.files.wordpress.com/2012/04/saywhat.jpg

knowom
05-13-2014, 03:54 AM
Hmmm never mind then I guess it's more flexible than I was thinking or understand it at least. I'll have to read the wiki on it in more depth at some point.

Trubles
05-14-2014, 08:16 AM
Knowom, I've stolen this and modified it to include chance drops, let me know if you'd like me to post.

Akkadius
05-14-2014, 11:49 AM
Knowom, I've stolen this and modified it to include chance drops, let me know if you'd like me to post.

'chance drops', what?

Trubles
05-14-2014, 01:06 PM
I don't even know, I broke the script lol.

vithmiris
05-17-2014, 04:06 PM
Attempting to run 'perl DiabloLoot.pl' from my Server dir and am receiving:

DBI connect(':localhost:3306','',...) failed: Access denied for user 'ODBC'@'localhost' (using password: NO) at DiabloLoot.pl line 35
DBI connect(':localhost:3306','',...) failed: Access denied for user 'ODBC'@'localhost' (using password: NO) at DiabloLoot.pl line 36

I've installed ppm install http://www.bribes.org/perl/ppm/DBD-mysql.ppd

Am I missing something with my connect configuration?

Kingly_Krab
05-17-2014, 04:48 PM
Attempting to run 'perl DiabloLoot.pl' from my Server dir and am receiving:

DBI connect(':localhost:3306','',...) failed: Access denied for user 'ODBC'@'localhost' (using password: NO) at DiabloLoot.pl line 35
DBI connect(':localhost:3306','',...) failed: Access denied for user 'ODBC'@'localhost' (using password: NO) at DiabloLoot.pl line 36

I've installed ppm install http://www.bribes.org/perl/ppm/DBD-mysql.ppd

Am I missing something with my connect configuration?
You're not supplying a password. Do you have a password set? If you do, it won't let you connect, even if you're on localhost, without the password.

vithmiris
05-18-2014, 07:25 PM
I was under the impression the script looked inside eqemu_config.xml for DB credentials.

If this isn't the case, does DBI need to be configured in some manner?

Kingly_Krab
05-18-2014, 09:39 PM
If it isn't looking into your eqemu_config.xml, yes, it will need the same database information used within the eqemu_config.xml.

lerxst2112
05-19-2014, 12:41 AM
It should read from the config file assuming it can find it in the current directory. If not it should print ""Unable to open config: eqemu_config.xml"

You could always modify the script to print what it found for those variables so you can maybe figure out where it went wrong.

ionhsmith
09-29-2014, 03:22 PM
ok trying to learn how to do all this so bare with me ... I followed what I could from the wiki and I have the diabloloot.pl in the plugins folder of my server but how do i run the script? i get this when i try ... DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 109.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 95.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 97.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 99.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 105.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 107.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 109.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 95.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 97.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 99.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 105.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 107.
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 109.
Generating General Loot... Please wait...
DBD::mysql::st fetchrow_array failed: fetch() without execute() at Diabloloot.pl
line 137.
Items Processed: 0
DBD::mysql::st execute failed: No database selected at Diabloloot.pl line 186.
Generating Augments Loot... Please wait...
DBD::mysql::st fetchrow_array failed: fetch() without execute() at Diabloloot.pl
line 189.

Loot has been successfully generated
Items Processed: 0


Job took 1 seconds

C:\EQ\EQEMUServer>

cleramsey
09-29-2014, 08:25 PM
If you have DiabloLoot.pl in your plugin folder need to move it your your actually server directory folder in order to run it properly.

ionhsmith
09-29-2014, 08:29 PM
Yea i did that already I got the errors i posted above ... sorry thought i posted that...

Akkadius
09-29-2014, 08:35 PM
Did you copy and paste the script out of the Wiki or did you go to the Pastebin?

You need to copy it from the Pastebin because there are some characters that mess up the parsing of the script in the Wiki.

ionhsmith
09-30-2014, 07:57 PM
I got it from the wiki... what is or where is the pastebin?

Akkadius
09-30-2014, 08:11 PM
I got it from the wiki... what is or where is the pastebin?

Nevermind this one doesn't have a pastebin option.

Make sure you run the script command line in the server directory, as in 'cd' to the directory and then run the script inside the directory.

ionhsmith
09-30-2014, 08:24 PM
I did that .... this is what i did ... cd C:\EQ\EQEMUServer then it went to

C:\EQ\EQEMUServer> perl Diabloloot all

and i got all those errrors.... am i suppose to put my database pw in or something like that ?


and this step :•You will need this START and END code placed in your EVENT_SPAWN routing in your global_npc.pl, so that when your NPC spawns, the loot table can be added .... i cannot find a global_npc.pl in my server folder anywhere

Mortow
09-30-2014, 10:47 PM
The global_npc.pl file is located in c:\EQ\EQEmuServer\Quests\global directory. Edit it with Notepad++ or whatever text editor you prefer.

This is a copy of what is in mine. I hope this helps.

sub EVENT_SPAWN
{
if($npc->GetEntityVariable("Scaled") != 1)
{ ### If not flagged as scaled, then scale the NPC
quest::signalwith(50, 21, 0);
quest::signalwith(50, $npc->GetNPCTypeID(), 0);
}

#::: START: Akka's Diablo Loot Handler :::#
$NTYPE = 0; #::: TRASH
if(substr($npc->GetName(), 0, 1) eq "#" && substr($npc->GetName(), 1, 2) ne "#"){ $NTYPE = 1; } #::: NAMED
if(substr($npc->GetName(), 0, 2) eq "##" && substr($npc->GetName(), 2, 3) ne "#"){ $NTYPE = 2; } #::: RAID
$LID = (200000 + ($NTYPE * 1000) + $npc->GetLevel());
if($npc->GetLoottableID() != $LID)
{
$npc->ModifyNPCStat("loottable_id", (210000 + ($NTYPE * 1000) + $npc->GetLevel())); $npc->AddLootTable();
$npc->ModifyNPCStat("loottable_id", (200000 + ($NTYPE * 1000) + $npc->GetLevel())); $npc->AddLootTable();
}
#::: END: Akka's Diablo Loot Handler :::#
}

ionhsmith
10-01-2014, 12:45 PM
yea its not in mine ... only thing i have in there is global_player.pl

Mortow
10-01-2014, 03:28 PM
If you are using Notepad++ just click on New and copy and paste the code I posted above into it, then do a Save as, as global_npc.pl

Make sure you change the Save as type line under where you type in the file name to All types (*.*) and save it to the global folder.

That will create the file.

ionhsmith
10-04-2014, 01:10 AM
OK i got that file now but I still get the same errors ... execute failled no database selected at DiabloLoot.pl

Mortow
10-04-2014, 02:39 PM
I had issues with it parsing the info from my config file. I know this is because I have something wrong somewhere but I was able to get it to function by just commenting out the parser section like this:

# CONFIG VARIABLES - Parsed from eqemu_config.xml
#my $confile = "eqemu_config.xml"; #default
#open(F, "<$confile") or die "Unable to open config: $confile\n";
#my $indb = 0;
#while(<f>) {
# s/\r//g;
# if(/<database>/i) { $indb = 1; }
# next unless($indb == 1);
# if(/<\/database>/i) { $indb = 0; last; }
# if(/<host>(.*)<\/host>/i) { $host = $1; }
# elsif(/<username>(.*)<\/username>/i) { $user = $1; }
# elsif(/<password>(.*)<\/password>/i) { $pass = $1; }
# elsif(/<db>(.*)<\/db>/i) { $db = $1; }
#}

Adding the # before a line comments it out.

Then I manually added my db username and password to lines 35 & 36, like this:

if(!$connect){ $connect = DBI->connect($dsn, USERNAME, PASSWORD); }
if(!$connect2){ $connect2 = DBI->connect($dsn, USERNAME, PASSWORD); }

Once that was done it worked for me.

Akkadius
10-05-2014, 06:25 PM
I checked into these connection issues as they are long overdue.

There was an issue with the config parsing section which I've used hundreds of times but somehow some characters got messed up in the Wiki source editor.

Here is the script, download it in raw here:

http://wiki.eqemulator.org/i?Module=Pastebin&Paste=o5AoEbke

And, I've updated the Diablo Loot Generator documentation which you will need to read because it relies on the tables and information in the page.

http://wiki.eqemulator.org/p?Diablo_Loot_Generator_Script

Enjoy

ionhsmith
10-05-2014, 07:08 PM
Working now

ionhsmith
10-05-2014, 07:23 PM
OK my question is do i need to run it everytime i turn the server on?

Akkadius
10-05-2014, 07:26 PM
OK my question is do i need to run it everytime i turn the server on?

You run it everytime you want to regenerate loot based on what you have in the items table.

It creates thousands of loot tables based on the cust_npc_loot_scale definition table, that should have all been mentioned on the page.

ionhsmith
10-05-2014, 07:32 PM
I did read that but wasnt sure what it ment exactly ... it creating thousands of loot tables means the mobs will have random loot on them now where as in my server most of them didnt drop anything? If so that is awesome

Akkadius
10-05-2014, 08:03 PM
Corrected another issue where maxlevel was hitting a out of range value, I had this set to 250 on my server but the PEQ DB is 127 IIRC.

Redownload from the paste and you should be good to go.

ionhsmith
10-05-2014, 08:19 PM
Ok testing this out right now and im in Qinimi killing lvl 50-60 stuff ... each mob drops atleast two high end 80s+ gear every kill

Akkadius
10-05-2014, 08:27 PM
Ok testing this out right now and im in Qinimi killing lvl 50-60 stuff ... each mob drops atleast two high end 80s+ gear every kill

All of that is dictated in the definitions table, its there so you can tweak it to your likings.

ionhsmith
10-05-2014, 08:38 PM
got it thanks

ionhsmith
10-06-2014, 01:41 AM
hmm the changes are not taking effect... i put the loot chance to 0.05 which should be a 5% chance drop and it still droping every kill

Akkadius
10-06-2014, 01:48 AM
hmm the changes are not taking effect... i put the loot chance to 0.05 which should be a 5% chance drop and it still droping every kill

Did you re-run the script after making the changes? AND restart your server?

ionhsmith
10-06-2014, 01:57 AM
Yes serveral times ... it took the HP changes and is now set up decently for my server but wouldnt slow down the drop rate

Akkadius
10-06-2014, 01:59 AM
Yes serveral times ... it took the HP changes and is now set up decently for my server but wouldnt slow down the drop rate

Did you make sure you set the loottable_multiplier for that specific level and type to 1 before adjusting your drop chance?

ionhsmith
10-06-2014, 01:47 PM
No I have the multiplier set at 2 ... isn't that just the number of items it can drop?

ionhsmith
10-08-2014, 05:51 PM
Ok I tried what you said and changed the multiplier to 1 but it still drops every time i kill ... nothing changed. any other suggestions?

Akkadius
10-08-2014, 06:03 PM
Ok I tried what you said and changed the multiplier to 1 but it still drops every time i kill ... nothing changed. any other suggestions?

What is dropping every time you kill? Pics, some detail.

ionhsmith
10-08-2014, 07:09 PM
Mortow told me to run the script perl DioabloLoot.pl delete and then run the "all" function again ... that seemed to fix it ... thanks guys

I may have spoke to soon ... just killed 3 things and all 3 of them dropped several items ill post a pic ... at 5% that seems odd that 3 things in a row would drop something really good wouldnt u think?

Akkadius
10-08-2014, 07:41 PM
Mortow told me to run the script perl DioabloLoot.pl delete and then run the "all" function again ... that seemed to fix it ... thanks guys

I may have spoke to soon ... just killed 3 things and all 3 of them dropped several items ill post a pic ... at 5% that seems odd that 3 things in a row would drop something really good wouldnt u think?

delete is ran when you use "all"

The drop rate should be inherited from the settings in the table so it just seems like you have something not configured right.

ionhsmith
10-08-2014, 07:57 PM
well i have the drop rate set to 0.05 and the multiplier to 1 on every level ... not sure what else to change https://dl.dropboxusercontent.com/u/7283822/eqpic.png

here is a pic and i have looted 20 more things since i just took this pic

Pdizzle
04-13-2015, 09:53 PM
Is there a way to use this tool to add a chance for ANY item in the game to drop on ANY NPC without taking the NPC's level and item level into consideration?

I've been trying to figure it out, but I suppose I'm hung up on understanding what the following means:

hp_min = the minimum HP the item must be in order to be inserted into a lootdrop entry
hp_max = the maximum HP the item must be in order to be inserted into the lootdrop entry

What is the HP of an item? The amount of HP on an item (doesn't make sense to me) or do all items have a HP amount assigned to them to help designate how powerful they are?

Pdizzle
04-22-2015, 06:37 PM
I figured out the answers to my questions above...

Now I have a new question. I'm using Akka's repack, and have applied his diablo loot script to my database. What I've found is that there aren't really any raid mobs designated as ##. Some of the raid mobs are designated as #, and some named mobs are designated as # in their names. Is there an easy way for me to add # to all named NPCs and ## to all raid NPCs so the script can work properly? I'm not sure what type of identifier I can use to run a mass query.

Akkadius
04-22-2015, 07:48 PM
I figured out the answers to my questions above...

Now I have a new question. I'm using Akka's repack, and have applied his diablo loot script to my database. What I've found is that there aren't really any raid mobs designated as ##. Some of the raid mobs are designated as #, and some named mobs are designated as # in their names. Is there an easy way for me to add # to all named NPCs and ## to all raid NPCs so the script can work properly? I'm not sure what type of identifier I can use to run a mass query.

There is no easy way.

It is a convention I came up with and you will have to adhere to if you want to use it.

All you have to do is add it to the names of the NPC's you want at that caliber.

Pdizzle
04-22-2015, 08:35 PM
There is no easy way.

It is a convention I came up with and you will have to adhere to if you want to use it.

All you have to do is add it to the names of the NPC's you want at that caliber.

Thanks for the quick response, Akka. Also, thanks for the tools you've provided.

chasem
08-21-2015, 07:54 PM
First off thanks Akka for this super simple way to implement Diablo-style loot!

Question: Is there any way to keep it from adding random loot to summoned pets?

Thanks!!

royzzz
08-22-2015, 01:56 AM
This is a really useful tool! Thanks Akka! Was easy to adjust all of the rows to customize the loot. My only complaint is the drop chance does not seem to be working right. Under drop_chance I used Heidi to change all to .15 with loottable_multiplier of 1. I am guessing maybe it does not allow a chance under 1?

Splose
08-22-2015, 04:58 AM
This is a really useful tool! Thanks Akka! Was easy to adjust all of the rows to customize the loot. My only complaint is the drop chance does not seem to be working right. Under drop_chance I used Heidi to change all to .15 with loottable_multiplier of 1. I am guessing maybe it does not allow a chance under 1?

design table (at least in navicat) -> change data type from integer to float/decimal.. you can do this for the zone scaling system and it works straight out.. not sure if this would work with the diabloloot.. I haven't looked at it in months but I don't see why it wouldnt.

royzzz
08-22-2015, 03:56 PM
The drop chance and aug drop chance are set to be float already. I was excited to try that, as I did not look at that before I posted, but Akka already had it set this way!

chasem
08-22-2015, 09:54 PM
Anyone know if it's possible to not have pets spawn with random items? Tried a few different things without much success. Players can't give them weapons when they spawn with items.

Akkadius
08-22-2015, 10:00 PM
Anyone know if it's possible to not have pets spawn with random items? Tried a few different things without much success. Players can't give them weapons when they spawn with items.

You can add a check to skip NPC's that have an owner ID.

sub EVENT_SPAWN{
#::: START: Akka's Diablo Loot Handler :::#
$NTYPE = 0; #::: TRASH
if(substr($npc->GetName(), 0, 1) eq "#" && substr($npc->GetName(), 1, 2) ne "#"){ $NTYPE = 1; } #::: NAMED
if(substr($npc->GetName(), 0, 2) eq "##" && substr($npc->GetName(), 2, 3) ne "#"){ $NTYPE = 2; } #::: RAID
$LID = (200000 + ($NTYPE * 1000) + $npc->GetLevel());
if($npc->GetLoottableID() != $LID){
if($npc->GetOwnerID() > 0){
return;
}
$npc->ModifyNPCStat("loottable_id", (210000 + ($NTYPE * 1000) + $npc->GetLevel())); $npc->AddLootTable();
$npc->ModifyNPCStat("loottable_id", (200000 + ($NTYPE * 1000) + $npc->GetLevel())); $npc->AddLootTable();
}
#::: END: Akka's Diablo Loot Handler :::#
}

chasem
08-22-2015, 10:39 PM
Awesome thanks Akka! Very much appreciated!!

royzzz
08-22-2015, 11:32 PM
Figured out my issue. Once editor has run and you are happy, and dont plan on rerunning you can go under table loottable_entries and change the probability there with a sql script. That way you can adjust getting less than one item to drop from a mob. as even with having drop_chance set to a number less than one and float instead of integer set, once loottables are created the probablilty is 100. Hope that helps someone else with a similar issue! Again thank you Akka for this great tool!

Gregk
09-01-2015, 05:40 PM
Help...
DBD::mysql::st execute failed: Column 'multiplier' cannot be null at diabloloot.
pl line 98, <F> line 59.
DBD::mysql::st execute failed: Column 'multiplier' cannot be null at diabloloot.
pl line 108, <F> line 59.
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the m
anual that corresponds to your MySQL server version for the right syntax to use
near 'ORDER by hp' at line 19 at diabloloot.pl line 132, <F> line 59.
Generating General Loot... Please wait...

kimura
07-12-2016, 11:45 AM
Akkadius, this script is awesome :P

Would you consider adding a function to the script where devs could omit items from being selected. Such as custom items that could be disregarded by maybe the "source" column? Just an idea.

Thanks for the awesome stuff bro!

Kimura

Akkadius
07-12-2016, 12:07 PM
Script is pretty much as is at this point, I have another way of doing this that does things completely on the fly in-game which is way faster and allows hot reloading.

kimura
07-12-2016, 12:20 PM
eh, ok was just a suggestion, thanks for the quick response

trahelion
11-29-2016, 09:14 AM
Hey guys, do you know what may be causing this error? I used the installer (Thank you infinitely for that) and have added in the perl updates as stated in the wiki. I am running it from the command line after CD'ing it to my directory. There doesn't appear to be anything dropping from mobs in game.

So the steps I have taken:
Created folder, named and set to .pl file type
Pasted Code in
Opened CMD and typed perl DiabloLoot.pl All

http://i.imgur.com/ZDgsBRw.png

Thanks for any help and your work on this project :)

trahelion
11-30-2016, 11:30 PM
P.S.

I think it might have something to do with this table (http://wiki.eqemulator.org/i?Module=Pastebin&Paste=HM41k9Qi)

I don't know how to add a table to the database yet, but I'm reading and trying to figure it out. :)

So that was the case. If anyone takes the shortbus like me, here is how I added the table to my database and fixed the above error.

Load up HeidiSQL, put in the info to access the DB which is listed in the config file (User: Root PW: eqemu DB: peq)
Select 'New Query'
Paste the data from the table provided at the end of the instructions for the mod here. (http://wiki.eqemulator.org/i?Module=Pastebin&Paste=HM41k9Qi)
press the triangle button to run the script

THEN you can run the mod and it will give a much nicer message.