Jump to content

Trying to mod kSoldier.kAppearance.iGender


Crestfall69

Recommended Posts

So basically I'm following the tutorial in here, to be specific the part where I edit gender probability in Hex editing 1 section.

 

Once I opened UE Explorer I expected this picture here: https://prnt.sc/qt539k, which should be the default XComGame.upk.

 

Instead I found this in my code:

(1C3/127) [0F 35 82 0F 00 00 84 0F 00 00 00 00 35 8E 0F 00 00 99 0F 00 00 00 01 00 E7 B9 00 00 45 9A A7 19 19 2E 54 32 00 00 19 12 20 35 FE FF FF 0A 00 92 F9 FF FF 00 1C D5 FB FF FF 16 09 00 50 F9 FF FF 00 01 50 F9 FF FF 09 00 46 32 00 00 00 01 46 32 00 00 09 00 9B 11 00 00 00 01 9B 11 00 00 16 25 16 02 00 2C 02 01 00 26]
    L(164/104) -> SM(47/27) -> SM(28/16) -> LV(9/5) -> C(116/76) -> NF(108/68) -> NF(105/65) -> C(103/63) -> C(82/50) -> CDC(61/37) -> C(52/32) -> CC(31/19) -> OC(9/5) -> FF(10/6) -> EFP(1/1) -> IV(9/5) -> IV(9/5) -> IV(9/5) -> EFP(1/1) -> IZ(1/1) -> EFP(1/1) -> ICB(2/2) -> IO(1/1)
    kSoldier.kAppearance.iGender = ((Rand(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.NUM_STARTING_SOLDIERS) == 0) ? 2 : 1)  

What should I do? How do I delete the whole extra code without breaking everything?

Edited by Crestfall69
Link to comment
Share on other sites

When you do not see what you expect, the first thing is to suspect you aren't working from the same starting point as the tutorial.

 

Are you modifying the EU or EW version of the game? The tutorial was originally written in July 2013, so it predates EW (Oct 2013), though it was updated as late as 2016 (according to the history of the wiki page). But (as the person responsible for writing most of the articles based upon others research) I can tell you that in general we based everything on the EU version with notes pertaining to EW where necessary unless the subject was specifically "EW only".

 

Have you installed a mod that is likely to have modified that particular section of code (such as "Long War")? (That is what looks most likely to me.) Recall that "mods" in this game are usually either making changes to the INI files (which are relatively "safe") and changes to the game executable code, which are inherently more risky and likely to affect other mods.

 

The answers to those questions should then lead you to question how you want to proceed. But if you are simply using it as a learning tool, then it is still helpful.

 

The code you found is assigning gender on the basis of a random result based upon "world factors" (i.e. everything after the " = " sign. What you found:

(Rand(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.NUM_STARTING_SOLDIERS) == 0) ? 2 : 1)

is simply an expanded version of what you expected:

(Rand(2) == 0 ) ? 2 : 1)

in the "Rand(2)" function. The "Rand(x)" function typically returns a random number between zero and "x" (though I do not know specifically how it works syntaxically in that engine).

 

So consider the "Rand(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.NUM_STARTING_SOLDIERS)" statement to be equivalent to "Rand(2)" and proceed from there. The "Rand" function is part of a conditional test (i.e. does the result = zero) and (I would normally interpret) the "true" result is the first part after the "?", with the "false" result after the ":" (but I haven't looked as UPk code in years and do not trust my memory in that regard).

 

The thing about tutorials is that they seldom directly address your specific issue. You have to "interpret" them as guidelines and use them to construct mental frameworks upon which you can make intelligent changes. Then conduct trial and error tests of your changes to see how they work out in practice.

-Dubious-

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...