bokauk Posted February 17, 2013 Share Posted February 17, 2013 Update: the i=i+hit value works. Tested ingame, couldn't miss with fighter with lots of kills, while rookie fighter was missing plenty. Woo-hoo! Interceptors can level up! Excellent, glad you got it working :biggrin: Link to comment Share on other sites More sharing options...
johnnylump Posted March 5, 2013 Author Share Posted March 5, 2013 (edited) When is a class' INIT function called? Only at the game start? On loading? PLEASE prove me wrong, but I think UpdateShips() is only called from XGItemTree's Init function. If so, this wouldn't work. (Or, weirdly, only after you reload a game.)I haven't been following this discussion, so I'm not sure if this is what you mean or if it will be useful... :smile: It looks like the XGItemTree > Init() function is called from XGFacility_Engineering > Init(), which is called from XGHeadQuaters > CreateFacilities(). XGFacility_Engineering function Init(bool bLoadingFromSave) { BaseInit(); m_kItems = Spawn(class'XGItemTree'); m_kItems.Init(); // End:0x6a if(m_arrMusingTracker.Length == 0) { m_arrMusingTracker.Add(6); } } UpdateShips() is called from XGItemTree > Init() > BuildShips() as you mentioned, but it's also called from XGStrategy > ChangeDifficulty(). There's a different UpdateShips() function in XGGeoscape as well, which I think is only called from XGGeoscape > GameTick(). :smile: Thanks for these; I'll check them out. Remains unclear if they are consistently called, or only at start game, game load times, or periodically during play. Update on trying to upgrade UFOs midway through the game. A GetMonth() call in UpdateShips() apparently causes a crash during save-game load. GetMonth () isn't called anywhere else in XGItemTree. I may try an ever-had-item trigger instead, but we still aren't sure when exactly UpdateShips() might run. Cripes, can't upgrade aliens or UFOs midway through. Almost want to make a second version of the mod and tell people to load it after they kill the base or something. Edited March 5, 2013 by johnnylump Link to comment Share on other sites More sharing options...
johnnylump Posted March 6, 2013 Author Share Posted March 6, 2013 Success! I think.Game.GetAct() works in the UpdateShips() function, so I've managed to change UFO weaponry based on what "Act" the game is in. So far, this is testing across savegames. I don't actually know when the game transitions from one act to another. Does anyone have experience with this? Based on what I've found in the code, Act 3 seems to start after defeating the alien base. That probably means Act 1 is the beginning of the game, and Act 2 probably starts when you capture a live alien, or an outsider. I don't know if there are any acts after 3; I've only found if a if GetAct < 3 test in vanilla code. I also don't know when exactly UpdateShips () is called, except that it's called after loading a savegame game. So not sure at what point after you change ACTs the changes will take effect, and it may require a load by the player. More testing needed, but hey, progress! Link to comment Share on other sites More sharing options...
bokauk Posted March 6, 2013 Share Posted March 6, 2013 Game.GetAct() works in the UpdateShips() function, so I've managed to change UFO weaponry based on what "Act" the game is in. So far, this is testing across savegames. I don't actually know when the game transitions from one act to another. Does anyone have experience with this?Act 1: Start of gameAct 2: Interrogated any alienAct 3: Obtained Hyperwave Beacon function int GetAct() { // End:0x2B if(STORAGE().EverHadItem(180)) { return 3; } // End:0x56 else { // End:0x54 if(LABS().HasInterrogatedCaptive()) { return 2; } // End:0x56 else { return 1; } } //return ReturnValue; } I also don't know when exactly UpdateShips () is called, except that it's called after loading a savegame game. So not sure at what point after you change ACTs the changes will take effect, and it may require a load by the player. More testing needed, but hey, progress!UpdateShips() is called from XGItemTree > Init() > BuildShips() as you mentioned, but it's also called from XGStrategy > ChangeDifficulty(). So it looks something like: XGStrategy .StartingNewGame.Begin > XGHeadQuarters. InitNewGame () > CreateFacilities() > XGFacility_Engineering.Init() > XGItemTree.Init() > BuildShips() > UpdateShips() and XGStrategy.ChangeDifficulty() > XGItemTree .UpdateShips() I'd expect SetDifficulty or ChangeDifficulty is called after loading a game somewhere :smile: Link to comment Share on other sites More sharing options...
johnnylump Posted March 6, 2013 Author Share Posted March 6, 2013 (edited) Thanks! I just tested wiith an assault on the base, and yep, the UFOs don't upgrade until after a reload. (Probably changing the difficulty in the options menu would do the same). But that call from XGStrategy is a great help -- that means I might be able to duplicate it somewhere that's called regularly, and then I won't have to instruct the player to do it manually. (Now: balancing. I'm upgrading large scouts to double plasma in act 2, and small scouts in act 3. I can also reset their armor stats if necessary, or work on the bigger ships. Anyone have any opinions here?) Edited March 6, 2013 by johnnylump Link to comment Share on other sites More sharing options...
johnnylump Posted March 8, 2013 Author Share Posted March 8, 2013 (edited) Verdict on upgrading UFOs: It works. It requires using Storage.EverHadItem() or Game.GetAct() as a proxy for GetMonth(), but you can use alien corpses for EverHadItem to figure out what month the game is in. It also requires a call to UpdateShips() from some other function that is regularly called, as UpdateShips() is default only called on game load. I put it in some extra bytes in ShouldHunt(), which I've modified for other uses, and it works fine. Full details at the beginning of this forum thread. I'll include the code in the next Long War update. That means two out of four enhancements (Interceptor experience, UFO upgrades) have been successfully implemented in the game. Thanks everyone for your help. Edited March 8, 2013 by johnnylump Link to comment Share on other sites More sharing options...
Yzaxtol Posted March 8, 2013 Share Posted March 8, 2013 Gratz dude, you seriously know your stuff. All I can do is tweak numbers pretty much :S. Link to comment Share on other sites More sharing options...
Amineri Posted March 10, 2013 Share Posted March 10, 2013 (edited) Good news ! I figured out how to randomize grenade and rocket damage. It turns out you were just looking in the wrong spot. I by happenstance came across what turned out to be the correct function. In XcomGame.upk >> XGTacticalGameCore >> CalcOverallDamage The relevant conditional is: if(WeaponHasProperty(iWeapon, 9)){ return iDamage;} and weapon property 9 (from XGTacticalGameCoreData) is eWP_Explosive. The easy change is to change the 9 into some unobtainable weapon property (I used 0x30), so the function never evaluates true. It will then move on to the regular randomization code (i.e. +/- 1 for vanilla, and much more with Damage Roulette). And now, back to what I was originally looking for ... a way to give SHIVs damage mitigation (kind of like Will to Survive) UPDATE : This does indeed make explosive damage randomized, but also appears to have the side effect of making it impossible to stun. Complete mystery at this point as to why, but be aware. Below is the ToolBoks custom mod I wrote that implements it: MOD_NAME=Randomize Explosive DamageAUTHOR=amineriUPK_FILE=XComGame.upkDESCRIPTION=Allows Grenade and Rocket Damage to be randomized like any other type Version: 1.0 Works with XCOM Enemy Unknown version: Patch 3 ( Tuesday, December 11, 2012 4:36 PM - Changelist: 347752 ) [FIND]{ Default check for explosive damage type - DO NOT EDIT THIS LINE }07 9F 00 1B 8C 71 00 00 00 00 00 00 00 F3 76 00 00 2C 09 16 04 00 EE 76 00 00 [REPLACE]{ Change required damage type to something unobtainable }07 9F 00 1B 8C 71 00 00 00 00 00 00 00 F3 76 00 00 2C 30 16 04 00 EE 76 00 00 Edited March 12, 2013 by Amineri Link to comment Share on other sites More sharing options...
johnnylump Posted March 10, 2013 Author Share Posted March 10, 2013 AHA! Well done, sir. You da man. I'll get that in the next LW. Link to comment Share on other sites More sharing options...
Amineri Posted March 12, 2013 Share Posted March 12, 2013 The randomized explosive damage appears to have the side effect of rendering it impossible to stun (via Arc Thrower). Absolutely NO clue why this side effect would happen, but maybe it will give some insight into how the stunning mechanic works. Link to comment Share on other sites More sharing options...
Recommended Posts