XCOM 2
Use My Class
krj12 (Ken)  [开发者] 2016 年 5 月 18 日 下午 9:06
Developer Discussion - Compatibility
For developer comments, ideas on increasing compatibility.
< >
正在显示第 1 - 10 条,共 10 条留言
BTernaryTau 2016 年 5 月 19 日 下午 12:33 
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)  [开发者] 2016 年 5 月 19 日 下午 2:52 
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?
最后由 krj12 (Ken) 编辑于; 2016 年 5 月 19 日 下午 2:55
BTernaryTau 2016 年 5 月 19 日 下午 8:15 
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!
最后由 BTernaryTau 编辑于; 2016 年 5 月 19 日 下午 8:18
krj12 (Ken)  [开发者] 2016 年 5 月 19 日 下午 8:23 
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 2016 年 5 月 20 日 上午 8:37 
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 2016 年 7 月 11 日 上午 4:03 
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)  [开发者] 2016 年 7 月 11 日 上午 4:17 
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 2016 年 7 月 11 日 上午 4:20 
引用自 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://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=719109968
krj12 (Ken)  [开发者] 2016 年 7 月 11 日 上午 5:10 
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 2017 年 3 月 11 日 下午 3:45 
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.
< >
正在显示第 1 - 10 条,共 10 条留言
每页显示数: 1530 50