Skip to content

Strings in two languages

In my module, I have a script file called "strings" with nothing but a series of strings. These strings are used in several instances, specially cutscenes (in which "strings" is added as an include file). I've been trying to devise a system in which these strings will appear in one of two languages, depending on the PC's intelligence. How could I do that in a solid and economic way?

Comments

  • KamirynKamiryn Member Posts: 74
    edited April 2021
    Read the strings from a custom 2da file: use one column for high int and a second column for low int.

    Or use a custom tlk: read string n at position 2n for high int and at position 2n+1 for low int.
  • ForSeriousForSerious Member Posts: 446
    I like that 2da file idea. Not sure how easily portable that is if you want to share your work. If you're okay maintaining a large script, an if statement with switches in both avenues would do the trick.
    pseudo code:
    string GetText(int intel, int index)
    {
    	if(intl > threshhold)
    	{
    		switch(index)
    		{
    			case 1: return "Cool words.";
    		}
    	}
    	else
    	{
    		switch(index)
    		{
    			case 1: return "Plabras suaves.";
    		}
    	}
    }
    

    To me I feel like this will be about the same amount of work as the 2da file approach.

    The next idea that comes to mind is using a database, but unless you already know how you can populate and maintain it, it's going to take a lot more work to get up and running. (And again, it is not as easily shared.)
  • gpeddinogpeddino Member Posts: 50
    Thanks you both for the suggestions! I ended up creating a 2da file and it worked fine!
    ForSerious
Sign In or Register to comment.