Deleted32045420User Posted May 21, 2016 Share Posted May 21, 2016 Try if(WeaponTemplate.StartingItem == none) Link to comment Share on other sites More sharing options...
Kregano Posted May 21, 2016 Author Share Posted May 21, 2016 Didn't work: E:\SteamLibrary\SteamApps\common\XCOM 2 SDK\Development\Src\SuppressionWeapons\Classes\X2DownloadableContentInfo_SuppressionWeapons.uc(46) : Error, Const mismatch with '==' Link to comment Share on other sites More sharing options...
Deleted32045420User Posted May 21, 2016 Share Posted May 21, 2016 this should work: if (WeaponTemplate == none) Link to comment Share on other sites More sharing options...
Kregano Posted May 22, 2016 Author Share Posted May 22, 2016 This is interesting - ever since I started working on some MCM hooks, ModBuddy is now saying the name of the function that adds Booleans to the template is a problem: static event OnPostTemplatesCreated() { if (class'SuppressionWeaponsSettings'.default.CENTRAL_ENABLED == true) { `log("Infinite Multipurpose Combat Rifles!"); UpdateTemplate('AssaultRifle_Central'); //this is line 33 } static function UpdateTemplate(Name BaseTemplateName) { local X2ItemTemplateManager ItemTemplateMgr; local X2WeaponTemplate WeaponTemplate; local array<X2DataTemplate> DataTemplates; local int i; ItemTemplateMgr = class'X2ItemTemplateManager'.static.GetItemTemplateManager(); ItemTemplateMgr.FindDataTemplateAllDifficulties(BaseTemplateName, DataTemplates); for (i = 0; i < DataTemplates.Length; ++i) { WeaponTemplate = X2WeaponTemplate(DataTemplates[i]); if (WeaponTemplate.StartingItem == none) { return true; } else { return false; } if (WeaponTemplate.bInfiniteItem == none) { return true; } else { return false; } } } E:\SteamLibrary\SteamApps\common\XCOM 2 SDK\Development\Src\SuppressionWeapons\Classes\X2DownloadableContentInfo_SuppressionWeapons.uc(33) : Error, 'UpdateTemplate': Bad command or expression I can't tell if this is a legit error or some weird ModBuddy problem, since it recently decided that clicking on an error report to get to the file in question opens a separate copy of the file that doesn't count as part of the project. Link to comment Share on other sites More sharing options...
Deleted32045420User Posted May 22, 2016 Share Posted May 22, 2016 static event OnPostTemplatesCreated() { if (class'SuppressionWeaponsSettings'.default.CENTRAL_ENABLED == true) { `log("Infinite Multipurpose Combat Rifles!"); UpdateTemplate('AssaultRifle_Central'); //this is line 33 } //You forgot this one closing bracket, oh and another advice- keep spacing consistent, it'll help with stuff like that } Link to comment Share on other sites More sharing options...
Kregano Posted May 22, 2016 Author Share Posted May 22, 2016 (edited) Managed to find another missing bracket thanks to ideone.com, but now I'm stuck with ModBuddy having problems with the opening bracket for the AddAbilities weapon/ability listing chunk of code. Wrapping all of the different code chunks inside another pair of brackets doesn't seem to do anything, so I'm not sure what to do here. Can I even set up an array of stuff this hook is supposed to do? Edited May 23, 2016 by Kregano Link to comment Share on other sites More sharing options...
abeclancy Posted May 23, 2016 Share Posted May 23, 2016 Your code doesn't make any sense. UpdateTemplate() doesn't have a return type, yet the code contains "return true" and "return false" in the loops. It is difficult to read due to the wild spacing and bracketing. The code in that post (14) shouldn't compile: UpdateTemplate is an invalid function. Link to comment Share on other sites More sharing options...
Kregano Posted May 23, 2016 Author Share Posted May 23, 2016 Your code doesn't make any sense.That would be due to me not knowing anything about C++, nor finding any tutorials on how to insert booleans into already existing templates. Link to comment Share on other sites More sharing options...
abeclancy Posted May 23, 2016 Share Posted May 23, 2016 Ahh. You should be looking at "UnrealScript", as that is the language of this modding. This website is good reference material for UnrealScript 3: https://udn.epicgames.com/Three/UnrealScriptFunctions.html There's some fundamental misunderstandings you have with the code you provided. For example, bInfiniteItem is a boolean itself. You can test it by `if (WeaponTemplate.bInfiniteItem)`, and change it via `WeaponTemplate.bInfiniteItem = true;`. It might help if you explain in detail what you are trying to accomplish with this code. Link to comment Share on other sites More sharing options...
Kregano Posted May 23, 2016 Author Share Posted May 23, 2016 Ahh. You should be looking at "UnrealScript", as that is the language of this modding. This website is good reference material for UnrealScript 3: https://udn.epicgames.com/Three/UnrealScriptFunctions.html There's some fundamental misunderstandings you have with the code you provided. For example, bInfiniteItem is a boolean itself. You can test it by `if (WeaponTemplate.bInfiniteItem)`, and change it via `WeaponTemplate.bInfiniteItem = true;`. It might help if you explain in detail what you are trying to accomplish with this code.Yeah, I tried looking at that. It doesn't really help either, since I don't know what I need to call to get things to work. As for what I am trying to accomplish, I want the Multipurpose Combat Rifle (Bradford's rifle/AssaultRifle_Central) to be an infinite item and a starting item. The two best courses to getting this done are making a slightly modified template and making a function that forces it to replace the original one, or make a function that adds the Template.StartingItem and Template.bInfiniteItem booleans and their values to the existing template. Not knowing how to accomplish this, I totally failed at it. Link to comment Share on other sites More sharing options...
Recommended Posts