-
Posts
118 -
Joined
-
Last visited
Everything posted by SteelRook
-
See, my general "field of expertise" if you will is object-oriented programming, which UnrealScript is rooted for. However, UnrealScript also does a few concepts for which I've never seen counterparts in other programming languages, such as "states" and "actors." I'm more than positive that these concepts are rooted in some fairly basic OOP systems, but I'm just not entirely sure which. The same is true, to a lesser extent, about GameStates. It's clear that GameStates are classes of their own, presumably children of XComGameState_BaseObject. What I don't fully understand is why this distinction is even needed. Why do we need a GameState object as a separate thing from a Template? I presume Templates cannot be instanced, I'm told GameState objects are serialised into save game files to preserve the states of the various objects across game loads, but I don't understand what purpose the distinction serves. I could possibly see the logic if Templates were being used as Interface reference types, but I don't know if UnrealScript even supports those (Google says "yes") and it doesn't seem like any of the Templates are actually interfaces. They hold data, which disqualifies them right there. They're not virtual classes, either, so I don't see anything which would prevent the creation of Template instances. There's something here that I'm clearly missing or don't really understand. Once upon a time, I attempted to alter an ability template in memory before it was used, but the result was broken and incomplete. It would work if you loaded up a saved tactical game where a character already had that skill, but would outright fail if you loaded up a strategic game where a character had that ability. The ability would exist, but none of the effects I was adding into it would be present... And I don't know why. XCOM 2 does a lot of things at run-time in a way that I've not been able to find any real documentation on. I don't know when GameState objects are created out of the base Templates, I don't know when I can replace the individual templates and I generally don't fully understand how to mess with guns and abilities at run-time. I'm not entirely convinced we should be doing that, either. Firaxis seemed to promise a better way to override base templates at a point before they're cloned across difficulty settings, so I'll likely hold off my efforts until/unless that happens. For the time being, my one mod which modifies abilities is using a slash-and-burn approach of overriding (well, more like extending) the X2Ability_RangerAbility class. It seem like "the game" will create objects of any defined class which inherits any of the templates, and it does this after the templates themselves have been created so my class essentially replaces the base game class... Sometimes. I tried the same for X2Item_DefaultWeapons and that worked sometimes but not others. It worked if used an X2Item_DefaultWeapon, but not if I used my own child of that class. Similarly, replacing the ability only works if I forcibly generate a new template within my own ability, otherwise my method is either ignored or written over. Animeri tried to explain to me how to replace templates in runtime using UI listeners, but it seems like I'm too slow to understand that... So here we are. I'm fairly confident I can create new weapons or abilities (reusing existing assets), but I'm not in the slightest certain of how to actually put them in the game in place of the abilities already there.
-
Persistent unintended side effects from unwanted mods?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
So... Apparently something bigger is afoot here. I removed all of my mods, deleted the mods folder entirely... And I'm still getting that issue. Something somewhere in the game itself is horribly wrong, so my next available recourse is a full reinstall. This is so damn weird... Do you know if my mods will survive a full reinstall? I put them all back because they were sitting in a lot of open windows. Do you have any idea what could cause the Experimental Powered Weapons project to complete without giving me a powered weapon? Like maybe a class somewhere got corrupted? Could ModBuddy be causing this, somehow? Is there like a list of items to show up in the proving grounds available somewhere? -
Persistent unintended side effects from unwanted mods?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
I have a game saved without any mods, which is what I'm using to test this with. That was pure vanilla from before I downloaded anything whatsoever. Without mods, it works just fine, but as soon as I activate any of them - no matter which one - the problems start all over. I've not tried starting a new game as I don't know how to test the Proving Grounds, but the old save game displays the exact same issue as the new one created with all the mods enabled. That the issue persists even when I disable all the mods tells me it's rooted somewhere in the way in which mods are handled, possibly even in ModBuddy itself since I have a few "local" mods from that, as well. I'll try unsubscribing from all mods tomorrow at some point, just... frustrating, is all. -
Persistent unintended side effects from unwanted mods?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
Nope, same as before, which blows my mind... I deleted all of the config files, ran the game and the issue isn't there. As soon as I reenabled my tattoo mods, the issue returned. I don't understand how texture additions, prop additions and a mod which adds more parcels to map generation can ever impact the Advanced Warfare Centre. I thought this was being caused by either the Ultimate Workshop or the Armoury Extension mods but those aren't actually active! I'll try deleting all the mods I'm not actually running and see what happens. By "clearing" I mean "unsubscribing and deleting them from my workshop." I don't like doing that as it might mess with mod-makers' metrics, though... *edit* Nope! Even that didn't work. This time I wasn't able to build Experimental Powered Weapons even with no mods active... -
Persistent unintended side effects from unwanted mods?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
I have not, actually. I'll go do that right now. However, here's what I did try: If I "verify integrity of game cache" the problem goes away on first launch. As soon as I enable seemingly any mod whatsoever, however, the bug reasserts itself. I've tried clicking the "reload" button on the Mods launcher which wipes out mod selection. Following that, the problem goes away on first launch. As before, however, it reasserts itself as soon as I enable any mod whatsoever. I hadn't thought to disable the ini files for fear of deleting my own saved games (an empty fear, I know), but I'll go try that and get back to you. -
I'd still say it's worth having this as a separate discussion, though, as it's fairly central to how XCOM handles its own innards. I say this as someone who doesn't fully understand how that works, exactly, in the sense of when a template is called to create a gamestate object from itself. I had huge issues with this exact thing as I was apparently attempting to tweak templates "too late" or else in a way that wasn't able to affect the game states properly.
-
I'm facing a rather serious issue which I believe is related to modding, though in a roundabout way. At one point, I downloaded and activated a great many mods from the Workshop without really reading what they did. Eventually I removed some of them via the "Ignore Missing Content" mod, which naturally caused the save game to become corrupted, exactly as the mod warned me. However, the problem is that the issue has persisted even after disabling all mods. The issue in question is: Dud Proving Grounds projects. For instance, I'll start an Experimental Powered Weapons project. When that completes, it tells me that the project has completed, but doesn't give me an item. Normally when I get an item, the pop-up tells me what item I got, not that the project has completed. This happens only sometimes but not at other times, leading me to believe that the game is trying to generate an item which doesn't exist. It's basically impossible for me to troubleshoot which mod is causing this issue when it happens even without the mods. Does anyone have any idea what could be causing this? I can list the mods I have downloaded on my system right now, both active and inactive if you feel that's relevant, but it just seems highly unlikely that extra tattoos or ini tweaks to the UI could be causing this to happen and I don't want to just blame mods on basic suspicions. The mere fact that this issue happens even when all mods are disabled... Concerns me. Forget making mods, I can barely make the ones I already have work.
-
Template Modification Without ScreenListeners
SteelRook replied to eXecator's topic in XCOM's XCOM 2
Ah, I see. That actually explains a lot, and also explains why attempts to override static functions nevertheless "seem" to work but only sometimes. And it only makes me nervous because I'm naturally skittish of doing things software wasn't intended to do. It's great when it works, but I'm usually not smart enough to figure out why it works and why it fails :) In either case, thank you kindly. -
Template Modification Without ScreenListeners
SteelRook replied to eXecator's topic in XCOM's XCOM 2
I'm not sure I follow... Are you overriding the X2AmbientNarrativeCriteria class? Or does simply extending it do the same job? This is very interesting sutff, but it also makes me very very nervous to read through :) Hopefully, Firaxis themselves will implement a sane way of messing with base templates at some point, as that seems like the majority of what people want to do. In either case, thank you for the explanation. -
OK, I'm running into severe problems, and this is BAD because the mod's actually on the Workshop now. Something is horribly wrong with the way I insert the Blademaster skill into the game. It has the following behaviour - when loading a saved Tactical game where the soldier already has Blademaster, everything works as intended. When loading a Strategic game where a soldier has Blademaster, that skill simply doesn't end up making it into the character's skillset when a Tactical game is loaded. I'm really at a loss as to what's going on here. Clearly, I failed to comprehend something that was being said here. Clearly, I'm doing something wrong and I may end up having to replace an entire class. I have to ask, then - suppose I want to replace an entire ability (in this case Blademaster) - with an entire other ability, but without using mod class overrides. How could I accomplish this? Because creating a brand new ability just doesn't seem to be working. I can't use the ability class defaults since I need to extend UIScreenListener, and I'm out of ideas as to how to do this without overriding stuff in the Ranger class. I really, REALLY need help for this one because that's starting to not work for people... *edit* Because people are actually using the mod now, I had to make it work RITE NAO. For this reason I had to go with the "nuclear option" of overriding the X2Ability_RangerAbilitySet class. I don't like doing this because it's hell on mod compatibility, but I know it works 100% of the time (unlike overriding DefaultWeapons). I definitely want to go back to changing this via a listener, but it's clear I'm not smart enough to make that happen on my own. I'm really, REALLY going to need help getting this to work. There's something about this that I simply don't understand, some step where all of the abilities are "written down" and don't get lost between loads. I don't know how to do this.
-
I figured it out, and I should have known. ModBuddy is really really picky when you edit files outside the editor (as I'd need to, in order to put together the stupid pics I use for thumbnails). Turns out I needed to "Build Solution" for everything to take effect. Since I'm doing one of those "baby's first mod" attempts that's just changing six lines in two ini files, I forgot to do that. It's working OK now.
-
Well, I already have an image file in that place, I can open it and look at it and it's really not that big - 105KB. It's not loading, however. Is it because it's larger than 100K? Or because my project is called "XCOM 2 Siege?"
-
I've already published one mod and I found it to be a very awkward process. I know it's done through Tools -> Publish Mod but the process leaves me confused and asking questions. Questions like: How do I upload display image for the mod? The first time I tried, it just picked up the image from ModPreview.jpg, but I'm trying to upload a second mod and it's not working - I get a black screen. How do I set up an automatic Mod Description? It just pulls the one I gave when first making the mod which is no longer accurate but I can't change it. How can I make ModBuddy remember my tags selection? It keeps defaulting to empty. Assuming I've already mistakenly uploaded a mod with no image attached, no description and no tags, how can I change the display image, the description and the tags? Well, I did find a fairly simple way to change the description, but neither display image nor tags seems to have an easily-recognisable option to edit.
-
Can we use this to outright replace templates with our own individual UnrealScript code? This is my biggest bugbear at the moment - the hoops we have to jump through in order to replace, say, one ability which does something completely different from what it does in vanilla. Say replace the Death From Above ability template with one which grants bonus to-hit for having the high ground?
-
Can I mess with Squadsight penalties in real time?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
So far, my plan is to use a version of the Steady Hands approach for Death From Above, but the way that effect is hooked up confuses me a little. Code snipper from X2Ability_SharpshooterAbilitySet follows: local X2Effect_Persistent PersistentEffect; local X2Effect_PersistentStatChange StatChangeEffect; // this effect stays on the unit indefinitely PersistentEffect = new class'X2Effect_Persistent'; PersistentEffect.EffectName = 'SteadyHands'; PersistentEffect.BuildPersistentEffect(1, true, true, false, eGameRule_PlayerTurnBegin); PersistentEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyHelpText(), Template.IconImage, true,,Template.AbilitySourceName); // each turn this effect is applied StatChangeEffect = new class'X2Effect_PersistentStatChange'; StatChangeEffect.EffectName = 'SteadyHandsStatBoost'; StatChangeEffect.BuildPersistentEffect(1, false, true, false, eGameRule_PlayerTurnEnd); StatChangeEffect.AddPersistentStatChange(eStat_Offense, default.STEADYHANDS_AIM_BONUS); StatChangeEffect.AddPersistentStatChange(eStat_CritChance, default.STEADYHANDS_CRIT_BONUS); This is how Steady Hands is defined (the rest of the function is utility settings). Basically, there's a persistent effect which does nothing but apply a non-persistent effect on every "tick," with the tick event being the start of the player's turn. What I don't understand is why this is needed. Why not use just a simple X2Effect_Persistent and bake the logical checks inside its return functions? Or can X2Effect_Persistent not handle aim bonuses? Hmm... It doesn't seem like there are functions for handling aim or critical hits in there. Interesting. This brings up the question - how does one give conditional aim bonuses to a soldier, then? Do I HAVE to use a non-persistent effect? -
Can I mess with Squadsight penalties in real time?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
I'm not familiar with "modifyStat." How does that work? That seems possible to do if I can read the distance to target and use that as the basis of the bonus. I was thinking of maybe using a PersistentEffect with an internal logical check to see if the soldier has a height advantage on the target. -
Can I mess with Squadsight penalties in real time?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
Which part are you referring to with "not really?" I don't mean to be rude and I do apologise if it comes across that way. I just can't follow which approach you're referring to being harmless and less bug prone. Confusion on my part. -
Can I mess with Squadsight penalties in real time?
SteelRook replied to SteelRook's topic in XCOM's XCOM 2
Too simple, in the sense that it's an ini file tweak to change the squad sight penalty value globally. I'm trying to change it conditionally based on what skills the sniper has. I want my "Sniper" sharpshooters to suffer less of a range penalty than my "Gunslinger" sharpshooters, which means I need to change the penalty at runtime. Or I guess cheat by adding aim to counter the squad sight penalty but that's a horrible way of doing it. -
Is that all your feedback consists of? That generally means that there's a compilation error in a class file somewhere, and my log typically tells me which one and on which row. Have you made the editor give you more verbose feedback? I forget exactly how that was done, but it was somewhere in the documentation.
-
Just for my own personal curiosity - is there any way I can mess with Squadsight aim penalties in real time as the game is running? I'm mulling over a new project somewhere in the future which replaces Death From Above completely with a brand new sniper-enhacing skill. One of my ideas was for that skill - still called "Death From Above" - to remove or lessen the squad sight aim penalties at range against targets that the sniper has a height advantage on. I tracked down the Squad Sight aim penalties to a frighteningly large function which seems to handle all aim calculations in the game, one that's obviously not a good candidate for tinkering with. On cursory examination, that more or less makes squad sight penalties not subject to being altered by skills. Does anyone know how that works? To be honest, I liked the Damn Good Ground skill from Enemy Within more than Death From Above. If messing with squad sight falls through, then I'll probably just have to replace the skill with an aim and crit bonus for having the high ground, probably dependent on weapon tech level again.
-
Certainly, though mine is a tale of woe :) I spent a lot of time trying to figure out how the abilities worked, and ended up trying to create a mash-up of three things. Bladestorm uses a X2Effect_BonusWeaponDamage object to deliver its extra damage, but it doesn't check for weapon tech level. I knew Gremlin skills check for weapon tech level, so I discovered that Aid Protocol uses a X2Effect_AidProtocol special effect to deliver its defence. Internally, that effect pulls the Gremlin template and draws on special variables written in the weapon itself. I tracked down where the weapon is defined in X2Item_DefaultWeapons.uc and saw that these values are given to it at weapon initialisation. This originally prompted me to try and do the same for swords. I would override the three sword-creation functions in X2Item_DefaultWeapons, then redesign them to create a special sword template of my own. This sword template would inherit X2WeaponTemplate and basically just add two extra variables - a damage boost and an AP boost. I'd then do what Aid Protocol did and create a unique damage effect class of my own which would directly ask the sword for those values and add them to the returned damage. This, in turn, would require me to overwrite the ability template creation function responsible for the creation of Blademaster. The above attempt failed spectacularly, by which I mean it failed to work consistently. I did actually manage to overwrite both static functions, but in a very weird way. If I replaced the X2WeaponTemplate in X2Item_DefaultWeapons with another class, then the overwrite would fail - either at the overwrite stage or somewhere down the line. If I didn't, it would work and accept my additional values. So that didn't work at all. This is where this thread ballooned as much as it did as I tried a whole bunch of other methods to replace the weapon and skill templates. Originally, I tried X2DownloadableContentInfo class and its OnLoadedSavedGame() function, but that only worked the first time a non-modded save was loaded. Restarting the game would wipe my changes. I then tried a UIScreen listener as per this thread, and that worked... Kind of. I still couldn't replace the weapon template as that would only replace them for the "default" difficulty, which I believe is Veteran. I couldn't replace the templates for other difficulties, since there's no way to get them without literally changing the game's difficulty, which doesn't work in the main menu and works in a difficult fashion in a Tactical mission, that I could determine. In the end, I scrapped altering the weapon template AT ALL and just altered the Blademaster ability template itself. I replaced it entirely with a brand new ability template of my own creation, one which used my own version of the bonus damage effect. The idea was that that extra bonus damage effect would poll the swords for their tech level and assign bonus damage accordingly. This was until I found that the Magnetic Sword's tech level is set to Conventional in the files, likely a copy/paste error. I ended up having to dig through the class files and eventually decided to check for DataName. That's great, except it won't work for any new sword weapons added to the game, such as the Katana. And this is where I am now. Let me give you a class-by-class breakdown. --- *ModInitialiser. This is the "hook" I'm using to put my new code in the game. This class is nothing more than a UIScreenListener set to listen to every screen in the game, so it fires right in the main menu. It has a run-once check, however, so it shouldn't kill performance. What that class does is it pulls the Bladestorm template out of the ability template manager, creates a brand new ability template, copies all of the values from the old ability, then replaces the new ability in the template manager. I'm having some odd icon issues with the thing - if I copy the icon from the old template into the new one, it doesn't show up at all. I had to put the icon string directly in the mod initialiser. Not sure what's going on in there. Basically, this is an attempt to copy the exact same Blademaster ability, except put a X2Effect_BonusEffect_Blademaster effect in it instead of the X2Effect_BonusWeaponDamage one that it has. I didn't want to change anything else. *X2Effect_BonusEffect_Blademaster. This is where the "magic" happens. This class models my unique bonus effect. It extends the basic X2Effect_Persistent, it has seven internal variables (3 for damage, 3 for AP, one for "base") which it pulls out of its own config file for easy adjustment. X2Effect_BonusEffect_Blademaster is a combination of the way Blademaster gets its bonus damage and the way AP Rounds add their armour penetration. Both use a version of X2Effect_Persistent but override different functions, so I just put both functions in the same class. The functions check the weapon which called the skill. If it's a sword, they do something. They then check the sword template's name and return bonus damage or AP accordingly. Bonus damage is calculated as base damage + bonus damage, obviously. *XComBlademasterEnhancement.ini. This is the config file where all seven variables' values are defined. I could have hard-coded that in the script, but I like to give users an easy way to tweak stats. I put BonusDmamageBase in there because I couldn't figure out a way to copy the bonus damage of the vanilla Blademaster skill. I originally had it hardcoded to +2, but decided it's better to let players set it themselves. It's not as good as using what's in the game's own ini files, but at least it's not hardcoded. I still don't know how to change the ability's textual description and its icon is behaving... Oddly. But it works for the moment.
-
OK, the mod has been updated to the Steam Workshop. It seems to work so far. If anyone is interested in the full source code (what little of it there is), feel free to check it out. In fact, I would very much appreciate some amount of feedback because this really is... Kind of a mess :) http://steamcommunity.com/sharedfiles/filedetails/?id=629508924
-
I haven't been able to get it to work, unfortunately. I tried doing that with the function which fires once on loading a new save without the mod and that successfully changed the stats once. Then as soon as I quit and reloaded the tactical game in progress, the ability was back to its default stats from the unmodded game. The only way I could get this to work was to use the UIListener you suggested in the other thread, with a single-iteration boolean check to make sure it doesn't keep messing with stats constantly. That's what eventually fixed it for me, and now it works consistently just because I force the change at the first available UI element. Originally, I thought for sure that weapon stats would be remembered in the save game itself but - as I said - that hasn't worked for me. Save games made with modded items and abilities will "un-mod" themselves on game restart for me. I'm almost done with the thing anyway, so I can show you the whole thing as soon as it's viable for the Workshop. I'd love to be able to pull the BonusDmg value out of the template for 'Blademaster' but so far I haven't been able to do that. It's probably useful to change its text description, too, though I haven't been able to find where those are set. I don't want to post humongous code blocks in the posts themselves, which is why I want to push this to the Workshop at first available opportunity and disseminate it that way.
-
I don't know, it doesn't feel like I'm doing much on my own. Most of this mod is put together from the stuff you guys have told me, or at the very least it's based on your explanations and suggestions. A lot of my efforts were spinning wheels in the mud, as well. Just now I axed three entire classes and one ini file :) I got it to work, eventually, but the format is... Odd. It seems to me like the game expects all the ini files to be called XCom___, but you're not supposed to put that part in the actual config definitions. As such, I ended up calling my config file XComBlademasterEnhancement.ini, but declared it as a config file as config(BlademasterEnhancement). That took a few tries to figure out and I'm not entirely sure why it's even the case. My sneaking suspicion is this is to account for the difference between the "default" ini files which live in Steam and the implemented "XCom" ini files which live in My Documents. In either case, it works now, seemingly. All I have left to do is figure out how to pull the X2Effect_BonusWeaponDamage template out of the X2AbilityTemplate representation of the Blademaster ability. I already have a reference to the ability template itself and I know it stores its ability effects inside an array, but I've so far not been able to pull items out of that array. If you saw my comment on "getters" in the developer thread, this is what that was a reference to. I don't know how to get the templates of the effects an ability has.
-
That's a problem, though, because the altered weapon stats are lost when quitting the game, which will have the knock-on effect of removing the ability if I save mid-tactical-mission and quit the game. For the time being, I've bitten the bullet and I'm currently overriding the entire ability template. That is to say - I pull the template from the ability templates manager, create a brand new ability, copy stats over from the old one, then outright replace the old one in the template manager with the new one. My head is about to split in half, this practice works so I'm likely going to stick with it until we gain the ability to overwrite base game templates. I'll fix it up nice and tidy at that point. Honestly, at this point I'm having recurring nightmares about this mod. Seriously. I dream of conditional statements... But at least it's almost done. Using brute-force approach of replacing the entire ability template with my own ability template of choice, using my own version of a damage effect, then checking each individual weapon for its DataName because the TechLevels aren't set properly works. The correct damage and armour penetration is applied to the correct weapon. I still have a few more things to finish up, but it looks to me like this is almost finished and should be ready for distribution. Then I'm going to sleep for 10 hours because I'm beginning to stress out. *edit* I do have a few things left to do to "pretty it up" that I don't know how to do. I'd like to create a mod-specific ini file where the actual stats would be, and I'm not entirely sure how that works. I also have an issue accessing the BonusDmg of the original Blademaster skill. For the time being, that's hard-coded to 2 since I couldn't pull it out of the old skill before replacing it. If you guys can help me solve those two, then I should be able to just throw this thing onto the Workshop and actually make it usable.