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 06-05-2016, 06:53 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default Trivial random loot help

I use a variation of the following to add a random item to an NPC when it spawns (from global_npc.pl):

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

  if($roll >= 90) {
    my $itemid=(132522);

    $npc->AddItem($itemid);
  }
}
What I would like to do is to remove the item if a player is too many levels over the NPC when they loot the corpse. Is there a way to key off of that? I know there's a $corpse->RemoveItem(); I could use, but what would I trigger on? It looks like EVENT_LOOT is only when an item is plucked.

Any help is appreciated Just can't come up with a good way to do this so far.
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
Reply With Quote
  #2  
Old 06-06-2016, 05:53 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

This is what I went with. It's not perfect, but it's good enough for my uses.

Code:
sub EVENT_DEATH {
  if ($ulevel > ($mlevel + 15)) {
    $npc->RemoveItem(132522);
  }
}
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
Reply With Quote
  #3  
Old 06-06-2016, 06:38 PM
DanCanDo's Avatar
DanCanDo
Discordant
 
Join Date: May 2016
Location: Above Hell
Posts: 400
Default

Nice, this is something to help with a different idea I wanted to experiment with.
What I want to have happen, is when a certain lower level mob is killed, there
would be a mob spawn from EVENT_DEATH, but the spawned mob would be at a
level closer to the toon that killed the PH.
In a nutshell, for example, if a level 15 kills the PH, the mob that spawns would
be 15-20'ish. But if a level 40 toon kills the PH, it would spawn a level 40-45'ish
mob.
Reply With Quote
  #4  
Old 06-06-2016, 07:01 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

What I had hoped to do was remove the drop if a higher level even got on the hatelist - which would be the right way do to it - but that's above my skill level to figure out. Assuming it's even possible
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
Reply With Quote
  #5  
Old 06-06-2016, 07:11 PM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
Default

Quote:
Originally Posted by N0ctrnl View Post
What I had hoped to do was remove the drop if a higher level even got on the hatelist - which would be the right way do to it - but that's above my skill level to figure out. Assuming it's even possible
It's possible.
You could verify it by adding this code: (found in http://wiki.eqemulator.org/p?Ultimate_Perl_Reference)
Code:
 my @hatelist = $npc->GetHateList();
        foreach $ent (@hatelist) {
            my $h_ent = $ent->GetEnt();  # do not forget GetEnt() or the script halts!
            my $h_dmg = $ent->GetDamage();
            my $h_hate = $ent->GetHate();
            if($h_ent) {
                my $h_ent_name = $h_ent->GetCleanName();
                quest::say("$h_ent_name is on my hate list with $h_hate hate and $h_dmg damage.");
            }
        }
$npc may not be set, so may need to get the entity and cast it over, but if the hate list isn't wiped out before DEATH event is triggered, the above code lets you iterate it's hate list.

Then, just change the code logic to get each entity's level and remove loot if a higher level is there.
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
  #6  
Old 06-06-2016, 07:13 PM
DanCanDo's Avatar
DanCanDo
Discordant
 
Join Date: May 2016
Location: Above Hell
Posts: 400
Default

I can't remember for the life of me, but way back on eqlive, I seem to remember some kind of named that dropped something for a specific class and if the wrong class killed the named, the item would not drop ? I'm not 100% positive on that. (memory fizzles a lot).
Reply With Quote
  #7  
Old 06-06-2016, 08:11 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

This should work for you...

Code:
sub EVENT_HATE_LIST {
	if ($hate_state == 1 && $client && $client->GetLevel() > ($mlevel + 15) && $npc->GetEntityVariable("removed") != 1) {
		$npc->RemoveItem(132522);
		$npc->SetEntityVariable("removed", 1); #so it stops trying to remove the item when more people aggro it
	}
}
Reply With Quote
  #8  
Old 06-07-2016, 05:12 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

Quote:
Originally Posted by NatedogEZ View Post
This should work for you...

Code:
sub EVENT_HATE_LIST {
	if ($hate_state == 1 && $client && $client->GetLevel() > ($mlevel + 15) && $npc->GetEntityVariable("removed") != 1) {
		$npc->RemoveItem(132522);
		$npc->SetEntityVariable("removed", 1); #so it stops trying to remove the item when more people aggro it
	}
}
simple and elegant
__________________
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
  #9  
Old 06-07-2016, 05:26 PM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

That is exactly what I was trying to get to. Thanks Natedog
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
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 02:19 AM.


 

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