Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

Reply
 
Thread Tools Display Modes
  #1  
Old 06-30-2009, 05:38 PM
Dibalamin
Hill Giant
 
Join Date: Dec 2007
Posts: 182
Default

Hell yeah Shendare, thanks for sharing!
__________________
Retired EMarr
Project1999 Developer
Reply With Quote
  #2  
Old 07-01-2009, 12:44 AM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

UPDATE:

Missed a step in fixNPCName(). To fix the sub to have it assume the current NPC's name as the parameter if omitted, use the following version:

File: plugins\npc_tools.pl
Code:
# Change names like 'a_skeleton005' into 'a skeleton'
sub fixNPCName
{
  $_ = shift;
  
  if (!defined($_))
  {
    $_ = plugin::val('$mname');
  }
  
  s/\d+$//; # Strip trailing numeric digits
  s/\_/ /g; # Change underscores to spaces
  
  return $_;
}
Also, for Soulbinders, Merchants, and Guards default actions to work, the "\w" entries in the regular expressions should be "\s". My bad.

Finally, to clarify for those new to quest scripting, the file I referred to as "plugins\default-npc.pl" in the main post must be copied into your server's "quests" directory as "default.pl" in order to be processed on all NPCs.

- Shendare
Reply With Quote
  #3  
Old 07-01-2009, 01:45 AM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

One more update, this one for the default-npcs.pl (aka default.pl).

EVENT_SLAY should be followed by EVENT_NPC_SLAY, which would call the same function:

File: quests\default.pl
Code:
sub EVENT_SLAY
{
  plugin::defaultSlay();
}

sub EVENT_NPC_SLAY
{
  plugin::defaultSlay();
}
I forgot that EVENT_SLAY is only called when an NPC kills a player. EVENT_NPC_SLAY is what's called when an NPC kills another NPC.
Reply With Quote
  #4  
Old 07-01-2009, 05:27 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Thank you very much for this top notch work! I sent you a PM on the PEQ forums.
Reply With Quote
  #5  
Old 07-01-2009, 10:22 PM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

UDPATE: Improved npc_tools.pl

I came up with a much more efficient and extensible method for humanoid().

File: plugins\npc_tools.pl
Code:
#
# plugins\npc_tools.pl
# 
# NPC-related Helper Functions
#

# 1 = Humanoid
%raceFlags = (
  1=>1, 2=>1, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1, 9=>1, 10=>1, 11=>1, 12=>1, 15=>1, 16=>1, 18=>1, 23=>1, 25=>1, 26=>1, 44=>1,
  55=>1, 56=>1, 62=>1, 64=>1, 67=>1, 71=>1, 77=>1, 78=>1, 79=>1, 81=>1, 88=>1, 90=>1, 92=>1, 93=>1, 94=>1,
  101=>1, 106=>1, 110=>1, 112=>1, 128=>1, 130=>1, 131=>1, 139=>1, 140=>1,
  150=>1, 151=>1, 153=>1, 188=>1, 189=>1,
  236=>1, 238=>1, 239=>1, 242=>1, 243=>1, 244=>1,
  251=>1, 278=>1, 296=>1, 299=>1,
  330=>1, 331=>1, 332=>1, 333=>1, 334=>1, 335=>1, 336=>1, 337=>1, 338=>1, 339=>1, 340=>1, 341=>1, 342=>1, 343=>1, 344=>1, 345=>1, 346=>1, 347=>1,
  385=>1, 386=>1, 
  403=>1, 406=>1, 407=>1, 408=>1, 411=>1, 417=>1, 433=>1,
  453=>1, 454=>1, 455=>1, 457=>1, 458=>1, 461=>1, 464=>1, 466=>1, 467=>1, 473=>1, 475=>1, 476=>1, 478=>1, 487=>1, 488=>1, 489=>1, 490=>1, 495=>1, 496=>1, 497=>1, 498=>1, 499=>1,
  520=>1, 521=>1, 522=>1, 523=>1, 524=>1, 527=>1, 529=>1, 532=>1,
  562=>1, 563=>1, 564=>1, 565=>1, 566=>1, 568=>1, 575=>1, 576=>1, 579=>1
);
  
# Change names like 'a_skeleton005' into 'a skeleton'
sub fixNPCName
{
  $_ = shift;
  
  if (!defined($_))
  {
    $_ = plugin::val('$mname');
  }
  
  s/\d+$//; # Strip trailing numeric digits
  s/\_/ /g; # Change underscores to spaces
  
  return $_;
}

# Returns 1 if the mob's race is humanoid, 0 if not. Race number argument optional, will use current NPC if omitted.
# So far mainly used to identify races that can be expected to speak to the player.
sub humanoid
{
  my $race = shift;
  
  if (!defined($race))
  {
    my $mob = plugin::var('$mob');
    
    $race = $mob->GetRace();
  }

  return (plugin::nullzero($raceFlags{$race}) & 1) ? 1 : 0;
}

# Associative name an NPC can use when talking to the player (friend, stranger, Dark Elf, etc.)
sub assocName
{
  my $faction = plugin::val('$faction');
  
  return (plugin::val('$status') > 20) ? 'boss' :
         ($faction < 3) ? plugin::val('$name') :
         ($faction < 5) ? 'friend' :
         ($faction < 7) ? 'stranger' : plugin::val('$race');
}
Reply With Quote
Reply

Thread Tools
Display Modes

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:27 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