[scripting] game language

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

[scripting] game language

Post by Anakin »

Hi,

does anyone know if there is a way to get the game language that is used with an lua script?? In my case I want to load different sound files belong to the language selected in the game settings. That way I want German and English voice streams.

Thank you for your help
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: [scripting] game language

Post by Marth8880 »

I doubt it. Any that exist are probably only usable within C.

You should try looking around in the shell scripts, though. You might find something there.

By the way, are you talking about using custom multi-language streams, or the stock ones?
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: [scripting] game language

Post by Anakin »

Custom. You know I have these German grenade warnings and fallback screams used in RC. Many complained about it and wanted English streams. So I wanted to make the mod take the German if you have German settings and English for the others. I could tell everyone in the readme to manual swap the files, but i'm a fan of automatic things :D
My problem is that the grenade warnings are sound effects (fire sound) and not voice streams. I'm sure that Lucas Arts has a solution for the voices, because they had the same problem for campaign for example. But these are voice streams and not sound effects.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: [scripting] game language

Post by [RDH]Zerted »

Try: ScriptCB_GetLanguage()

Examples from the retail scripts:

Code: Select all

gLangStr,gLangEnum = ScriptCB_GetLanguage()
local CurLang = ScriptCB_GetLanguage()
local langStr, langIndex = ScriptCB_GetLanguage()
if((gPlatformStr ~= "PS2") and (ScriptCB_GetLanguage() ~= "english") and (this.iOnPage == 0)) then
Here's all the lines with "gLang":

Code: Select all

3594:-- 	elseif (gLangStr == "italian") then
3616:-- 	if(gLangStr == "german") then
27688:elseif (gLangStr == "french") then
27689:elseif (gLangStr == "spanish") then
31315:gLangStr,gLangEnum = ScriptCB_GetLanguage()
31397:gMovieStream = shellMovie[gLangStr] or shellMovie["english"]
32043:if ( gLangStr == "english" or gLangStr == "uk_english" ) then
32044:if ( gLangStr ~= "english" and gLangStr ~= "uk_english" ) then
32242:if (gLangStr == "french") then
33451:if((gLangStr == "english") or (gLangStr == "uk_english")) then
33452:if((gLangStr ~= "english") and (gLangStr ~= "uk_english")) then
33453:if((gLangStr ~= "english") and (gPlatformStr == "PS2")) then
33454:if((gLangStr ~= "english") and (gPlatformStr ~= "PC")) then
33470:if((gPlatformStr == "PS2") and (gLangStr == "german")) then
33630:if(1) then -- (gLangStr ~= "english") and (gLangStr ~= "uk_english")) then
34104:if(gLangStr == "english") then
34105:if(gLangStr == "german") then
34106:if(gLangStr == "spanish") then
34107:if(gLangStr ~= "english") then
39047:local bNeedToShrink = ((gLangStr ~= "english") and (gLangStr ~= "uk_english"))
39604:local langShort = strlower(string.sub(gLangStr, 1, 3))
39719:local movie_file = movie_files[gLangStr] or movie_files.english
Post Reply