shadowmelder Posted July 18, 2013 Share Posted July 18, 2013 I was reading about the differences between each difficulty in XCOM:EU and saw that higher difficulties have more enemies spawn on the map (according to the wiki anyway). In my search to find a mod that increased the number of enemies I also read that the number of enemies is hard-coded in each map. However, if it's true that higher difficulties spawn more enemies then that means it would have to be hard-coded for each difficulty right? Does anyone know if there is a way to have the number of enemies that Insanity spawns but in Normal or Easy? I looked through the Xcomgame.exe with resource hacker as well as read through the list of DefaultGameCore.ini setting but I was unable to find anything regarding this. Thanks! Link to comment Share on other sites More sharing options...
johnnylump Posted July 18, 2013 Share Posted July 18, 2013 (edited) The number of enemies are set in one of the upk files, which means to make changes you'll have to do some hex editing. They aren't set by the map, exactly, but by the mission type and in some cases time elapsed or milestones achieved in the game. Abductions, for example, have different settings and determinants than UFO maps. Also, it appears that some maps may be limited in the number of pods that they can spawn, which in turn limits the total number of aliens on a map unless you modify the game further to have pods of larger than three aliens. If you'd like to start making changes, review the excellent wiki to familiarize yourself with the basics, and I can point you to the specific functions that you would need to change. Good luck. Edit: And yes, your difficulty settings definitely play a role. Edited July 18, 2013 by johnnylump Link to comment Share on other sites More sharing options...
shadowmelder Posted July 19, 2013 Author Share Posted July 19, 2013 Thanks for the tip, johnnylump; I went ahead and read about UPK editing in the wiki as you suggested and I downloaded all of the required tools (UE Explorer, UPK Decompressor, etc...). I poked around a copy of XComGameGame.upk using UE Explorer to get a little familiar with it. Can you provide me the changes to be made please? Link to comment Share on other sites More sharing options...
Amineri Posted July 19, 2013 Share Posted July 19, 2013 I'll chime in as I think JL is working hard trying to finish balancing Long War 1.9 to get a final release out. The functions you want to work with are in the XComStrategyGame.upk The class is XGStrategyAI The particular set of functions that controls number of aliens in various mission types :DetermineFirstMissioSquadDetermineAbductionSquadDetermineTerrorSquadDetermineSmallScoutSquadDetermineLargeScoutSquadDetermineAbductorSquadDetermineSupplySquadDetermineBattleshipSquadDetermineOverseerSquadDetermineAlienBaseSquadDetermineSpecialMissionSquadSo all Abduction missions have the same set of rules regardless of which abduction map. UFOs of the same type all use the same function regardless of crashed / landed, although there is a boolean that tweaks the number of aliens down for crashed UFOs. Good luck, and feel free to ask more questions if you have any :) Link to comment Share on other sites More sharing options...
johnnylump Posted July 19, 2013 Share Posted July 19, 2013 (edited) Also, difficulty is 0 through 3, with 0 being easy and 3 being impossible. To help get you started, here's the vanilla DetermineAbductionSquad (I've rewritten this entirely for Long War with the same goal of more aliens): switch(iMissionDiff) { // End:0x32 case 0: iNumPods = 2; iNumAliens = 4; // End:0x94 break; // End:0x51 case 1: iNumPods = 3; iNumAliens = 6; // End:0x94 break; // End:0x71 case 2: iNumPods = 4; iNumAliens = 8; // End:0x94 break; // End:0x91 case 3: iNumPods = 4; iNumAliens = 10; // End:0x94 break; // End:0xFFFF default: // End:0xC8 if(Game().GetDifficulty() == 3) { iNumAliens += 2; } iPod = 0; J0xD3: // End:0x107 [Loop If] if(iPod < iNumPods) { arrTypes.AddItem(0); ++ iPod; // [Loop Continue] goto J0xD3; } DistributeAliens(arrTypes, iNumAliens, kSquad); return kSquad; } //return ReturnValue; } And here's the token list from the top part of the function, which is the part you'd want to change: (000/000) [05 EF 43 00 00 00 00 EF 43 00 00] S(19/11) -> LV(9/5) switch(iMissionDiff) (013/00B) [0A 32 00 25] C(4/4) -> IZ(1/1) case 0: (017/00F) [0F 00 EB 43 00 00 2C 02] L(12/8) -> LV(9/5) -> ICB(2/2) iNumPods = 2 (023/017) [0F 00 EC 43 00 00 2C 04] L(12/8) -> LV(9/5) -> ICB(2/2) iNumAliens = 4 (02F/01F) [06 94 00] J(3/3) goto J0x94 (032/022) [0A 51 00 26] C(4/4) -> IO(1/1) case 1: (036/026) [0F 00 EB 43 00 00 2C 03] L(12/8) -> LV(9/5) -> ICB(2/2) iNumPods = 3 (042/02E) [0F 00 EC 43 00 00 2C 06] L(12/8) -> LV(9/5) -> ICB(2/2) iNumAliens = 6 (04E/036) [06 94 00] J(3/3) goto J0x94 (051/039) [0A 71 00 2C 02] C(5/5) -> ICB(2/2) case 2: (056/03E) [0F 00 EB 43 00 00 2C 04] L(12/8) -> LV(9/5) -> ICB(2/2) iNumPods = 4 (062/046) [0F 00 EC 43 00 00 2C 08] L(12/8) -> LV(9/5) -> ICB(2/2) iNumAliens = 8 (06E/04E) [06 94 00] J(3/3) goto J0x94 (071/051) [0A 91 00 2C 03] C(5/5) -> ICB(2/2) case 3: (076/056) [0F 00 EB 43 00 00 2C 04] L(12/8) -> LV(9/5) -> ICB(2/2) iNumPods = 4 (082/05E) [0F 00 EC 43 00 00 2C 0A] L(12/8) -> LV(9/5) -> ICB(2/2) iNumAliens = 10 (08E/066) [06 94 00] J(3/3) goto J0x94 (091/069) [0A FF FF] C(3/3) default: (094/06C) [07 C8 00 9A 19 1B 4C 0E 00 00 00 00 00 00 16 0A 00 43 41 00 00 00 1B F6 0E 00 00 00 00 00 00 16 2C 03 16] JIN(39/35) -> NF(36/32) -> C(32/28) -> VF(10/10) -> EFP(1/1) -> VF(10/10) -> EFP(1/1) -> ICB(2/2) -> EFP(1/1) if(Game().GetDifficulty() == 3) (0BB/08F) [A1 00 EC 43 00 00 2C 02 16] NF(13/9) -> LV(9/5) -> ICB(2/2) -> EFP(1/1) iNumAliens += 2 imissiondiffi is how hard the abduction is supposed to be, which is somewhat independent of game difficulty settings. But if you wanted to add two aliens to all missions easy through classic missions, a simpler fix would be changing if(Game().GetDifficulty() == 3) to if(Game().GetDifficulty() >= 0) or 07 C8 00 9A 19 1B 4C 0E 00 00 00 00 00 00 16 0A 00 43 41 00 00 00 1B F6 0E 00 00 00 00 00 00 16 2C 03 16 to 07 C8 00 99 19 1B 4C 0E 00 00 00 00 00 00 16 0A 00 43 41 00 00 00 1B F6 0E 00 00 00 00 00 00 16 2C 00 16 A caution: I suspect (because of the jump offset), but am not certain, that the hex string you would be searching for is unique within the upk file. But using your hex editor either find the function and make the edits manually, or your search and replace only changes the only one instance of that hex string within the file. If it changes two or more, undo the changes and go back and enter the 9a to 99 and 03 to 00 edits individually. As I said, this is just a starter; you've got many, many options. Edited July 19, 2013 by johnnylump Link to comment Share on other sites More sharing options...
shadowmelder Posted July 20, 2013 Author Share Posted July 20, 2013 (edited) Thanks for the help both of you. Now abduction missions in every difficulty in my game have 4 alien pods and 10+2 aliens. A couple of new questions if you don't mind:What mission is DetermineAbductorSquad used for?As far as I can tell, DetermineAbductorSquad doesn't change with regards to difficulty (no Game().GetDifficulty() function calls); is this right or am I missing something?I keep seeing a certain function being called: GetCommanderType() == 18. Any idea what this is? Edited July 20, 2013 by shadowmelder Link to comment Share on other sites More sharing options...
johnnylump Posted July 20, 2013 Share Posted July 20, 2013 Thanks for the help both of you. Now abduction missions in every difficulty in my game have 4 alien pods and 10+2 aliens. A couple of new questions if you don't mind:What mission is DetermineAbductorSquad used for?As far as I can tell, DetermineAbductorSquad doesn't change with regards to difficulty (no Game().GetDifficulty() function calls); is this right or am I missing something?I keep seeing a certain function being called: GetCommanderType() == 18. Any idea what this is? Glad you got it working! DetermineAbductorSquad is the crew of the abductor-class ship. (Usually the first large ship you encounter) And you're correct, that particular mission doesn't use game difficulty. GetCommanderType() checks what stage of the game you are in and then determines the ship commander -- outsider, sectoid commander or ethereal. ECharacter 18 is the outsider: 0 eChar_None, 1 eChar_Civilian, 2 eChar_Soldier, 3 eChar_Tank, 4 eChar_Sectoid, 5 eChar_Floater, 6 eChar_Thinman, 7 eChar_Muton, 8 eChar_Cyberdisc, 9 eChar_SectoidCommander, 10 eChar_FloaterHeavy, 11 eChar_MutonElite, 12 eChar_Ethereal, 13 eChar_Chryssalid, 14 eChar_Zombie, 15 eChar_MutonBerserker, 16 eChar_Sectopod, 17 eChar_Drone, 18 eChar_Outsider, 19 eChar_EtherealUber, 20 eChar_BattleScanner, 21 eChar_MAX Link to comment Share on other sites More sharing options...
shadowmelder Posted July 20, 2013 Author Share Posted July 20, 2013 (edited) I couldn't have done it myself, thanks again. Most of the other functions were easy enough to modify so that they used the settings for insanity (most of them was just changing Game().GetDifficulty() == 3 to >= 0), except for Terror and Special Mission which use embedded if else statements. What I did for those two cases is, instead of changing the values for each difficulty, to rewrite the flow of the program by using Game().GetDifficulty() < 0 for all lower difficulties and Game().GetDifficulty() >= 0 for Insanity's section. That should work for all difficulties, right? If Easy is difficulty 0, then the if statement of "if 0 < 0" should result in false and it would move on, correct? The last issue I'm having is in the Terror function, I can't change Game().GetDifficulty() == 1. I can change the == to < but I can't change the 1 to 0. I read up a bit on it and it seems we can't do anything when a 1 is defined as IntOneToken (26 in hex code). The post I read regarding that is back in November 2012; is there still no fix? Edited July 20, 2013 by shadowmelder Link to comment Share on other sites More sharing options...
johnnylump Posted July 20, 2013 Share Posted July 20, 2013 That should work for all difficulties, right? If Easy is difficulty 0, then the if statement of "if 0 < 0" should result in false and it would move on, correct? Yep. The last issue I'm having is in the Terror function, I can't change Game().GetDifficulty() == 1. I can change the == to < but I can't change the 1 to 0. I read up a bit on it and it seems we can't do anything when a 1 is defined as IntOneToken (26 in hex code). The post I read regarding that is back in November 2012; is there still no fix Yep, sometimes a 1 is 2c 01, or 24 01, or just 26. The good news is if you want to change a 1 that's a 26 to a 0, you can change the 26 to a 25. If you want to change a 1 or a 0 that are 26, or 25, respectively, to something more than 1, you have to do some more serious rescripting. But you should be OK here. Link to comment Share on other sites More sharing options...
shadowmelder Posted July 20, 2013 Author Share Posted July 20, 2013 Yep. Awesome, thanks! Yep, sometimes a 1 is 2c 01, or 24 01, or just 26. The good news is if you want to change a 1 that's a 26 to a 0, you can change the 26 to a 25. If you want to change a 1 or a 0 that are 26, or 25, respectively, to something more than 1, you have to do some more serious rescripting. But you should be OK here. I just made that change, it worked perfectly. Thanks so much for all your help again! Hopefully the maps should feel fuller now that missions won't end when only half the map has been explored. Link to comment Share on other sites More sharing options...
Recommended Posts