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

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-02-2021, 05:08 PM
klausfelix
Fire Beetle
 
Join Date: Jul 2021
Posts: 1
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
__________________
First Motion Products
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 12:51 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