Jump to content

Changing Death from Above; getting back into modding


SteelRook

Recommended Posts

So I stopped messing with XCOM 2 mods back in February after my Blademaster Enhancement mod ended up being a major pain. I'd like to get back into modding with my other long-time dream - turning Death From Above into a skill which negates (or counters) the Squad Sight aim penalty to some extent (I'm thinking halving it). This leads to two separate questions.

 

1. How does ability replacement work now? Previously, I ended up forced to basically create and load a duplicate skill, which - through crossed fingers - XCOM 2 would load instead of the default one. I remember there being a patch something like a month ago when a lot of the Static methods were to be replaced with non-static ones, but abilities don't seem to have had that done to them. They're still created by static methods in a giant wrapper class. So... If I want to replace a skill, what do I do? Just make a duplicate object and hope against hope that the game will use that instead of the vanilla version? Or is there a smarter approach?

 

2. How would one go about actually changing Death from Above to negate Squad Sight aim penalties. The skill itself already has a system to check for height advantage so I can keep that, and I can gut most of the code revolving around refunding an action because it's not going to be doing that. What about the Squad Sight penalty, though? Near as I can tell, it's 4% per tile past visual range, and that value is coded directly into the game's accuracy calculation. It doesn't seem like I can change that on the fly, is what I'm saying. Way back in the day I had the idea of giving the shooter a "counter-buff" worth half (or a quarter) of the Squad Sight penalty, but would that work? It would be hella-clunky to be sure, but if it works then I'm OK with it.

 

I'm VERY rust from back in the day, so any amount of help would be greatly appreciated. And yes, I do apologise for being needy, but XCOM 2 modding is a bit... daunting.

Link to comment
Share on other sites

For #1 - X2AbilityTemplateManager's AddAbilityTemplate has an optional parameter that tells it to replace any pre-existing template under the same name with yours. Though you might want to first make sure that what you want to do can't be done just by modifying the existing template instead.

Link to comment
Share on other sites

For #1 - X2AbilityTemplateManager's AddAbilityTemplate has an optional parameter that tells it to replace any pre-existing template under the same name with yours. Though you might want to first make sure that what you want to do can't be done just by modifying the existing template instead.

 

How would I go about modifying the existing template if not by overriding it, though? I'm not sure how that works. The only thing I could figure out to do for Blademaster was create a "child" class of X2Ability_RangerAbilitySet, override the Blademaster() function with my own and keep my fingers crossed. Since all that method does is return a template, I don't really know how to access the AbilityTemplateManager to begin with, and I'm worried about messing with core classes where that might show up. If I could just "inject" my code into the method which creates the ability, this would be much much easier.

Link to comment
Share on other sites


static event OnPostTemplatesCreated() // in X2DownloadableContentInfo
{
local X2AbilityTemplateManager Manager;
local X2AbilityTemplate Template;

Manager = class'X2AbilityTemplateManager'.static.GetAbilityTemplateManager();
Template = Manager.FindAbilityTemplate('DeathFromAbove');

Template.AddTargetEffect(effect); // or whatever else you need
}
Link to comment
Share on other sites

I see. No, I can't do what I need to do by adding stuff to the existing template. Death From Above currently refunds a single action on a sniper kill with height advantage. I need it to not do that, but instead do something else completely, which is to add extra Aim based on distance to target. I wasn't aware of OnPostTemplatesCreated() though. So that's what - just a method which runs for the mod immediately after templates have been created? I can work with that, I think. That's a good time to create my new ability and put it into the template manager at that point. Thank you.

 

With that sorted, the real hard part begins - how to add aim based on target distance if a shot is taken from height advantage :smile: I should be able to pull the "has height advantage when <event> happens" conditional from the old Death From Above skill since it's already tagged like that, but I'll need to swap out (i.e. remove) the event check so that the skill is active for all shots taken with height advantage. The extra aim might be difficult, though, since I'm not sure how to pull distance to target or how to add extra aim. Are there any skills out there which scale with distance or such that add aim?

Edited by SteelRook
Link to comment
Share on other sites

  • 2 weeks later...

Having looked into the matter more thoroughly, I've given up on my aspirations for this specific mod. The UnrealScript coding necessary to make it work is beyond my capability and I've actually changed my mind on the merits of Death From Above. While it used to bother me how Squad Sight is handled in XCOM 2, I've grown to realise that that's a good thing. While it's handy to plant a sniper on a perch and get sight on literally the entire map, it's also a really boring way to play. I've had a lot of experience with Gunslinger sharpshooters and found that to be a more enjoyable way to play the game in the first place, which has in turn caused me to start moving my Sniper Sharpshooter more rather than camping her on a deerhunter tower all game. Basically, having the Squad Sight aim penalty makes the game more fun and I've changed my mind on removing it. Besides, the ability to reload your gun after scoring a kill has proven to be more useful than I originally gave it credit for.

 

Call it lazy or call it inept, but I'm shelving this idea. Still, thank you kindly for your help in identifying the new skill hook :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...