FunkySwerve
Joined: 02 Jun 2005 Posts: 377
|
Posted: Tue Nov 28, 2006 18:49 Post subject: |
|
|
I'll be including a tutorial in the second version. You need to decide which of your subraces speak what languages, by adding them in the config script. Alternately you can add a language teach to your mod, as demonstrated in the SIMTools demo mod. A character's knowledge of a language is stored either on a language stone, if you are using the Bioware database, or in the pwdata database if using NWNX databasing. When a character enters the mod, they are checked to see if they have undergone languages setup (again this variable is stored with the languages, either on the stone or in the database). If not, SIMTools checks the characters class/es and subrace, and 'teaches' them the languages they should know, by setting variables (again, on the stone or in the database. It also sets matching local variables on the character, because thats what SIMTools uses for speed and convenience when handling speaking and listening.. Whenever a character logs in, the persistent data from the stone or database is mapped onto local variables for this reason.
If you want characters to be able to use languages other than those you designate for their race in the config file, you'll need to add a teacher to the mod. As mentioned above, the SIMTools demo mod has a sample teacher. Most of such a conversation would be straightforward scripting/toolsetting. When the teacher is supposed to 'teach' the languages, you would simply set persistent data, either as a local variable on the language stone (locals on inventory objects are saved with the bic on servervaults, making them persistent) if using the Bioware database, or as a persistent variable using the standard aps_include calls. Here's an example of teaching the pc speaker language 32 (drow):
Code: | #include "fky_chat_inc"
void main()
{
object oPC = GetPCSpeaker();
if (USING_NWNX_DB)
{
SetLocalInt(oPC, "FKY_CHAT_LANG32", TRUE);
SetPersistentInt(oPC, "FKY_CHAT_LANG32", TRUE);
}
else
{
object oStorage = GetItemPossessedBy(oPC, TAG_OF_LANGUAGE_STORAGE_OBJECT);
SetLocalInt(oPC, "FKY_CHAT_LANG32", TRUE);
SetLocalInt(oStorage, "FKY_CHAT_LANG32", TRUE);
}
} |
You can figure out which language is what number by looking at any of serveral different functions in SIMTools, though GetLanguageNumber is probably the easiest:
Code: | int GetLanguageNumber(string sName)
{
int nText = FindSubString(" dwarven elven gnomish halfling drow animal cant goblin orcish draconic infernal abyssal celestial leetspeak common", sName);
//1 9 15 23 32 37 44 49 56 63 72 81 89 99 109
if (nText == -1)
{ //second set of languages courtesy of Lanessar and the Myth Drannor PW
nText = FindSubString("a c d g h i l m n o r s t u v", GetStringLeft(sName, 1));
switch (nText) //0 2 4 6 8 10121416182022242628
{
case 0:
if (sName == "algarondan") nText = 2;
else if (sName == "alzhedo") nText = 3;
else if (sName == "aquan") nText = 4;
else if (sName == "assassin") nText = 5;
else if (sName == "auran") nText = 6;
else nText = -1;
break;
case 2:
if (sName == "chessentan") nText = 7;
else if (sName == "chondathan") nText = 8;
else if (sName == "chultan") nText = 10;
else nText = -1;
break;
case 4:
if (sName == "damaran") nText = 11;
else if (sName == "dambrathan") nText = 12;
else if (sName == "drowsign") nText = 13;
else if (sName == "druidic") nText = 14;
else if (sName == "durpari") nText = 16;
else nText = -1;
break;
case 6:
if (sName == "giant") nText = 17;
else if (sName == "gnoll") nText = 18;
else nText = -1;
break;
case 8:
if (sName == "halardrim") nText = 19;
else if (sName == "halruaan") nText = 20;
else nText = -1;
break;
case 10:
if (sName == "ignan") nText = 21;
else if (sName == "illuskan") nText = 22;
else if (sName == "imaskar") nText = 24;
else nText = -1;
break;
case 12:
if (sName == "lantanese") nText = 25;
else nText = -1;
break;
case 14:
if (sName == "midani") nText = 26;
else if (sName == "mulhorandi") nText = 27;
else nText = -1;
break;
case 16:
if (sName == "nexalan") nText = 28;
else nText = -1;
break;
case 18:
if (sName == "oillusk") nText = 29;
else nText = -1;
break;
case 20:
if (sName == "rashemi") nText = 30;
else if (sName == "raumvira") nText = 31;
else nText = -1;
break;
case 22:
if (sName == "serusan") nText = 33;
else if (sName == "shaaran") nText = 34;
else if (sName == "shou") nText = 35;
else if (sName == "sylvan") nText = 36;
else nText = -1;
break;
case 24:
if (sName == "talfiric") nText = 38;
else if (sName == "tashalan") nText = 39;
else if (sName == "terran") nText = 40;
else if (sName == "treant") nText = 41;
else if (sName == "tuigan") nText = 42;
else if (sName == "turmic") nText = 43;
else nText = -1;
break;
case 26:
if (sName == "uluik") nText = 45;
else if (sName == "undercommon") nText = 46;
else if (sName == "untheric") nText = 47;
else nText = -1;
break;
case 28:
if (sName == "vaasan") nText = 48;
else nText = -1;
break;
}
}
return nText;
} |
Let me know if you have any other questions. Feel free to post in the SIMTools tech support foirums, you'll get a faster response there as I check them many times a day:
http://highergroundpoa.proboards3.com/index.cgi
Funky |
|