kagato1980 Posted November 6, 2021 Share Posted November 6, 2021 (edited) Not sure if this is the right place to post, but here goes. I want to alter multiple functions, but to extends them all is a lot of copy pasting..thought I could just extend them but replace the contents with their parent counterpart, and then modifiy that value. Example: static function X2DataTemplate CreateSuperiorFreeFireUpgrade() { local X2WeaponUpgradeTemplate Template; `CREATE_X2TEMPLATE(class'X2WeaponUpgradeTemplate', Template, 'FreeFireUpgrade_Sup'); SetUpFreeFireBonusUpgrade(Template); SetUpTier3Upgrade(Template); Template.strImage = "img:///UILibrary_StrategyImages.X2InventoryIcons.MagSniper_TriggerB_inv"; Template.FreeFireChance = default.FREE_FIRE_SUP; return Template; } becomes static function X2DataTemplate CreateSuperiorFreeFireUpgrade() { local X2DataTemplate Template; Template = super.CreateSuperiorFreeFireUpgrade(); Template.FreeFireChance *= 2; return Template; } Oddly enough, this throws 'Error, Unrecognized member 'FreeFireChance' in class 'X2DataTemplate', which is the same type the original function is returning. Changing it to other types like X2WeaponUpgradeTemplate results in a type mismatch. Any ideas? Is my way of calling the parent function incorrect? Edit: For what I'm trying to achieve here, it's probably easier to directly manipulate the .ini values, but for learning sake it would be nice to have this working Edited November 6, 2021 by kagato1980 Link to comment Share on other sites More sharing options...
kagato1980 Posted November 7, 2021 Author Share Posted November 7, 2021 This can't be fixed, the function return a smaller class definition than the one that is manipulated internally..haven't had much luck using .ini approach either sadly. Link to comment Share on other sites More sharing options...
kagato1980 Posted November 7, 2021 Author Share Posted November 7, 2021 Ok, I solved it myself with a other approach; just overriding the config values in the function that sets up the templates: class DefaultUpgradesItem extends X2Item_DefaultUpgrades; static function array<X2DataTemplate> CreateTemplates() { local array<X2DataTemplate> Items; //Override config values default.CRIT_UPGRADE_BSC=10; default.CRIT_UPGRADE_ADV=20; default.CRIT_UPGRADE_SUP=30; default.FREE_FIRE_BSC = 10; default.FREE_FIRE_ADV = 20; default.FREE_FIRE_SUP = 30; default.FREE_KILL_BSC = 10; default.FREE_KILL_ADV = 20; default.FREE_KILL_SUP = 30; default.AIM_UPGRADE_BSC=10; default.AIM_UPGRADE_ADV=20; default.AIM_UPGRADE_SUP=30; Items.AddItem(CreateBasicCritUpgrade()); Items.AddItem(CreateAdvancedCritUpgrade()); Items.AddItem(CreateSuperiorCritUpgrade()); Items.AddItem(CreateBasicAimUpgrade()); Items.AddItem(CreateAdvancedAimUpgrade()); Items.AddItem(CreateSuperiorAimUpgrade()); Items.AddItem(CreateBasicClipSizeUpgrade()); Items.AddItem(CreateAdvancedClipSizeUpgrade()); Items.AddItem(CreateSuperiorClipSizeUpgrade()); Items.AddItem(CreateBasicFreeFireUpgrade()); Items.AddItem(CreateAdvancedFreeFireUpgrade()); Items.AddItem(CreateSuperiorFreeFireUpgrade()); Items.AddItem(CreateBasicReloadUpgrade()); Items.AddItem(CreateAdvancedReloadUpgrade()); Items.AddItem(CreateSuperiorReloadUpgrade()); Items.AddItem(CreateBasicMissDamageUpgrade()); Items.AddItem(CreateAdvancedMissDamageUpgrade()); Items.AddItem(CreateSuperiorMissDamageUpgrade()); Items.AddItem(CreateBasicFreeKillUpgrade()); Items.AddItem(CreateAdvancedFreeKillUpgrade()); Items.AddItem(CreateSuperiorFreeKillUpgrade()); return Items; } Link to comment Share on other sites More sharing options...
Dragon32 Posted November 7, 2021 Share Posted November 7, 2021 There's a XCOM 2 modding Discord it maybe worth you joining, if you didn't know about it already: https://discord.com/invite/ZytsZ93 Also this wiki: https://www.reddit.com/r/xcom2mods/wiki/index Link to comment Share on other sites More sharing options...
Recommended Posts