Author Topic: Language Clerk Conversation  (Read 602 times)

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Language Clerk Conversation
« Reply #15 on: April 22, 2011, 10:05:06 pm »


               Maybe he wants to use a big convoluted unnecessary script? ':lol:'

Ok ok. So I was waaay overthinking things as usual. However he did say he wanted it capped at 30. If that is the case then definitely still use Lightfoots version but maybe like this?


int GetIntBonus(object oPC)
{
    int iIntelligence = GetAbilityScore(oPC,ABILITY_INTELLIGENCE,TRUE);
    if (iIntelligence > 30) return 10;
    else return  (iIntelligence - 10) / 2;

               
               

               


                     Modifié par GhostOfGod, 22 avril 2011 - 09:06 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Language Clerk Conversation
« Reply #16 on: April 22, 2011, 10:21:28 pm »


               Hmm..actually thinking about the above....if the intelligence is 11 will (iIntelligence - 10) / 2; round up to a 1? Maybe GetAbilityModifier would work better?

Edit: Nevermind. Everything after the decimal is ignored. I need some coffee....where's the coffee?
               
               

               


                     Modifié par GhostOfGod, 22 avril 2011 - 09:28 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Language Clerk Conversation
« Reply #17 on: April 22, 2011, 10:52:29 pm »


               The Only real draw back to GetAbilityModifier is that I seen no way to force it to get the bonus from the unmodified intelligence score.   If he is wanting to use the modified scores it will work great.
               
               

               
            

Legacy_Evelath

  • Full Member
  • ***
  • Posts: 108
  • Karma: +0/-0
Language Clerk Conversation
« Reply #18 on: April 25, 2011, 09:06:48 am »


               Alrighty, so I feel like I continue to complicate things as I progress! '<img'>

What would be involved if I wanted to have only certain languages involved in the selection?

For example, if I wanted to allow a player with 10 INT to choose 1 regional language (and also ensure they get their racial language), how would I go about doing that without interferring with the function that is getting the number of items in their inventory?

I've noticed "case" and "break" statements, would this involve those?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Language Clerk Conversation
« Reply #19 on: April 30, 2011, 04:34:56 am »


               Question: do all PC's get a racial language?   or at least all PC that are not human ?  Or do even some of the humans get racical languages?  
I  guess I do not reall need that answered, 

I would start by first setting up some constants for the languages, with a few functions in an include file so you dont have to keep looking things up.   I assume you are useing the DMFI languages, If so you could do something like this. 

const int LANGUAGE_ELVEN    = 1;
const int LANGUAGE_GNOME    = 2;
const int LANGUAGE_HALFLING =3;
const int LANGUAGE_DWARVEN  = 4;
const int LANGUAGE_ORC      = 5;
const int LANGUAGE_GOBLIN   = 6;
const int LANGUAGE_DRACONIC = 7;
const int LANGUAGE_ANIMAL   = 8;
const int LANGUAGE_CANT     = 9;
const int LANGUAGE_CELESTIAL = 10;
const int LANGUAGE_ABYSSAL   = 11;
const int LANGUAGE_INFERNAL  = 12;
const int LANGUAGE_DROW      = 13;
const int LANGUAGE_SYLVAN    = 14;// Extra 0 in the resref.
const int LANGUAGE_RASHEMI   = 15;//Extra 0 in the resref.
const int LANGUAGE_MULHORANDI= 16;//Extra 0 in the resref.
  
int GetIntBonus(object oPC);
  
// Gets the number og languages the PC already has.
int  GetNumLanguages(object oPC);

//Gets the tag for the given LANGUAGE_*
string GetLanguageTag(int nLangConstant);
  

//Gets the tag for the given LANGUAGE_*
string GetLanguageResRef(int nLangConstant);
  
// gets the number of languages the PC is allowed to have.
int GetNumAllowedLang(object oPC);
  
int GetIntBonus(object oPC)
{
 return  (GetAbilityScore(oPC,ABILITY_INTELLIGENCE,TRUE)-10)/2;
}
  
string GetLanguageTag(int nLangConstant)
{
  return "hlslang_" + IntToString(nLangConstant);
}
  

string GetLanguageResRef(int nLangConstant)
{
  string sPrefix = "hlslang_";
  if (nLangConstant > 13 && nLangConstant < 17) sPrefix += "0";
  return  "hlslang_" + IntToString(nLangConstant);
}
  

int  GetNumLanguages(object oPC)
{
     int nCount;
  
     object oInv = GetFirstItemInInventory(oPC);
     while (GetIsObjectValid(oInv))
     {
        if(GetStringLeft(GetTag(oInv), 8) == "hlslang_") nCount++;
        oInv = GetNextItemInInventory(oPC);
     }
     return nCount;
}
   
int GetNumAllowedLang(object oPC)
{
  int nNumLang = GetIntBonus( oPC) +1;
    
  // Assuming that all races except humans get
  //there racial language free.
  if ( GetAppearanceType(oPC)!=APPEARANCE_TYPE_HUMAN)nNumLang++;
  return nNumLang;
}
 



Hope that helps some. 
               
               

               
            

Legacy_Evelath

  • Full Member
  • ***
  • Posts: 108
  • Karma: +0/-0
Language Clerk Conversation
« Reply #20 on: April 30, 2011, 03:11:16 pm »


                First off, thank you so much for taking the time to help me out '<img'>

I am using the DMFI, however I had found another vault entry (it escapes me now, as I am at work) that essentially follows the came concept line as DMFI ("hlslang_"), only includes regional languages for Faerun (Chondanthan for example).  Would I simply follow the same concept that you presented, by declaring the additional language constants and utilizing the same script?

For example:

A human character enters the server, he receives no language tokens.
He is allowed to choose a total of TWO languages, one of which being a regional language, the other being a different (ie: Drow) language?

Meanwhile, an elven character would automatically get the Elven Token, and also be able to select two languages, similar to the Human.

Just want to clarify it, thanks again for helping me with this, as it is one of the last systems that I need to implement in terms of scripting for the PW.  '<img'>
               
               

               
            

Legacy_Evelath

  • Full Member
  • ***
  • Posts: 108
  • Karma: +0/-0
Language Clerk Conversation
« Reply #21 on: May 16, 2011, 04:28:05 pm »


               So I've been tinkering with this script still.  The final function you included increased the number of learnable languages by 1 if the PC was not human.  Would it be fair to say that following that same formula with classes would be just as feasible?  My goal is to implement several class-specific languages (ie: Assassin's Cant), however still grant the player the option to choose his own languages.

Would this work? (away from toolset):


int GetNumAllowedLang(object oPC)
{
  int nNumLang = GetIntBonus( oPC) +1;

  // Assuming that all races except humans get
  //there racial language free.
  if (( GetAppearanceType(oPC)!=APPEARANCE_TYPE_HUMAN))nNumLang++||
     ( GetLevelByclass(class_TYPE_ASSASSIN, oPC)>0)||
     ( GetLevelByclass(class_TYPE_DRUID, oPC)>0)||
     ( GetLevelByclass(class_TYPE_ROGUE, oPC)>0)||
     ( GetLevelByclass(class_TYPE_RANGER, oPC)>0);

     {
     nNumLang++;
     }



  return nNumLang;
}

Again, if a player is:

*Elf
*Assassin
*Druid

He should receive the Druidic Language, Elf Language, Assassins Cant Language, and still be allowed to pick additional languages if his INT bonus is high enough.  Thanks for the help '<img'>
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Language Clerk Conversation
« Reply #22 on: May 16, 2011, 05:13:32 pm »


               int GetNumAllowedLang(object oPC)
{
  int nNumLang = GetIntBonus( oPC) +1;

  // Assuming that all races except humans get
  //there racial language free.
  if ( GetAppearanceType(oPC)!=APPEARANCE_TYPE_HUMAN)nNumLang++;

  // +1 for each class they have that gets a language.
  if ( GetLevelByclass(class_TYPE_ASSASSIN, oPC)>0) nNumLang++;
  if ( GetLevelByclass(class_TYPE_DRUID, oPC)>0)nNumLang++;
  if ( GetLevelByclass(class_TYPE_ROGUE, oPC)>0)nNumLang++;
  if ( GetLevelByclass(class_TYPE_RANGER, oPC)>0)nNumLang++;
 
  return nNumLang;
}


Something more like the above.  Keep in mind that this board changes  C LASS to all lower case (class). 
               
               

               
            

Legacy_Evelath

  • Full Member
  • ***
  • Posts: 108
  • Karma: +0/-0
Language Clerk Conversation
« Reply #23 on: May 21, 2011, 01:18:26 am »


               Thanks for all the help so far '<img'>

Now that I have secured the include file for the Language System, I want to ensure that I keep it as slim as possible.  As I see it, unless I am mistaken, I will need to make around 82 additional scripts to ensure that whenever a player selects a particular choice from the conversation, they are checked for that language token, and proceed from there.

Essentially:



void main()
{

    object oPC = GetPCSpeaker();
    object oLang    = GetItemPossessedBy(oPC, "lang_token");
    object oLang2   = GetItemPossessedBy(oPC, "hlslang_13");

    if (GetIsObjectValid(GetItemPossessedBy(oPC, "hlslang_13"))==TRUE)
        {
            SendMessageToPC(oPC, "You have already learned this language.");
        }

    if (GetIsObjectValid(GetItemPossessedBy(oPC, "lang_token"))==FALSE)
        {
            SendMessageToPC(oPC, "You can not learn anymore languages right now.");
        }

    else (GetIsObjectValid(GetItemPossessedBy(oPC, "hlslang_13"))==FALSE);
        {
            DestroyObject(oLang);
            CreateItemOnObject("hlslang_13", GetPCSpeaker(), 1);
        }
}


I imagine there is an easier way, as I am looking at the function titled: "GetLanguageResRef" and "GetLanguageTag", however I can't seem to figure out where to place them in order to slim things down.

Thanks '<img'>