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 12-01-2015, 01:44 PM
JimB_1958
Sarnak
 
Join Date: Mar 2013
Location: Springfield MO
Posts: 66
Default Who or what killed me?

I can't seem to find what I am wanting to do. I thought it would be simple and it probably is. Just not today.

I would like to get the ID and eventually the name of the creature that killed a player.

In case of PvP the killing player would be nice. If that's not possible, then maybe just a true/false that it was a another player

All other deaths marked as "from an unknown source" or the like
__________________
"We are all on the same team, and I think not enough people realize this."
- Leetsauce
Reply With Quote
  #2  
Old 12-01-2015, 02:12 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

"Killer variables," says Secrets.
Code:
$killer_damage
$killer_id
$killer_skill
$killer_spell
Something like this can be done for players killed by players.
Code:
sub EVENT_DEATH_COMPLETE {
    if ($entity_list->GetMobByID($killer_id) && $entity_list->GetMobByID($killer_id)->IsClient()) {
        ##Do whatever
    }
}
Reply With Quote
  #3  
Old 12-02-2015, 12:25 AM
JimB_1958
Sarnak
 
Join Date: Mar 2013
Location: Springfield MO
Posts: 66
Default

I fiddled around with a bunch of different things and could not get any of them to work until I stumbled into this:

Code:
sub EVENT_DEATH_COMPLETE{

	my $whokilledme = "an unknown hand";
	my $mobid = $entity_list->GetMobID($killer_id);
	$whokilledme= $mobid->GetCleanName();
		
	quest::gmsay("$name the $class has just been killed in $zoneln by $whokilledme ", 335, 1, 0, 0);
	
}
Oddly enough it works for both mobs and pc kills. Only drawback is if the player dies by drowning, falling or anything but a pc or mob there is no text at all.
__________________
"We are all on the same team, and I think not enough people realize this."
- Leetsauce
Reply With Quote
  #4  
Old 12-02-2015, 08:10 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

The reason GetCleanName() works on PCs and NPCs is because GetCleanName() is a Mob method that PCs and NPCs inherit through subclass inheritance. Try this:
Code:
sub EVENT_DEATH_COMPLETE {
    quest::gmsay("$name the $class has just been killed in $zoneln by " . ($entity_list->GetMobByID($killer_id) ? $entity_list->GetMobByID($killer_id)->GetCleanName() : "an unknown hand") . ".", 335, 1, 0, 0);    
}
Reply With Quote
  #5  
Old 12-02-2015, 09:07 AM
JimB_1958
Sarnak
 
Join Date: Mar 2013
Location: Springfield MO
Posts: 66
Default

Awesome! Thanks Kingly. When I had the practice toon nuke himself I got this message:

Zeppa the Ranger has just been killed in the Overthere by Zeppa

This is perfect.
__________________
"We are all on the same team, and I think not enough people realize this."
- Leetsauce
Reply With Quote
  #6  
Old 12-02-2015, 09:14 AM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

You're welcome, I'm glad you got it worked out! Always happy to be of assistance.
Reply With Quote
  #7  
Old 12-02-2015, 01:14 PM
JimB_1958
Sarnak
 
Join Date: Mar 2013
Location: Springfield MO
Posts: 66
Default

My final Code

Code:
sub EVENT_DEATH_COMPLETE {

   if($ulevel >= 85){  #Avoid Newbie Death Spam
	 if(!defined $qglobals{DeathSpam}) {  #Avoid Nimrod Death Spam
		quest::gmsay("$name the $class has just been killed in $zoneln by " . ($entity_list->GetMobByID($killer_id) ? $entity_list->GetMobByID($killer_id)->GetCleanName() : "an unknown hand") . ".", 335, 1, 0, 0);    
		quest::setglobal("DeathSpam","1",5,"M10");
   }		
} 

}
Thanks again
__________________
"We are all on the same team, and I think not enough people realize this."
- Leetsauce
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 03:32 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