XCOM 2
Use My Class
krj12 (Ken)  [developer] 18 May, 2016 @ 9:06pm
Developer Discussion - Compatibility
For developer comments, ideas on increasing compatibility.
< >
Showing 1-10 of 10 comments
BTernaryTau 19 May, 2016 @ 12:33pm 
Copied and pasted from the main comments section for reference:

I have a few recommendations for improving the compatibility of your mod. For example, you can use OnPostTemplatesCreated to edit the GenerateRewardFn delegate for the 'Reward_Soldier', 'Reward_Rookie', and 'Reward_CouncilSoldier' templates instead of overriding X2StrategyElement_DefaultRewards. However, since Long War Toolbox overwrites the same delegate, it would also be useful to look into whether it's possible to use the LWTuple system and the events sent by Long War Toolbox instead when Long War Toolbox is being used alongside this mod. Let me know if you want anything I said clarified!
krj12 (Ken)  [developer] 19 May, 2016 @ 2:52pm 
Hi Celestus, If I'm reading your post correctly, I would have to do the following:
1. Remove the override for X2StrategyElement_DefaultRewards.
2. Add a new X2DownloadableContentInfo class that overrides OnPostTemplatesCreated
3. Makes 3 calls something like:
StratMgr.FindStrategyElementTemplate('Reward_Soldier'').GenerateRewardFn = <my function>
StratMgr.FindStrategyElementTemplate('Reward_Rookie'').GenerateRewardFn = <my function>
StratMgr.FindStrategyElementTemplate('Reward_CouncilSoldier').GenerateRewardFn = <my function>

Several questions:
- to point to my method like that, will my method need to be static? Or will it even take a pointer to a function outside of that class?
- Not familiar with Long War Toolbox, what's a LWTuple?
- If I make it compatible with this Long War mod, will that make it dependent on LongWar's mod being installed first?
- What exactly is a 'Reward_Rookie' and 'Reward_CouncilSoldier'?
- Just curious, are you part of the Long War development team?
Last edited by krj12 (Ken); 19 May, 2016 @ 2:55pm
BTernaryTau 19 May, 2016 @ 8:15pm 
1. The function that I used is static, but I'm not sure if it has to be. A function from a different class works fine. If you want an example of this, you can look at the source code of my mod.

2. From the Long War Toolbox description on Nexus:

"Toolbox makes use of a generic LW_Tuple data structure for passing data back and forth using the X2EventManager. If your mod wants to RegisterForEvent for one of these EventIDs, you'll want to include the LW_Tuple package :
1) Copy the LWTuple.uc class file into your mod, in a separate folder under /Src/LW_Tuple/Classes/
2) Add config line "+ModEditPackages=LW_Tuple" (to match the new folder in Src) to XComEngine.ini, section [UnrealEd.EditorEngine]
3) Use the LWTuple class in your code"

I haven't gotten around to learning how to use this myself, so I likely won't be of much more help here.

3. I do know that it will not be dependent on Long War Toolbox loading first (nor will it be dependent on Long War Toolbox at all).

4. 'Reward_Rookie' and the others are the names of X2RewardTemplate instances generated by XCOM 2 every time it loads a game. The important thing for you is that each of them contains a delegate for the function used to generate a soldier reward, which by default points to the function your mod currently overrides.

5. I wish!
Last edited by BTernaryTau; 19 May, 2016 @ 8:18pm
krj12 (Ken)  [developer] 19 May, 2016 @ 8:23pm 
In your mod, you have:

[Engine.ScriptPackages]
+NonNativePackages=ResistanceWeaponUpgrades

[Engine.Engine]
-ModClassOverrides=(BaseGameClass="X2StrategyElement_DefaultRewards", ModClass="X2StrategyElement_DefaultRewards_RWU")


Did you at one point have the class overridden, and this is to clean it up out of the INI files?

Also curious if this could be used to blow away other peoples overrides so that your mod will work? ( kind of a dirty thing to do, but hey :) )



BTernaryTau 20 May, 2016 @ 8:37am 
You are correct about that line being used to clean up the INI files from when I overrode that class. I have no idea if you can remove other mods' overrides using that method.
SievertChaser 11 Jul, 2016 @ 4:03am 
Hey, guys. Sorry to butt in with newbish question, but what happens if this mod encounters a mod that prunes away vanilla classes? Does it act similar to what it used to do for Psis?
krj12 (Ken)  [developer] 11 Jul, 2016 @ 4:17am 
Depends on the mod and exactly how it does its pruning. I'm guessing most of these mods just change INI values so that the base classes are not selectable. If you still have the vanilla class defined in the CP, it should work ok. This is just speculation though unless I know which mod you're talking about.
SievertChaser 11 Jul, 2016 @ 4:20am 
Originally posted by krj12:
Depends on the mod and exactly how it does its pruning. I'm guessing most of these mods just change INI values so that the base classes are not selectable. If you still have the vanilla class defined in the CP, it should work ok. This is just speculation though unless I know which mod you're talking about.
http://gtm.steamproxy.vip/sharedfiles/filedetails/?id=719109968
krj12 (Ken)  [developer] 11 Jul, 2016 @ 5:10am 
We had a number of posts in the main thread on this mod. The short of it is: Both the old and new classes can be selected in the CP, and both still work as far as leveling up your rookies.
Terradive 11 Mar, 2017 @ 3:45pm 
I would love to see this mod be made fully lw2 compatible!!! I'm trying to do it myself but I'm not great at this. I've got the mod compiling clean, but when I play it and promote a guy it fails even on the first troopers I get and have no way to know what is failing or not starting.
< >
Showing 1-10 of 10 comments
Per page: 1530 50