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 08-08-2008, 07:16 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default $EntityList->DeleteNPCCorpses();

Does anyone know if it is possible to make quests so that an NPC will delete it's own corpse when it dies? I have many cases where mobs don't have loot for certain reasons and I would love if I could just make the corpses automatically poof when they die. One case is a zone that is purely for experience, so it has no loot. People like to AE in there alot, but it causes quite a heavy load on my server and the zone can crash sometimes. Another reason is for adds that spawn during certain encounters that don't have any loot, and their corpses can cause lag to players after too many build up. So, these are 2 good reasons why I would love to just have the corpses vanish.

So far, I have tried:

Code:
sub EVENT_DEATH {

#quest::depop();
#$Corpse->Delete(2700660);
$EntityList->GetCorpseByID(2700660);
$NPC->DeleteNPCCorpses();

}
And a couple of other ways, but none seem to work. If there isn't currently a way to do it, then it might be a good idea for some new custom code to write. I think this would come in handy on pretty much every server in certain cases.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 08-08-2008, 01:37 PM
spoon
Sarnak
 
Join Date: Aug 2007
Posts: 34
Default

you might try something like:
Code:
sub EVENT_DEATH {
  $c = $entity_list->GetCorpseByID(2700660);
  if ($c) {
    $c->Delete();
  }
or
Code:
sub EVENT_DEATH {
  $c = $entity_list->GetCorpseByID(2700660);
  if ($c) {
    $c->SetDecayTimer(1);
  }
There probably is a better way though.
Reply With Quote
  #3  
Old 08-09-2008, 04:03 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Thanks for the suggestions. I tried them and can't seem to get them to work. I will keep messing with it, but if anyone has a better solution, let me know, please
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 08-09-2008, 05:09 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I have tried quite a few more combinations, but can't seem to get it to work at all. Even if I put it in EVENT_ATTACK and have another corpse of the same NPC nearby, it won't delete the nearby corpse. The script below has many commented out sections of some of the quest objects I have tried with no luck so far.

Test Script:

Code:
#depop corpses

sub EVENT_ATTACK {

#$EntityList->DeleteNPCCorpses(2700660);

#$c = $EntityList->GetCorpseByID(2700660);
#  if ($c) {
#    $c->RemoveAllCorpses(); }

#$EntityList->RemoveCorpse(2700660);

my $deadnpc = $EntityList->GetCorpseByID(2700660);

  if ($deadnpc) {
    my $delete_corpse = $deadnpc->CastToCorpse();
    $delete_corpse->SetDecayTimer(1);
    quest::say ("$deadnpc"); }

}

sub EVENT_DEATH {

#my $c;

#quest::depop();
#$Corpse->Delete(2700660);
#$EntityList->GetCorpseByID(2700660);
#$EntityList->DeleteNPCCorpses(2700660);

#$c = $EntityList->GetCorpseByID(2700660);
#  if ($c) {
#    $c->SetDecayTimer(1); }

}
Also, I wanted to note that the suggestion example from spoon shows:

Code:
  $c = $entity_list->GetCorpseByID(2700660);
But, I think it is supposed to be:

Code:
  $c = $EntityList->GetCorpseByID(2700660);
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 08-09-2008, 09:51 AM
Andrew80k
Dragon
 
Join Date: Feb 2007
Posts: 659
Default

Quote:
Originally Posted by trevius View Post
I have tried quite a few more combinations, but can't seem to get it to work at all. Even if I put it in EVENT_ATTACK and have another corpse of the same NPC nearby, it won't delete the nearby corpse. The script below has many commented out sections of some of the quest objects I have tried with no luck so far.

Test Script:

Code:
#depop corpses

sub EVENT_ATTACK {

#$EntityList->DeleteNPCCorpses(2700660);

#$c = $EntityList->GetCorpseByID(2700660);
#  if ($c) {
#    $c->RemoveAllCorpses(); }

#$EntityList->RemoveCorpse(2700660);

my $deadnpc = $EntityList->GetCorpseByID(2700660);

  if ($deadnpc) {
    my $delete_corpse = $deadnpc->CastToCorpse();
    $delete_corpse->SetDecayTimer(1);
    quest::say ("$deadnpc"); }

}

sub EVENT_DEATH {

#my $c;

#quest::depop();
#$Corpse->Delete(2700660);
#$EntityList->GetCorpseByID(2700660);
#$EntityList->DeleteNPCCorpses(2700660);

#$c = $EntityList->GetCorpseByID(2700660);
#  if ($c) {
#    $c->SetDecayTimer(1); }

}
Also, I wanted to note that the suggestion example from spoon shows:

Code:
  $c = $entity_list->GetCorpseByID(2700660);
But, I think it is supposed to be:

Code:
  $c = $EntityList->GetCorpseByID(2700660);
Have you tried $entity_list? If you look in the quest Objects wiki it uses it like that in the examples. And I have also seen it in other working quests like that.
Reply With Quote
  #6  
Old 08-09-2008, 11:08 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

I remember I had a hell of a time trying to use Perl to work with corpses before the graveyard/shadowrest system was put into place. Finally, I just gave up and convinced Wildcard to implement the graveyard (and then he became inspired and threw in SR for the hell of it - I do miss Wild!) Sadly, you don't have this option. Though, I too would like to see empty NPC corpses delete after a few seconds like on Live.
Reply With Quote
  #7  
Old 08-10-2008, 04:15 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I am getting closer! At least now I can get the corpse to actually delete or decay using one of these 2 options:

Delete Corpse:
Code:
my $deadnpc = $entity_list->GetCorpseByName("Tiny_Albino_Rat's corpse445");

  if ($deadnpc) {
    my $delete_corpse = $deadnpc->CastToCorpse();
    $delete_corpse->Delete(); }
    
    quest::say ("$deadnpc");

}
Decay Corpse after 1 Second:
Code:
my $deadnpc = $entity_list->GetCorpseByName("Tiny_Albino_Rat's corpse445");

  if ($deadnpc) {
    my $delete_corpse = $deadnpc->CastToCorpse();
    $delete_corpse->SetDecayTimer(1); }
    
    quest::say ("$deadnpc");

}
This option works as well for specifying the corpses:
Code:
my $deadnpc = $entity_list->GetCorpseByID(631);
Now, if I can just figure out how to do it without having to be so specific as to put the exact name or ID I want to delete... I will keep you all informed if I come up with a solution.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #8  
Old 08-10-2008, 04:37 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

This is promising! This isn't exactly what I want just yet, but I think it can definitely be useful. This will delete all corpses in the zone:

Code:
$entity_list->DeleteNPCCorpses();
I still want to be able to specify which ones I want to delete.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #9  
Old 08-10-2008, 04:58 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Maybe this can help for automatically poofing empty corpses:

Code:
$corpse->IsEmpty();
Now, if I can only figure out how to make them target their own corpse when they die, or something to that effect.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #10  
Old 08-10-2008, 07:14 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

This seems to work to only delete the corpse if it is empty:
Code:
my $deadnpc = $entity_list->GetCorpseByName("Tiny_Albino_Rat's corpse423");

  if ($deadnpc->IsEmpty()) {
    my $delete_corpse = $deadnpc->CastToCorpse();
    $delete_corpse->SetDecayTimer(1); }
The only thing left is to figure out how to select corpses without having to provide an exact name or entity ID number.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #11  
Old 08-10-2008, 09:13 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

Maybe there is a GetCorpseByType?
Reply With Quote
  #12  
Old 08-10-2008, 09:04 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I am just going off of the list of Quest Objects from the Wiki here:

http://www.eqemulator.net/wiki/wikka...a=QuestObjects

I don't see anything there that will do what I need exactly. Unless maybe more were added that just aren't in the Wiki yet.

What I really need is either a way for an NPC to somehow identify it's corpse via exact name or entity ID, or a way to have the script look at all corpses in the zone.

I am not at home right now, but maybe something like this would work to have it check all corpses in the zone:

Code:
my $deadnpc = $entity_list->IsNPCCorpse();

  if ($deadnpc->IsEmpty()) {
    my $delete_corpse = $deadnpc->CastToCorpse();
    $delete_corpse->SetDecayTimer(1); }
I am doubtful, as I don't think that is actually getting anything, but rather for checking if it is a corpse or not. I will test it later tonight. But, I am definitely open to suggestions
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #13  
Old 08-11-2008, 04:36 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Woot! I finally figured it out!

http://www.eqemulator.net/forums/sho...131#post154131

Now, I just need to do some in depth testing on it. My only concern is the variables possibly being used by multiple NPCs and causing the IDs to not match up. But, so far my testing shows that it at least works!
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #14  
Old 08-11-2008, 07:24 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

So far, I can only get this working on individual NPCs. The problem is here:

Code:
#Adjustable Corpse Decay Timer Script
#Decay Timer Is in Milliseconds
#This will only work on Empty corpses

my $entity_id;

sub EVENT_SPAWN {

$entity_id=$npc->GetID();

}

sub EVENT_DEATH {
   
my $corpse_id = $entity_list->GetCorpseByID($entity_id);

  if ($corpse_id->IsEmpty()) {
    my $corpse_decay = $corpse_id->CastToCorpse();
    $corpse_decay->SetDecayTimer(5000); }
 
}
That will get the entity ID when the NPC spawns and save it for use later when it dies. Unfortunately, it doesn't work right with multiple mobs yet. Without the use of "my", the variable becomes global and gets messed up when other NPCs try to use the same variable at the same time. Unfortunately "my" will limit the variable to the section that it is defined in, so if it is defined in EVENT_SPAWN, then EVENT_DEATH won't see it. I need a way for the whole quest to be able to see the variable without having ALL NPCs with the same quest sharing variables. And, I can't set "my" before the EVENTs, because at that point the Entity ID isn't set yet.

I have been able to get it working a little better by pulling the Entity ID in EVENT_ATTACK, but if you fight more than 1 at a time, only the first one to die will use the custom decay timer.

I also found that $mobid returns the entity ID as well. So, that could be used in place of:

Code:
my $corpse_id = $entity_list->GetCorpseByID($entity_id);
The only problem with this is that apparently the mobid is 0 when the EVENT_DEATH actually happens.

I would love to get something working that I can put in the default.pl file so that it is used server-wide for empty corpses. But, I will first need a way to save a variable for use later on.

At least I am making some progress lol. I have also been looking in the source to see if I can figure out how to just make a rule so we can just set a decay time for all empty corpses. But, I think that may be out of my skill range, so I am sticking with the quest way of doing it for now.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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:41 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