Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-27-2013, 10:04 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default random loot, the easy way

i finally got around to using the new global_npc.pl script
it makes loot randomization so much easier...

this small snippet
- doesn't make changes to default loot chances
- only gives npcs with existing loot tables are given an extra item
(so untargetable, invisible npcs won't turn into floating weapons)
- verifies itemid is valid via temporary itemlink creation

EQEmu\quests\templates\global_npc.pl
Code:
sub EVENT_SPAWN {
    return unless $npc->GetLoottableID();
    my ($tested, $itemid);
    do {
        $itemid = ( int rand 131474 ) + 1001;
        $tested = quest::varlink($itemid);
    } while $tested =~ /INVALID/;
    $npc->AddItem($itemid);
}
- can easily be expanded upon

examples:
filter specific items from roll
destroy extra item under certain conditions
roll for chance at extra item
additional random items

NOTE: you'll want to change the number from 131474 to whatever the highest itemid is in your items table and subtract 1001 (or your lowest itemid) from that number.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:02 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3