Kregano Posted April 11, 2016 Share Posted April 11, 2016 (edited) I've been trying to get a mod adding new GTS abilities off the ground and I've gotten a bunch of stuff done, like a UIScreenListener to update the GTS ability list, the ability unlock stuff, and the abilities themselves. Unfortunately, whenever I go to the GTS in the debug strategy layer, the abilities show up without any text. There's no ability name, no description, just the class unlock requirement and supply cost. Here's the code I've got for the most likely culprits (all subject to change): [shadowmanUnlock X2SoldierAbilityUnlockTemplate]+DisplayName="Shadowman"+Summary="Killing enemies while concealed doesn't break concealment."[shadowman X2AbilityTemplate]+LocFriendlyName="Shadowman"+LocHelpText="Killing enemies while concealed doesn't break concealment."+LocLongDescription="Killing enemies while concealed doesn't break concealment."[MFortitudeUnlock X2SoldierAbilityUnlockTemplate]+DisplayName="Mental Fortitude"+Summary="Soldier is immune to panic, disorientation, stun and unconscious status effects."[MFortitude X2AbilityTemplate]+LocFriendlyName="Mental Fortitude"+LocHelpText="Soldier is immune to panic, disorientation, stun and unconscious status effects."+LocLongDescription="Soldier is immune to panic, disorientation, stun and unconscious status effects." class UIScreenListenerNewGTS extends UIScreenListener config(NewGTSSkillsShadowmanandmore); //Credit to BlueRaja for writing good code and putting his source files on GitHub https://github.com/BlueRaja/XCom2Mods var bool didUpdateTemplates; // This event is triggered after a screen is initialized event OnInit(UIScreen Screen) { if(IsStrategyState()) { if(!didUpdateTemplates) { AddShadowmanUnlockTemplate(); AddMFortitudeUnlockTemplate(); didUpdateTemplates = true; } } } function AddShadowmanUnlockTemplate() { local X2StrategyElementTemplateManager templateManager; local X2FacilityTemplate Template; templateManager = class'X2StrategyElementTemplateManager'.static.GetStrategyElementTemplateManager(); Template = X2FacilityTemplate(templateManager.FindStrategyElementTemplate('OfficerTrainingSchool')); Template.SoldierUnlockTemplates.AddItem('ShadowmanUnlock'); } function AddMFortitudeUnlockTemplate() { local X2StrategyElementTemplateManager templateManager; local X2FacilityTemplate Template; templateManager = class'X2StrategyElementTemplateManager'.static.GetStrategyElementTemplateManager(); Template = X2FacilityTemplate(templateManager.FindStrategyElementTemplate('OfficerTrainingSchool')); Template.SoldierUnlockTemplates.AddItem('MFortitudeUnlock'); } function bool IsStrategyState() { return `HQGAME != none && `HQPC != None && `HQPRES != none; } // This event is triggered after a screen receives focus event OnReceiveFocus(UIScreen Screen); // This event is triggered after a screen loses focus event OnLoseFocus(UIScreen Screen); // This event is triggered when a screen is removed event OnRemoved(UIScreen Screen); defaultproperties { // Leaving this assigned to none will cause every screen to trigger its signals on this class ScreenClass = none; } Edited April 11, 2016 by Kregano Link to comment Share on other sites More sharing options...
davidlallen Posted April 12, 2016 Share Posted April 12, 2016 In the localization file, don't use + at the beginnings of the lines. Link to comment Share on other sites More sharing options...
Kregano Posted April 12, 2016 Author Share Posted April 12, 2016 Experimented with having the plus signs there or not there, and it doesn't matter. No text displays at all. I even tried switching display name to LocFriendlyName and got nothing, Link to comment Share on other sites More sharing options...
davidlallen Posted April 12, 2016 Share Posted April 12, 2016 Sorry for checking basics. The file you have put this text into is localization/XComGame.int, and this file is in your modbuddy build list, and you can see this file in your compiled mods directory afterwards? I don't agree with the approach of screenlisteners since you can easily extend these classes and use CreateTemplate, but I don't see any obvious problem in what you posted. I am sure you have checked the spelling of the definitions you didn't post here, to make sure they match the names which are in the localization file. Link to comment Share on other sites More sharing options...
Kregano Posted April 12, 2016 Author Share Posted April 12, 2016 Sorry for checking basics. The file you have put this text into is localization/XComGame.int, and this file is in your modbuddy build list, and you can see this file in your compiled mods directory afterwards? I don't agree with the approach of screenlisteners since you can easily extend these classes and use CreateTemplate, but I don't see any obvious problem in what you posted. I am sure you have checked the spelling of the definitions you didn't post here, to make sure they match the names which are in the localization file.I did create new templates for these abilities and unlocks, but they didn't show up in the GTS tactics list without the screenlistener. I could try extending the GTS unlocks directly and overriding the list there, but none of the mods I've looked at use that method, nor do they seem to have the same problems. Link to comment Share on other sites More sharing options...
davidlallen Posted April 12, 2016 Share Posted April 12, 2016 Unfortunately the first few mods used screenlisteners, and now most people make the same conclusion you did. Sorry, I cannot think of any reason why your localization text is not working. All of mine works. The only other suggestion I can make is to check each file over again one more time, against some other mod which is working. Every time I do this, I find "just one more thing" which is different which I missed the other four times I checked. Then it works. Link to comment Share on other sites More sharing options...
Kregano Posted April 13, 2016 Author Share Posted April 13, 2016 Well, I managed to sort it out. Apparently, I needed to put the localization stuff for the ability itself before the unlock, then everything worked. Also, I figured out how to avoid using a screenlistener to add GTS skills, but I think it's an override of the GTS template. Link to comment Share on other sites More sharing options...
davidlallen Posted April 14, 2016 Share Posted April 14, 2016 IMHO extending (overriding) templates is a much better approach. Link to comment Share on other sites More sharing options...
Recommended Posts