anUser Posted March 4, 2013 Share Posted March 4, 2013 Hi, I've recently learned how to change the ability trees using a hex editor and how to play around with the ini file and modpatcher, so now I wanted to change things like the crit chance from Headshot, or the defensive bonus from Tactical sense, etc, but so far I've been uable to locate where they're declared. On XComGame.int there are lines like this one: m_strPassiveTxt[ePerk_Aggression]=Confers +<XGAbility:AggressionCritBonusPerEnemy/>% critical chance per enemy in sight (max +<XGAbility:AggressionCritBonusMax/>%) ... which suggest those values are stored somewhere, but under XGAbility class in XComGame.upk there's only this: const BUBONIC_CURE_COUNT = 5;const GUNSLINGER_DAMAGE_BONUS = 2;const SHREDDER_ROCKET_DAMAGE_MULTIPLIER = 0.33f; Any clue where all the other values could be defined? ... and, in case someone founded it, or if I just wanted to change these values avobe, how can I know where to find those values inside the hex editor? I mean, changing the abilities trees it's easy beacause you're always looking for a pattern (04 2C ?? 06) that's always the same and that fortunately it isn't repeated elsewhere, so knowing the abilities' code and it's current order it's all you need, ... but in this case... what's the procedure? Should I figure up the surrounding bytes to Ctrl-F safely, or is there some way to check inside the UE Explorer the position of highligted text, or is there some other way to achieve this? I'd really appreciate some clue on this. Btw I'd like to thank in my first post all the people that keep this modding community up. Anything I've needed I've found it here on the nexus, and man, my XCom is soo much superior now that's modded than it's ever been. Thank you so much! I hope in time I can give something back from what I'm learning. anusER Link to comment Share on other sites More sharing options...
graaa Posted March 4, 2013 Share Posted March 4, 2013 Ugh I'm looking for answers on this one too but so far I don't think anyone has been able to change the constants from what I've read in previous posts. There is a file named XGTacticalGameCoreNativeBase in the Xcomgame.upk with a ton of constants. Unfortunately, changing the constants there hasn't done anything for me or anyone so far. I've tried to change a few like the base # of smoke grenades and rockets but had no luck. In the hex:50 55 00 00 00 00 00 00 7F 10 00 00 02 00 00 00 31 00is a line for the number of smoke grenades and apparently the '31' sets the grenades to 1. I've tried changing it to an 03 which is hex for 3 and to 33 which somehow also comes back as a '3' in the view buffer of my explorer. In my very limited programming knowedge, I've also tried changing it to 2C 01, 2C 33, and I've succeeded in nothing but crashing the game. Also I learned that you can't add hex lines to the .upk because that crashes the game too. So good question! Anyone figure out anything new about the constants lately? Link to comment Share on other sites More sharing options...
anUser Posted March 4, 2013 Author Share Posted March 4, 2013 You're right, they're there. Thanks mate. That's odd... I thought you could change everything you wanted from the upk as long as the byte sum was exact and the code correct. Anyway, how did you locate that line in the hex? Did you have to guess what the line looks like or there's some search mechanism you can use? anUSer Link to comment Share on other sites More sharing options...
graaa Posted March 4, 2013 Share Posted March 4, 2013 (edited) When you right click on the specific constant in the explorer, you can click an option to 'View Buffer'. This brings up a useful screen with the hex and you can click on each hex to sometimes get some information that reveals which part of the code the hex is referring to. This also works for longer bits of code like entire functions. I only figured something was related by looking at the hex and the writing to the right of the hex in this view, though this isn't always a reliable way of doing it. Sometimes memorizing hexes is just natural like I've figured out that 27 means true and 28 means false and 2C always precedes an integer that you can change. Edited March 4, 2013 by graaa Link to comment Share on other sites More sharing options...
johnnylump Posted March 4, 2013 Share Posted March 4, 2013 We've discovered that some constants that appear in upks aren't in fact used anywhere; the best guess is that they are hardcoded in the .exe file. Link to comment Share on other sites More sharing options...
graaa Posted March 4, 2013 Share Posted March 4, 2013 We've discovered that some constants that appear in upks aren't in factused anywhere; the best guess is that they are hardcoded in the .exefile. Yeah, that's what I figured from past posts. Almost makes me wanna write an angry letter. What bull! Link to comment Share on other sites More sharing options...
anUser Posted March 5, 2013 Author Share Posted March 5, 2013 Thanks for your answers. I'll try this view buffer option and see if I can get to make some changes now. I was thinking that if constants can't be changed we can always overwritte wherever they're used with something else, but if they aren't even used... well, all the same, maybe instead of changing the value that *should* set the number of smoke grenades, we can go to the function that adds the ability and replace a 1 for a2 (in their hex equivalents) regardless of the constant, right? Or is thee some other limitation I'm not aware of? Btw, I was just looking at the line graa posted here and I've noticed there's no 2C preceeding the integer value, which makes me think that perhaps it's not an integer but maybe a pointer to some position in memory or a reference toa global object the game treats differently?? I know that programming languages tend to treat constants differently, using less memory for them than they would use for a variable of the same type... can this have smething to do with your issue? Link to comment Share on other sites More sharing options...
johnnylump Posted March 5, 2013 Share Posted March 5, 2013 Sometimes you see a 24 preceding a value. I've never quite figured out what the difference is between 2c and 24 bytes. And 25 and 26 can be single-byte constants representing 0 or 1. But it may be worth looking around to see if you can find the function where those constants are in use, and modifying them there. Link to comment Share on other sites More sharing options...
anUser Posted March 8, 2013 Author Share Posted March 8, 2013 I've found this function under XcomGame.upk, XComPerkManager function GivePerk(XGUnit kUnit, int iPerk) { // End:0x19b Loop:False if(!kUnit.GetCharacter().HasUpgrade(iPerk)) { kUnit.GetCharacter().GivePerk(iPerk); // End:0x19b Loop:False if(XGBattle_SP(XComTacticalGRI(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kBattle) != none) { // ObjectIndex:26147 BlockSize:0 switch(iPerk) { // End:0x11e case 48: kUnit.SetMediKitCharges(3); // End:0x19b break; // End:0x147 case 93: kUnit.SetRockets(2); // End:0x19b break; // End:0x16f case 22: kUnit.SetShredderRockets(1); // End:0x19b break; // End:0x198 case 44: kUnit.SetSmokeGrenadeCharges(3); // End:0x19b break; // End:0xffff default: } } } but changing those values did nothing. Any luck with the smoke grenades? Again, it seems it's a matter of patience and expertise, but do you have some way of tracing function calls? Or is there some way to check where a variable has been defined? Sometimes you encounter values inherited from parent classes, does UE Explorer have some quick way to trace them? If constants can't be changed in source I'd like to change it where they're read, but I'm having difficulties locating combat-related classes and functions (to increase close and personal range, decrease tactical sense def bonus, etc). Any idea where to start looking at or how to better trace function calls than by memory and pain? Link to comment Share on other sites More sharing options...
Yzaxtol Posted March 8, 2013 Share Posted March 8, 2013 Woah, nearly had a heart attack when my XCOM started crashing after rebalancing pistols and Gunslinger, it turned out that the 02, wasn't the number but something else, and 32 was 2 :S Luckily i went back and fixed it and it's working :smile: Link to comment Share on other sites More sharing options...
Recommended Posts