Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2020, 10:16 AM
Ueguvil
Hill Giant
 
Join Date: Mar 2004
Posts: 139
Default No duplicate loot

Lets say I want a raid mob to drop 3 unique pieces of loot from a single lootdrop, the current lootdrop functionality doesn't seem to have a way for me to do that. So instead I'm looking at adding loot through a Perl script instead. Here's what I've got so far:

Code:
sub EVENT_SPAWN{
   my @item_PHARA = (1628, 1845, 1848, 2377, 10845, 10851, 10912, 10913, 24648); #loot list
   my $itemlist = @item_PHARA;
   my $item1 = $item_PHARA[plugin::RandomRange(0,$itemlist)];
   quest::addloot($item1, 0, 0);
  
  @item_PHARA2 = grep {$_ != $item1 } @item_PHARA; #remove first loot from loot array, then draw another item
   my $itemlist2 = @item_PHARA2;
   my $item2 = $item_PHARA2[plugin::RandomRange(0,$itemlist2)];
   quest::addloot($item2, 0, 0);

   @item_PHARA3 = grep {$_ != $item2 } @item_PHARA2; #remove second loot from loot array, then draw another item
   my $itemlist3 = @item_PHARA3;
   my $item3 = $item_PHARA3[plugin::RandomRange(0,$itemlist3)];
   quest::addloot($item3, 0, 0);
	}
It seems to mostly work, only problem is about 40% of the time only 2 loots are added instead of 3. No clue if I'm using the grep function correctly, I tried googling how to remove a value from an array and that seemed to be a potential solution.

Thanks for looking
Reply With Quote
  #2  
Old 05-13-2020, 12:42 PM
Ueguvil
Hill Giant
 
Join Date: Mar 2004
Posts: 139
Default

Fixed it and cut some code out that I'm sure was unnecessary (just finding snippets from around the forums)

Code:
sub EVENT_SPAWN{
   my @item_PHARA = (1628, 1845, 1848, 2377, 10845, 10851, 10912, 10913, 24648);
   my $item1 =  quest::ChooseRandom( @item_PHARA ) ;
   quest::addloot($item1, 0, 0);
  
  @item_PHARA2 = grep {$_ != $item1 } @item_PHARA;
   my $item2 =  quest::ChooseRandom( @item_PHARA2 );
   quest::addloot($item2, 0, 0);

   @item_PHARA3 = grep {$_ != $item2 } @item_PHARA2;
   my $item3 =  quest::ChooseRandom( @item_PHARA3 ) ;
   quest::addloot($item3, 0, 0);
	}
Reply With Quote
  #3  
Old 05-13-2020, 01:27 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

I wouldn't be against adding this to our loot tables code. Could be useful for custom servers, don't think live has this behavior :P
Reply With Quote
  #4  
Old 05-13-2020, 02:22 PM
Ueguvil
Hill Giant
 
Join Date: Mar 2004
Posts: 139
Default

Quote:
Originally Posted by demonstar55 View Post
I wouldn't be against adding this to our loot tables code. Could be useful for custom servers, don't think live has this behavior :P
Honestly I thought that's what mindrop would do. Makes sense to me that having a lootdrop with:

Minimum Drop: 3 Drop Limit: 3 Probability: 100% Multiplier: 1

would give you 3 different items from within that particular loot drop, dependent on their individual drop chance. Whereas:

Minimum Drop: 1 Drop Limit: 1 Probability: 100% Multiplier: 3

would be three separate rolls for the entire lootdrop, which could result in duplicate items being picked. Right now I don't believe there's any difference between the two. Probably because as you say, Live likely doesn't have this behavior anyway.
Reply With Quote
  #5  
Old 05-13-2020, 04:31 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Nope. Not what it is :P
Reply With Quote
  #6  
Old 05-14-2020, 01:30 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

I'd be cool with having this functionality, although I get around it by just splitting the loot tables into multiple lootdrops. Only real issue I have with loottables is how streaky they are (preferring the first and last drop in the table).
__________________
Clumsy's World: Resurgence [2019-Present]
Clumsy's World 2.0 [2014-2016]
Clumsy's World [2006-2012]
Reply With Quote
Reply


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 04:30 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