Yeah, if someone can help me get this system working properly to let NPC quest files access other files, you could probably build a function that includes an array or hash that will convert each race to whatever language you want that race to speak and then have them speak in that language. It might work something like this:
TestNPC.pl
Code:
require "./home/eqemu/server/quests/perl_functions.pl";
Sub EVENT_SAY {
if ($text =~/hail/i)
{
&RacialLanguageSay("Hello, $name!");
}
}
perl_functions.pl
Code:
sub RacialLanguageSay {
my $MyMessage = $_[0]; #Use the Message Supplied to the Function - "$_[0]" means to use the first argument given
my $NPCRace = $npc->GetRace(); #Get the Race of the NPC that is Speaking
# Create a hash of each language that each race should use
%RaceLanguages = (
1 => 1, # NPC Race - Language Note
2 => 2, # NPC Race - Language Note
3 => 3, # NPC Race - Language Note
4 => 4, # NPC Race - Language Note
5 => 5, # NPC Race - Language Note
6 => 5, # NPC Race - Language Note
7 => 5, # NPC Race - Language Note
8 => 6, # NPC Race - Language Note
9 => 7, # NPC Race - Language Note
10 => 8, # NPC Race - Language Note
11 => 9, # NPC Race - Language Note
12 => 9, # NPC Race - Language Note
13 => 9, # NPC Race - Language Note
14 => 2, # NPC Race - Language Note
15 => 3, # NPC Race - Language Note
16 => 4, # NPC Race - Language Note
17 => 12, # NPC Race - Language Note
18 => 15, # NPC Race - Language Note
19 => 15, # NPC Race - Language Note
20 => 15, # NPC Race - Language Note
21 => 19, # NPC Race - Language Note
22 => 19, # NPC Race - Language Note
23 => 19, # NPC Race - Language Note
24 => 2, # NPC Race - Language Note
25 => 3, # NPC Race - Language Note
26 => 4, # NPC Race - Language Note
27 => 5, # NPC Race - Language Note
28 => 6, # NPC Race - Language Note
);
#Note that the above languages and races are just made up as examples
quest::say($MyMessage, $RaceLanguages{$NPCRace});
}
This would then be usable from any of your scripts as long as you added the require (or whatever is ultimately needed) to get your NPC script to read the perl_functions.pl file. Stuff like this is exactly why I want to get this system working. It could allow more flexibility to servers without requiring updates to source code. It might make perl a bit more load, but I don't really know enough to say if it would be a noticeable impact or not.
BTW, here is a page that explains require(), use(), Libaries, Modules and other similar things that might help in getting this to work.
http://www.perl.com/pub/a/2002/05/14...rl.html?page=3
I have tried a few ways, but no luck so far.