Jump to content

UPK file format


wghost81

Recommended Posts

Not sure if this entirely new news, but I've worked out how super functions are called. This is used to invoke the method of an identical name within a child class.

 

The trick is to not use the 1B virtual token identifier (combined with a simple namelist reference), but instead to use the 1C "final function" token combined with a direct objectlist reference to the specific function.

 

In my example, I was working with the function PrefersLowCover, which is present in the base class XGAIBehavior as well as 3 child classes XGAIBehavior_Sectoid, XGAIBehavior_ThinMan, and XGAIBehavior_SectoidCommander. In vanilla this function makes Thin Men and Sectoids prefer low cover on Easy and Normal difficulties. My goal is to modify this in general to make all units prefer low cover only if they have the Low Profile perk.

 

A virtual call to PrefersLowCover looks like:

PrefersLowCover()
1B 1F 65 00 00 00 00 00 00 16

Where 0x651F is a namelist index to the string "PrefersLowCover" in the namelist.

 

To generate a specific call to super.PrefersLowCover() in XGAIBehavior_Sectoid.PrefersLowCover, the format is instead :

return super(XGAIBehavior).PrefersLowCover()
04 1C E7 9B 00 00 16 

Technically XGAIBehavior_Sectoid is a child of XGAIBehavior_Psi, which is in turn a child of XGAIBehavior, which is why UE Explorer puts in the explicit XGAIBehavior reference.

 

In this case the 1C token is followed by 0x9BE7, which is an objectlist reference to the specific function XGAIBehavior.PrefersLowCover.

 

For the case of XGAIBehavior_ThinMan, which is a direct child of XGAIBehavior, UE Explorer decompiles the same hex bytes as :

return super.PrefersLowCover()
04 1C E7 9B 00 00 16 
Link to comment
Share on other sites

  • Replies 111
  • Created
  • Last Reply

Top Posters In This Topic

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...