mario1789 Posted November 14, 2013 Share Posted November 14, 2013 While the new voices in EW are nifty, the chance in the base game of getting an appropriate nationality for the new voices is pretty low. Although I could have all the Nigerian soldiers speak Polish, I'm wondering whether the default chances of what nationality is assigned to a new solder can be altered. I looked into doing it myself, read lots of posts and played with a bunch of tools. I got to the point where I found the function to assign a nationality in XGCharacterGenerator in the upk files and where iCountry integers come from, but the function itself was voodoo to me and I gave up. :( Anyhow, I hope all the modders are principally enjoying the game. Link to comment Share on other sites More sharing options...
tonxabar Posted December 21, 2013 Share Posted December 21, 2013 http://forums.nexusmods.com/index.php?/topic/1210765-enemy-within-discovery-thread/?p=10160359 I'm trying to replicate the same... but still trying... :/ Link to comment Share on other sites More sharing options...
Bertilsson Posted December 22, 2013 Share Posted December 22, 2013 (edited) It is not very complicated at all... This is how the PickOriginCountry function works: function int PickOriginCountry(optional int iContinent) { local array<int> arrCountries; arrCountries.AddItem(33); //Add a chance of country 33 arrCountries.AddItem(31); //Add a chance of country 31 arrCountries.AddItem(31); //Add additional chance of country 31 arrCountries.AddItem(19); //Add a chance of country 19 //Next line is where magic happens return arrCountries[Rand(arrCountries.Length)]; //Randomly select one of the countries added to arrCountries. The more times a country is added the higher is the chance for that country to be selected. //return ReturnValue; } GetLanguageByCountry function then does this: function XGGameData.ECharacterLanguage GetLanguageByCountry(XGGameData.ECountry Country) { switch(Country) { // End:0x18 case 31: //If country == 31 // End:0x1D //Then do nothing case 32: //If country == 32 // End:0x22 //Then do nothing case 0: //If country == 0 // End:0x27 //Then do nothing case 3: //If country == 3 // End:0x2C //Then do nothing case 15: //If country == 15 // End:0x34 //Then do nothing case 8: //If country == 8 return 0; //Return language 0 // End:0x39 case 35: //If country == 35 // End:0x41 //Then do nothing case 5: //If country == 5 return 1; //Return language 1 // End:0x49 default: //If country wasn't in above list then do this: return GetLanguageByString(); //Call GetLanguageByString and make it figure out what language is requested. } //return ReturnValue; } GetLanguageByString then works in the same way but expects "3 digit Country code" instead of a number static function XGGameData.ECharacterLanguage GetLanguageByString(optional string strLanguage) { strLanguage = ""; // End:0x2B if(Len(strLanguage) == 0) { strLanguage = GetLanguage(); } switch(strLanguage) { // End:0x49 case "DEU": return 2; // End:0x54 case "ESN": return 6; // End:0x5F case "FRA": return 1; // End:0x6A case "ITA": return 3; // End:0x75 case "POL": return 4; // End:0x80 case "RUS": return 5; // End:0xFFFF default: return 0; } //return ReturnValue; } Edited December 22, 2013 by Bertilsson Link to comment Share on other sites More sharing options...
Recommended Posts