Jump to content

better implementation of "all armor options"?


davidlallen

Recommended Posts

There is a mod at steam workshop "all armor options". It seems like a good starting point, and it lets you make some cool looking characters. But, as you see in the workshop comments, especially by zyxpsilon, it needs a lot of work to get the actual armor names instead of numbers, catch/fix various problem with missing arms and legs, and restrict the armor options a little by available tech (no randomly generated rookie with power armor appearance).

 

Can anybody look a little further at this and see what needs to be done?

 

Reddit topic on the technique:

https://www.reddit.com/r/xcom2mods/comments/44qlej/mod_tutorialmod_release_unlock_all_armor

 

On steam workshop, find the mod by searching "all armor" or try this link:
http://steamcommunity.com/sharedfiles/filedetails/?id=619230980&searchtext=all+armor

EDIT: added later

The related file is X2SimpleBodyPartFilter.uc, and by diffing with the original, I can see that only function FilterByTorsoAndArmorMatch is modified. There is another function FilterByGenderAndNonSpecializedAndTech, which does filter by tech. Both of these are called in XcomCharacterCustomization.uc, for different object types. It seems that only helmets are limited by tech ??!!??.

 

It seems like modifying XcomCharacterCustomization.uc to filter more things by tech should solve the problem of randomly generated rookies with power armor appearance. I am not sure how/whether the other bugs such as missing arms and legs can be solved.

Edited by davidlallen
Link to comment
Share on other sites

Well, I know what's wrong, but I don't understand uc syntax well enough to fix it. The existing mod changes a low level function which is called from two places: the character customization screen (good) and the rookie generation screen (bad).

 

(EDIT: rewritten after 6+ hours of experimentation)

 

In X2SimpleBodyPartFilter, I need two copies of FilterByTorsoAndArmorMatch. One copy (the original) should be called by XGCharacterGenerator::CreateTSoldier for rookies. The other copy (modified to allow any armor) should be called by multiple places in XcomCharacterCustomization. I created a new function X2SimpleBodyPartFilter::MyFilterByTorsoAndArmorMatch. But when I try to call it from CreateTSoldier, I get "Delegate assignment failed, unknown function MyFilterByTorsoAndArmorMatch". I can't extend X2SimpleBodyPartFilter, I have to replace it; but even after replacing, my new access function is not visible.

 

What is the right way to add new access functions to existing classes?



			
				


	Edited  by davidlallen
	
	

			
		
Link to comment
Share on other sites

This is just stupid. I have now tried five different ways to try modding this, all failed. All I need to do is make a copy of a function in one class with a new name, and call the new function from another class, and I can't get it to work. If you extend a class, you can't add a function; or at least callers from another class can't use it. If you replace a class, that seems to have no effect at all. It is literally ten lines of code change which would easily work in C++ or Java, but doesn't work in XCOM2. Hopefully there is some simple syntax trick I can't see.

 

Any suggestions? The details are in the previous post.

Link to comment
Share on other sites

Solved: http://forums.nexusmods.com/index.php?/topic/3815545-how-to-extend-a-function-that-uses-private-class-variables/&do=findComment&comment=34701295

 

Key lesson (as usual, trivial in retrospect): copy the config(someIni) part when replacing a class. Now I can improve the mod, so that rookies have the original gear assortment, but in the character configuration screen, you can pick anything.

 

I have PM'd the author to let them know. Here attached is the code. Basically, instead of modifying X2SimpleBodyPartFilter (which everybody calls), make the equivalent change in XcomCharacterCustomization (which is only called by the character configuration screen).

Edited by davidlallen
Link to comment
Share on other sites

  • Recently Browsing   0 members

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