View Single Post
  #3  
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