PDA

View Full Version : Random loot via PERL, non-modified loot tables.


Trubles
05-12-2014, 07:06 AM
This was made for Tomb of the forsaken, it basically adds a random item to every mob's loot table if the roll is high enough, and mobs 51+ get an extra chance at an additional item.


#sub EVENT_SPAWN {
# $roll = int(rand(100)) + 1;
#
# $roll_chance = $roll - 70;
# $roll2_chance = $roll - 85;
# if($roll >= 88)
# {
# my $itemid = ( int rand 95000 ) + 1001;
# #quest::shout("I rolled a $roll have an extra item at $roll_chance percent. Number 1 statement");
# $npc->AddItem($itemid);
# if($roll >= 88 && $mlevel >= 51)
# {
# my $itemid2 = ( int rand 95000 ) + 1001;
# #quest::shout("I have rolled higher than 85 an extra item at $roll2_chance percent chance. Number 2 statement");
# $npc->AddItem($itemid2);
# }
# }
#
#}

Akkadius
05-12-2014, 11:40 AM
Just FYI I will be releasing my Diablo Loot generator soon. We've added new support for it in the source so it will be making its way on the Wiki here soon as another mod.

Trubles
05-12-2014, 11:55 AM
Adding it as a plugin?

Was never fond of modifying massive loot tables, i like to make everything simple.

Akkadius
05-12-2014, 12:24 PM
Adding it as a plugin?

Was never fond of modifying massive loot tables, i like to make everything simple.

You won't have to edit anything besides definitions. It is a lot simpler than you think. The script generates hundreds of thousands of entries on its own. It is a script you run one time before you load the server up.

vithmiris
05-12-2014, 12:28 PM
Just FYI I will be releasing my Diablo Loot generator soon. We've added new support for it in the source so it will be making its way on the Wiki here soon as another mod.

Excellent news!

knowom
05-12-2014, 07:28 PM
Just FYI I will be releasing my Diablo Loot generator soon. We've added new support for it in the source so it will be making its way on the Wiki here soon as another mod.

Is this something to get bundled into EoC or will it be something separate from it? Sounds like a nice developer tool.

Akkadius
05-12-2014, 07:34 PM
Is this something to get bundled into EoC or will it be something separate from it? Sounds like a nice developer tool.

It's just a Perl script that reads from a database table and then does insane amounts of loops based on criteria.

When I get time I will post it.

Akkadius
05-13-2014, 01:57 AM
I spilled the beans:

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

Have fun!

vithmiris
05-22-2014, 04:47 PM
This was made for Tomb of the forsaken, it basically adds a random item to every mob's loot table if the roll is high enough, and mobs 51+ get an extra chance at an additional item.


#sub EVENT_SPAWN {
# $roll = int(rand(100)) + 1;
#
# $roll_chance = $roll - 70;
# $roll2_chance = $roll - 85;
# if($roll >= 88)
# {
# my $itemid = ( int rand 95000 ) + 1001;
# #quest::shout("I rolled a $roll have an extra item at $roll_chance percent. Number 1 statement");
# $npc->AddItem($itemid);
# if($roll >= 88 && $mlevel >= 51)
# {
# my $itemid2 = ( int rand 95000 ) + 1001;
# #quest::shout("I have rolled higher than 85 an extra item at $roll2_chance percent chance. Number 2 statement");
# $npc->AddItem($itemid2);
# }
# }
#
#}

Does this work from global_player.pl ?

Splose
05-22-2014, 05:07 PM
^ global_npc


$nn = $npc->GetCleanName();
if($nn=~/bear|snake|wolf)
if($nn eq "Specific Mob") <---- case sensitive


Those will be your friends when editing globals and defaults you can make entire zones with just the zone/default.pl

lordnivek1
03-21-2015, 12:04 PM
NEVER MIND GOT IT WORKING. WHILE GOING THROUGH THE FORUMS AGAIN I FOUND I WAS PUTTING IT IN THE WRONG PLACE. MOVED THE GLOBAL_NPC FILE TO C:\EQ\EQEmuServer\quests\global AND IT NOW WORKS.


love the idea of just adding a low % chance that any item can drop from any mob. so trying to get this set up but not able to get work and hoping someone can help me. i am running rof2 sever with bots, was created new a couple days ago. I have little to no understanding of what i am doing other then reading forums and copy what you great people have done. here is what i am doing to try and get this to work.

1. created a folder called templates in C:\EQ\EQEmuServer\quests

2. in the templates folder created a word doc called global_npc.pl

3. in that doc i past in the code from the first post here.

4. i delete all the # from the code.

5. for testing i change the first role from 70 to a 1 see if an item is added when i kill a mob. to me this would make it a 100% chance of getting an extra item.

6 restart sever, log in and go kill a mob...no new loot??

what did i do wrong and am i even close to how this should work lol?
thank you in advance for any advice :)
(even a "your so far off how this works i wouldnt know how to help" would be help full haha)

NEVER MIND GOT IT WORKING. WHILE GOING THROUGH THE FORUMS AGAIN I FOUND I WAS PUTTING IT IN THE WRONG PLACE. MOVED THE GLOBAL_NPC FILE TO C:\EQ\EQEmuServer\quests\global AND IT NOW WORKS.

lordnivek1
09-16-2016, 11:19 PM
Is there any way to take this code and add it so it only picks random items with an itemtype of 54?