SteelRook Posted February 16, 2016 Author Share Posted February 16, 2016 I swear, half the time I'm fighting UnrealScript, half the time I'm fighting ModBuddy. Right now, ModBuddy has gotten it into its head that two of my classes have been "modified outside the source editor" and I can't force it to just frikkin' save over them. Why is this a problem? Why does Visual Studio consistently and utterly fail to find its own damn files? Gah! You dont need to listen to the ability you can override the template from wherever you want, the listener and triggers are there to notify you of when stuff happens, there is a bit of code that handles the loading, and try and look for somewhere you can put an event trigger in there, you could even possibly trigger once on each tactical mission start which would make for much less spam and there is already an eventTrigger for that one, i used it for some time for red fog but it was too wasteful for me as i needed just to take hit events and nothing else, talking about that i could call the medikit template replacement code from something similar to that to reduce spam but that'll come when i have a reason to reorganize my code to be readable to other human beingsI'm not convinced that'll be any better, unfortunately. If my suspicion is correct and all of my templates get overridden on game start, then that means any save game inside a mission will still end up with the wrong sword template if you happen to shut down the game and reload while inside the mission. I'm experimenting with X2DownloadableContentInfo at the moment, see if that works on first load... If ModBuddy will actually save my class files, that is. Link to comment Share on other sites More sharing options...
Deleted32045420User Posted February 16, 2016 Share Posted February 16, 2016 I swear, half the time I'm fighting UnrealScript, half the time I'm fighting ModBuddy. Right now, ModBuddy has gotten it into its head that two of my classes have been "modified outside the source editor" and I can't force it to just frikkin' save over them. Why is this a problem? Why does Visual Studio consistently and utterly fail to find its own damn files? Gah! I'm not convinced that'll be any better, unfortunately. If my suspicion is correct and all of my templates get overridden on game start, then that means any save game inside a mission will still end up with the wrong sword template if you happen to shut down the game and reload while inside the mission. I'm experimenting with X2DownloadableContentInfo at the moment, see if that works on first load... If ModBuddy will actually save my class files, that is.ahh yeah i know that feeling.... man how much would i have liked if this was in UE4 and C++ /Blueprints instead....Yeah templates are overriden on game start but i dont think the ContentInfo loads every time but just the first time, another idea is again with listeners- listen to the start of a turn and filter out if your sword is already in the template manager if not just insert it in there, should be less intensive than just adding it over and over each time but more expensive than the overriding code working like it was written by professionals Link to comment Share on other sites More sharing options...
SteelRook Posted February 16, 2016 Author Share Posted February 16, 2016 Well, OnLoadedSavedGame worked, so at least the replacement code works. Honestly, so far it seems to be sticking despite saving with the mod, then quitting, then restarting, then saving with the mod again. Now, the implementation is still hella rough, in that all I'm changing is the base damage of the sword to 100, but that at least proves my stat changes work and seem to keep... Now to actually integrate the sword-specific boosts! Also I fixed the "modified outside the source editor" issue. For some reason ModBuddy was redirecting my changes to "miscellaneous" versions of my source files that it created without prompt. Deleted those, went back to editing the actual source files and everything is good in the world again. Will hard-code stats for the moment, see what happens. Link to comment Share on other sites More sharing options...
davidlallen Posted February 16, 2016 Share Posted February 16, 2016 Looks like we need a tutorial or list of common gotchas for modbuddy too. It puts those files into miscellaneous when you click on the error message it shows you. Link to comment Share on other sites More sharing options...
SteelRook Posted February 16, 2016 Author Share Posted February 16, 2016 (edited) Looks like we need a tutorial or list of common gotchas for modbuddy too. It puts those files into miscellaneous when you click on the error message it shows you. Yeah, I figured that out through trial and error. Literal error, in this case. I'm so used to clicking on error messages and being taken to the offending line, but I'm not used to it spawning unexpected copies of the source files... Also, I retract my previous statement. My changes do not, in fact, work. What was working was my old mod override, because of another common "gotcha." ModClassOverrides calls are actually added to the games XcomEngine.ini, so the overrides actually keep working even when you disable them in your config file. Unbeknownst to me, the old ModClassOverrides were still active and that's what was causing the extra damage, not my template replacements. Let me show you guys what I'm trying to do, you let me know if I'm way off-base: class X2DownloadableContentInfo_BlademasterEnhancement extends X2DownloadableContentInfo; static event OnLoadedSavedGame() { local X2ItemTemplateManager ItemTemplateManager; local X2SwordTemplate NewTemplate; local X2WeaponTemplate OldTemplate; local X2AbilityTemplateManager AbilityTemplateManager; local X2AbilityTemplate NewAbilityTemplate; local X2AbilityTemplate OldAbilityTemplate; local X2Effect_BonusEffect_Blademaster DamageEffect; ItemTemplateManager = class'X2ItemTemplateManager'.static.GetItemTemplateManager(); OldTemplate = X2WeaponTemplate(ItemTemplateManager.FindItemTemplate('Sword_BM')); `CREATE_X2TEMPLATE`(class'X2SwordTemplate', NewTemplate, 'Sword_BM'); //extra symbol for colouring //copy stats from OldTemplateManager onto NewTemplateManager, add new stats ItemTemplateManager.AddItemTemplate(OldTemplate, true); AbilityTemplateManager = class'X2AbilityTemplateManager'.static.GetAbilityTemplateManager(); OldAbilityTemplate = AbilityTemplateManager.FindAbilityTemplate('Blademaster'); `CREATE_X2ABILITY_TEMPLATE`(NewAbilityTemplate, 'Blademaster'); //extra symbol for colouring //copy stats from OldAbilityTemplateManager onto NewAbilityTemplateManager, add new stats AbilityTemplateManager.AddAbilityTemplate(NewAbilityTemplate, true); } I was positive this would work at least once, the first time I loaded a game without the new DLC, but that doesn't seem to be the case... Edited February 16, 2016 by SteelRook Link to comment Share on other sites More sharing options...
Deleted32045420User Posted February 17, 2016 Share Posted February 17, 2016 "Easily moddable"...."More accessible than ever!" they were right but sadly those words are feeling kinda empty over here, at least for us coders...or it could just be me frustrated and tired Link to comment Share on other sites More sharing options...
Kvalyr Posted February 17, 2016 Share Posted February 17, 2016 One final question - how does the `log macro work? I mean, I know HOW it works, but I can never find the actual logs it supposedly creates. I'd love to use it to test variable values at various points in the code, but I haven't been able to get it to work. That macro sends messages to the console window that opens alongside the main game window when you launch the game in debug mode from ModBuddy. Link to comment Share on other sites More sharing options...
SteelRook Posted February 17, 2016 Author Share Posted February 17, 2016 Ah. But that window closes itself back up as soon as I launch the game itself. It only stays open while the Launcher is running. Link to comment Share on other sites More sharing options...
Kvalyr Posted February 17, 2016 Share Posted February 17, 2016 Looks like we need a tutorial or list of common gotchas for modbuddy too. It puts those files into miscellaneous when you click on the error message it shows you. Yeah, I figured that out through trial and error. Literal error, in this case. I'm so used to clicking on error messages and being taken to the offending line, but I'm not used to it spawning unexpected copies of the source files... Also, I retract my previous statement. My changes do not, in fact, work. What was working was my old mod override, because of another common "gotcha." ModClassOverrides calls are actually added to the games XcomEngine.ini, so the overrides actually keep working even when you disable them in your config file. Unbeknownst to me, the old ModClassOverrides were still active and that's what was causing the extra damage, not my template replacements. Let me show you guys what I'm trying to do, you let me know if I'm way off-base: //copy stats from OldTemplateManager onto NewTemplateManager, add new stats ItemTemplateManager.AddItemTemplate(OldTemplate, true); Shouldn't you be passing NewTemplate in here? I feel like creating a whole new template class (X2SwordTemplate) is adding unnecessary complexity here. What does that offer you over simply modifying values in-place on the old template? Existing templates can be modified by simply grabbing them from memory and editing them in-place. You don't even need to add them back into the template pool via the manager. I would do something like this instead: OldTemplate = X2WeaponTemplate(ItemTemplateManager.FindItemTemplate('Sword_BM')); OldTemplate.BaseDamage = 9999; // Or whatever changes you want to make Link to comment Share on other sites More sharing options...
Deleted32045420User Posted February 17, 2016 Share Posted February 17, 2016 it's on where the regular logs are on Documents\my games\XCOM2\XComGame\Logs Link to comment Share on other sites More sharing options...
Recommended Posts