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 09-23-2018, 01:22 PM
Bruser999
Fire Beetle
 
Join Date: Jul 2013
Posts: 4
Default Help With Random Loot Per Kill

Does anyone have a custom code to help with a chance to drop completely random loot after each kill? I have seen some things where it essentially rolls a dice and if you score higher than a number, it puts a piece of gear on the corpse or summons it.

I am new to this coding on the server, so please put it in noon speak.

Wasn’t sure if this was done in the database tables or a .pl or .lua file.
Reply With Quote
  #2  
Old 09-23-2018, 01:29 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

We have global loot tables.
Reply With Quote
  #3  
Old 09-23-2018, 02:30 PM
Bruser999
Fire Beetle
 
Join Date: Jul 2013
Posts: 4
Default

How do you do that? Ultimately just trying to get random loot from any mob in any way shape or form. Wanted to play 1-60 with a few friends and thought it would be fun.
Reply With Quote
  #4  
Old 09-25-2018, 09:31 PM
superpally1
Sarnak
 
Join Date: Jul 2018
Location: Tennessee
Posts: 33
Default

http://wiki.eqemulator.org/p?Diablo_...ster_Reference

And here is the example given in the wikki for using the plugin::AddLoot(amount, chance, @itemarray)

Code:
sub EVENT_SPAWN{
    plugin::AddLoot(1, 1200, 132064); # Drop 1 Minor Rainbow Crystal, 1:1200 drop
    plugin::AddLoot(1, 2750, 132065); # Drop 1 Lesser Rainbow Crystal, 1:2750 drop
    my @item_STONES = (10299, 10300, 10400, 112170);            # Light Stones
    plugin::AddLoot(8, 1, @item_STONES); # Drop 8 from list, 1/1 (100%) Chance, from Array
}
Reply With Quote
  #5  
Old 09-26-2018, 02:03 AM
Anon.GM's Avatar
Anon.GM
Fire Beetle
 
Join Date: Apr 2018
Posts: 19
Default

Here is what I'm running on Anon. I know it could be tweaked better by an expert, but this works. Just change the ids to the range of items you want for the zone.

My default.pl from the zone warrens that drops crude defiant weapons and armor. Its a modified version from this link.

http://www.eqemulator.org/forums/showthread.php?t=38286

Code:
sub EVENT_SPAWN {
  $roll = int(rand(100)) + 1;
  
  $roll_chance = $roll - 70;
  $roll2_chance = $roll - 85;
  $WPlower_limit = 50500;
  $WPupper_limit = 50519;
  $ARlower_limit = 50005;
  $ARupper_limit = 50033;
	
  if($roll >= 85)
  {
       my $itemid = int(rand($WPupper_limit-$WPlower_limit)) + $WPlower_limit;
		#quest::shout("I rolled a $roll have an extra item at $roll_chance percent. Number 1 statement");
        $npc->AddItem($itemid);
		if($roll >= 75 && $mlevel >= 15)
		{
		my $itemid2 = int(rand($ARupper_limit-$ARlower_limit)) + $ARlower_limit;
		#quest::shout("I have rolled higher than 85 an extra item at $roll2_chance percent chance. Number 2 statement");
		$npc->AddItem($itemid2);
		}
	}
	
}
__________________
email:anon.gm@protonmail.com
servers: Anon (bots) and Anon (solo)
Reply With Quote
  #6  
Old 09-26-2018, 12:40 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Quote:
Originally Posted by Bruser999 View Post
How do you do that? Ultimately just trying to get random loot from any mob in any way shape or form. Wanted to play 1-60 with a few friends and thought it would be fun.
If you're using the PEQ editor, hit the loot tab and then global loot. You can hit the plus button to set up the global loot specific stuff. Currently you can't edit the loot table here just yet, but you can go to a dummy NPC and create a loot table there and use that ID. Hopefully this will be resolved at some point :P
Reply With Quote
  #7  
Old 09-29-2018, 07:05 AM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

I've been using this for a few years now. Mostly to prevent the farming of greens for random drops.

Code:
sub EVENT_SPAWN {
  $roll = int(rand(1000)) + 1;

  if($roll >= 995 && $mlevel >= 46) {
    my $itemid=(132522);
    $npc->AddItem($itemid);
  }

  if($roll >= 989 && $roll <= 994 && $mlevel >= 46) {
    my $itemid=(132530);
    $npc->AddItem($itemid);
  }

  if($roll >= 910 && $roll <= 920) {
    my $itemid=(40605);
    $npc->AddItem($itemid);
  }
}

sub EVENT_HATE_LIST {
        if ($hate_state == 1 && $client && $client->GetLevel() > ($mlevel + 10) && $npc->GetEntityVariable("removed") != 1) {
                $npc->RemoveItem(132522);
                $npc->RemoveItem(40605);
                $npc->SetEntityVariable("removed", 1); #so it stops trying to remove the item when more people aggro it
        }
}
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
Reply With Quote
  #8  
Old 09-30-2018, 03:58 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

With the most recent updates to PEQ Editor you can now edit the actual loot tables from the global loot editor.

Hit the Loot tab, then click global loot, and you should be able to add or edit existing global loot entries.


This doesn't do scripted remove like n0ctrnl posted, but it does do the stuff in spawn (and more!)
Reply With Quote
  #9  
Old 10-01-2018, 02:33 AM
Anon.GM's Avatar
Anon.GM
Fire Beetle
 
Join Date: Apr 2018
Posts: 19
Default

Quote:
Originally Posted by demonstar55 View Post
With the most recent updates to PEQ Editor you can now edit the actual loot tables from the global loot editor.

Hit the Loot tab, then click global loot, and you should be able to add or edit existing global loot entries.


This doesn't do scripted remove like n0ctrnl posted, but it does do the stuff in spawn (and more!)

I only use the PEQ editor in EOC and don't see this feature. I guess its coming in the near future? I have been testing the script from N0ctrnl on Anon (Solo) where I also have gobal enabled on defiant. Any other suggestions on how to add to the global loot tables without PEQ? Editing was not a problem just looking up the loot table id's but adding new items manually to the table is what I'm looking for ideas on.
__________________
email:anon.gm@protonmail.com
servers: Anon (bots) and Anon (solo)
Reply With Quote
  #10  
Old 11-19-2020, 09:30 PM
keypusher
Fire Beetle
 
Join Date: Dec 2018
Posts: 2
Default

Is there a working version of this floating around? Links to the old wiki are dead and gitbook has a link to GeorgeS's Tools website, which is also now gone.
Reply With Quote
  #11  
Old 11-21-2020, 05:14 PM
Xirtnil
Fire Beetle
 
Join Date: Oct 2010
Posts: 3
Default

This still seems to work.

Code:
sub EVENT_SPAWN {

   $roll = int(rand(100)) + 1;
   

   $roll_chance = $roll;
   $roll2_chance = $roll;
   if($roll >= 50)
   {
        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);
		
		}
	}
	
}
Reply With Quote
  #12  
Old 02-25-2022, 11:14 AM
deanalee
Fire Beetle
 
Join Date: Feb 2022
Posts: 1
Default

I know it could be tweaked better by an expert, but this works.

Just change the ids to the range of items you want for the zone.

My default.pl from the zone warrens that drops crude defiant weapons and armor.

Its a modified version from this link.

Code:
http://www.eqemulator.org/forums/showthread.php?t=38286
Code:
sub EVENT_SPAWN {
  $roll = int(rand(100)) + 1;
  
  $roll_chance = $roll - 70;
  $roll2_chance = $roll - 85;
  $WPlower_limit = 50500;
  $WPupper_limit = 50519;
  $ARlower_limit = 50005;
  $ARupper_limit = 50033;
	
  if($roll >= 85)
  {
       my $itemid = int(rand($WPupper_limit-$WPlower_limit)) + $WPlower_limit;
		#quest::shout("I rolled a $roll have an extra item at $roll_chance percent. Number 1 statement");
        $npc->AddItem($itemid);
		if($roll >= 75 && $mlevel >= 15)
		{
		my $itemid2 = int(rand($ARupper_limit-$ARlower_limit)) + $ARlower_limit;
		#quest::shout("I have rolled higher than 85 an extra item at $roll2_chance percent chance. Number 2 statement");
		$npc->AddItem($itemid2);
		}
	}
	
}
__________________
AMC Lighting and Decor Inc.
Reply With Quote
  #13  
Old 02-25-2022, 11:30 AM
Firepaw's Avatar
Firepaw
Fire Beetle
 
Join Date: Dec 2012
Location: USA
Posts: 4
Smile

Heres a simple way of doing that where level is taken into account.

Note youll have to change some of it since its tailored to a custom server but left in comments to debug and explain what each part does



Code:
function event_spawn(e)
	local levelMod = math.ceil(e.self:GetLevel()/10);
	local ran = math.random(1,100);
	--e.self:Shout(tostring(levelMod)); debug
	if (ran > 90) then
		--local levelMod = math.ceil(e.self:GetLevel()/10);
		local ran2 = math.random(0,52);
                --which item in the tier drops, had 52 items in each tier

		--e.self:Shout(tostring(ran2)); debug
		if (ran < 99) then
			levelMod = levelMod - 1;
		end
		if (levelMod > 7) then
			levelMod = 7;
		end
		local lootdrop = levelMod * 52 + ran2 + 300000;
                -- decides what item goes on a mob. first item I wanted to drop was 300,000 ... 52 * tier

		--e.self:Shout(tostring(lootdrop)); debug
		e.self:AddItem(lootdrop, -1);
                --gives mob item

		--e.self:Shout(tostring(levelMod)); debug
	end
end
Reply With Quote
  #14  
Old 03-29-2022, 11:39 AM
jasperarrow
Fire Beetle
 
Join Date: Mar 2022
Posts: 1
Default

With the most recent updates to PEQ Editor you can now edit the actual loot tables from the global loot editor.

Hit the Loot tab, then click global loot, and you should be able to add or edit existing global loot entries.


This doesn't do scripted remove like n0ctrnl posted, but it does do the stuff in spawn (and more!)
__________________
Seahorse Swim School
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 09:37 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