Drakous79 Posted November 9, 2012 Share Posted November 9, 2012 (edited) http://i.imgur.com/X6Lij.png Altering start day requires changing 4 classes within XComSTrategyGame. Posting just parts of the code. XComSTrategyGame.upk - classes XGGeoscape, XGStrategyAIfunction InitNewGame() { m_kDateTime.SetTime(0, 0, 0, 3, 1, 2015); }XComSTrategyGame.upk - class XGFundingCouncilfunction CreateMission(TFCMission MissionData) { kDateTime.SetTime(0, 0, 0, 3, 1, 2015); }Searched unpacked XComStrategyGame.upk for hex values 03 26 1D DF 07 (3 matches) and changed them to 03 26 1D DC 07. Haven't tested zeros in the function, can be time setting. XComSTrategyGame.upk - class XGDateTimefunction bool IsFirstDay() { return m_iMonth == 3 && (m_iYear == 2015) && (m_iDay == 1); }Searched unpacked XComSTrategyGame.upk for complete copy pasted hex values from unpacked IsFirstDay.Function and changed DF 07 to DC 07. After edits fired XSHAPE and tested in the game past the first month and it seems to work ok. Well, not so great mod idea, but couldn't resist after seeing confusing year constant :) Edit: I slacked. Correct function in XGFundingCouncil class is CreateMission, not InitNewGame. Edited November 24, 2012 by Drakous79 Link to comment Share on other sites More sharing options...
BlackAlpha Posted November 9, 2012 Share Posted November 9, 2012 (edited) XComStrategyGame.upk > XGDateTime function SetTime(int iHour, int iMinute, int iSecond, int iMonth, int iDay, int iYear) { m_fTime = float(iSecond + iMinute * 60 + iHour * 60 * 60); m_iDay = iDay; m_iMonth = iMonth; m_iYear = iYear; // End:0xa6 Loop:False if(m_iMonth > 12) { m_iMonth = Ceil(m_iMonth, 12) + 1; m_iYear += 1; } } :) Edited November 9, 2012 by BlackAlpha Link to comment Share on other sites More sharing options...
Drakous79 Posted November 10, 2012 Author Share Posted November 10, 2012 Aha, SetTime function! Thank you :) Link to comment Share on other sites More sharing options...
BlackAlpha Posted November 10, 2012 Share Posted November 10, 2012 (edited) Aha, SetTime function! Thank you :) It's actually right below "function bool IsFirstDay()". So you just missed it. :tongue: Edited November 10, 2012 by BlackAlpha Link to comment Share on other sites More sharing options...
Drakous79 Posted November 10, 2012 Author Share Posted November 10, 2012 Yea, definitely because of focusing just on values I was intereted in. Still so much to learn. Link to comment Share on other sites More sharing options...
FlyingHigh10000000 Posted November 11, 2012 Share Posted November 11, 2012 So how hard would it be for the uninitiated in upk modding(like me) to say, change the starting date to 1999, as in the original game?(At least then the guns and equipment that X-Com uses would seem top-of-the-line compared to what was available in 1999. :P) Link to comment Share on other sites More sharing options...
Drakous79 Posted November 12, 2012 Author Share Posted November 12, 2012 (edited) It's not hard, after done few times. And after setting all tools and stuff, it is just files and bytes juggling. Will be a lot easier later with XCOM Mod Manager. Will try to guide you so you can do it yourself. 1. Create some work directory. 2. Copy file from Steam\SteamApps\common\XCom-Enemy-Unknown\XComGame\CookedPCConsole\ to the work directory:XComSTrategyGame.upk3. THE MOST IMPORTANT PART is to backup files in Steam\SteamApps\common\XCom-Enemy-Unknown\XComGame\CookedPCConsole\:XComStrategyGame.upkXComStrategyGame.upk.uncompressed_sizeI usually just rename them to name_BACKUP.extension, because it serves as backup and I don't have to delete name.uncompressed_size later in order to make the game load uncompressed upk. 4. Get Gildor's Unreal Package Decompressor listed under other tools, extract from zip to the work directory. Fire up command line, navigate to your work directory and type decompress -lzo XComStrategyGame.upk. Should decompress the file. That's for preparation :) 5. Get some hex editor like HxD, install, run it, File | Open unpacked XComStrategyGame.upk from the work directory\unpacked. 6. Now it's time to change 2015 to 1999. Search | Replace or CTRL+R, switch Datatype to Hex-values, tick Search direction all and input:Search for: 03 26 1D DF 07 Replace with: 03 26 1D CF 07Click Replace all. Should return: Replaced 3 ocurrences. Replace again:Search for: 00 00 1D DF 07 Replace with: 00 00 1D CF 07Click Replace all. Should return: Replaced 1 ocurrences. Now FILE | Save as to Steam\SteamApps\common\XCom-Enemy-Unknown\XComGame\CookedPCConsole\XComStrategyGame.upk 7. Get XSHAPE and extract it to the game's root directory. My is S:\Steam\SteamApps\common\XCom-Enemy-Unknown\Run XSHAPE from command line. I added pause at the end of XSHAPE.bat to see results, so no longer need to run it from cmd. XSHAPE should report 1 SHA hash(es) updated. 8. Remove (if you have backup) or rename XComStrategyGame.upk.uncompressed_size in Steam\SteamApps\common\XCom-Enemy-Unknown\XComGame\CookedPCConsole\ 9. Run the game and verify the change. Good idea to start new game. If the game crashes, either editing upk failed or hash was not updated. Date should be stored in save file. Redo steps 6-9, if starting new game after official patch that changed XComStrategyGame.upk. If the patch changed just XComGame.exe, run XSHAPE. Also can happen, that some tools alter the exe and would be needed to update SHA hash again (XSHAPE) ... well, should be obvious, if the game crashes after mod installation. Let me know if it works for you. Guys are already working on XCOM Mod Manager to make mod distribution easier. But meanwhile, they have my thanks for tools they already gave us :thumbsup: Edit: Typos Edited November 12, 2012 by Drakous79 Link to comment Share on other sites More sharing options...
Wulf2k Posted November 12, 2012 Share Posted November 12, 2012 After changing the date, have you confirmed the new aliens still appear on the same schedule? I would assume they would come on "month 3, month 4" etc, but there's a chance they're set to come on "June, 2015" and such. Link to comment Share on other sites More sharing options...
Drakous79 Posted November 12, 2012 Author Share Posted November 12, 2012 (edited) The first month felt like usual - few abductions, 2 outsiders - and transition to the next month was okay. You're right, UFO schedule is set monthly. File XComSTrategyGame.upk, class XGstrategyAIfunction FillUFOPool() { local int iMonth; iMonth = GetMonth(); // End:0x53 Loop:False if(iMonth >= 0) { AddUFOToPool(MakeUFO(4, 1)); AddUFOToPool(MakeUFO(4, 1)); } // End:0xaa Loop:False if(iMonth >= 1)Edit: Also squads are done similar way. File XComSTrategyGame.upk, class XGstrategyAIfunction TPossibleAlienSquad GetPossibleAliens() { local int iMonth; local TPossibleAlienSquad kSquad; iMonth = GetMonth(); AddPossible(GetCommanderType(), 100, kSquad.arrPossibleCommanders); // End:0xda Loop:False if(iMonth <= 0) { AddPossible(4, 100, kSquad.arrPossibleSoldiers); AddPossible(13, 100, kSquad.arrPossibleSecondaries); AddPossible(17, 100, kSquad.arrPossibleRoaming); } // End:0xdea else { // End:0x1c4 Loop:False if(iMonth <= 1) Edited November 12, 2012 by Drakous79 Link to comment Share on other sites More sharing options...
FlyingHigh10000000 Posted November 12, 2012 Share Posted November 12, 2012 Thanks very much for the guide. I decompressed/used XShape already for another mod, so really, the only part I was confused on was the hex editing. I dunno why four digits means so much to me, but it adds a lot to the atmosphere. :P Link to comment Share on other sites More sharing options...
Recommended Posts