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-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
  #2  
Old 08-10-2008, 09:13 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Maybe there is a GetCorpseByType?
Reply With Quote
  #3  
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
  #4  
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
  #5  
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 01:20 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3