XCOM 2
Warden Class - WOTC
Eramar  [developer] 13 Oct, 2018 @ 7:02pm
Technical Talk - Inner workings
This is where I'll try to explain how some abilities in the class works. And how you can edit some of the more complicated stuff without needing me or anyone else to do it.

Ebb and Flow

This is essentially a listener ability which listens into everything the warden does and if the conditions are met it triggers a stance change allowing the Warden to keep going instead of ending the turn. Things it takes into account:

-How many Action Points you had before activating an ability.
-How many Action Points you have after activating an ability.
-The name of the ability.
-Which stance you were in before activating the said ability.

How do I make my own custom abilities activate Ebb and Flow and change stances?
Edit: 10/17. After v1.10 most of these are unnecessary there is an option in the .ini files where you'll have an easier time adding abilities. I'll leave this here however for the necessary changes to your own template

Strikethrough text is not needed as of v1.10
I've kept this option away from the end-user since it requires them to know the exact Template Name of the ability to add in. And many of the abilities have different template names compared to their player-facing(localized) text.

-You take a look in the mod file Mods/WardenClass/Src/WardenClass

-Open up "X2Effect_WardenDecider.uc" with a text editor. (This is the script that controls the stance changes)

-Scroll all the way to the bottom till you see DefaultProperties, you'll see many abilities under that like:

DeciderAbilities(0) = "WardensAdvance"
DeciderAbilities(1) = "WardenPremonition"
DeciderAbilities(5) = "WardenPush"

So let's say you want to add your own ability in there and that abilities name is "Shovel of Doom". However the template name might be different so you'll have to find that out in your mod files. If you are a dev you probably know so that's a non-issue. Let's say the template name is "ShovelOfDoomActivate".

You simply add:

DeciderAbilities(6) = "ShovelOfDoomActivate"

This lets the script know that you want this ability to trigger a stance change. We are not done however:

To be able to trigger that stance change first of all that ability must not be turn-ending. So we head into that specific ability template, in our example "ShovelOfDoomActivate" and we find the line:

ActionPointCost.bConsumeAllPoints = true;

Simply turn that into:

ActionPointCost.bConsumeAllPoints = false;

Now we have an ability which triggers a stance change, however it will only be available in Offensive Stance. Let's say we want this Shovel Of Doom to be available in both stances. Then still in "ShovelOfDoomActivate" template we find the line:

ActionPointCost.AllowedTypes.AddItem('Standard');

We add a Momentum Action Point below that so it looks like:

ActionPointCost.AllowedTypes.AddItem('Standard');
ActionPointCost.AllowedTypes.AddItem('Momentum');

Also in the same template make sure you have a line as:

ActionPointCost.AllowedTypes.Length = 1;

It might be 0 or it might not exist at all. If its 0 change it to 1, if its not there add it below or above the other lines (lines defining Standard or Momentum action point cost)

And voila, Shovel Of Doom is now able to trigger Ebb and Flow and is available in both stances.
Last edited by Eramar; 16 Oct, 2018 @ 10:25pm
< >
Showing 1-15 of 16 comments
Redrumm 13 Oct, 2018 @ 8:03pm 
Handy! I'm over here laughing about "shovel of doom" tho.. LOL
Eramar  [developer] 13 Oct, 2018 @ 8:15pm 
Hah yeah it had to be eccentric. Well I hope it helps..
Eramar  [developer] 13 Oct, 2018 @ 10:08pm 
Had a question about using Parting Strike for different weapon slots so here we go.

Parting Strike

It has two parts:

1st Part: Adds +10% Hit chance to a specific weapon slot:
It is a simple effect that is required to be attached to a weapon slot.

2nd Part: Adds the ability to shred armor and +1 damage to any melee abilities.

2nd part is controlled by X2Effect_WardenBladeShred.uc in Mods/WardenClass/Src/WardenClass/Classes

You can add the second part into any ability you wish, however the player must've purchased "Parting Strike" for it to alter the damage and shred numbers. You can get rid of this requirement by deleting:

SourceUnit.HasSoldierAbility('WardenBladeShredder')

from line 32 so it looks like this:

if ((SourceWeapon != none) && (SourceUnit != none))

-

Then you'll have to go into your specific ability you want to utilize this damage effect in. Let's say the template is "BashHeadIn"

it'll look something like this:

local X2Effect_ApplyWeaponDamage DamageEffect;
local X2AbilityCooldown Cooldown;
local X2Effect_RemoveEffects RemoveEffects;
local array<name> SkipExclusions;

`CREATE_X2ABILITY_TEMPLATE(Template, 'BashHeadIn')

-You simply delete the line which says:

local X2Effect_ApplyWeaponDamage DamageEffect;

-and replace it with:

local X2Effect_WardenBladeShred DamageEffect;

-Keep in mind DamageEffect might be named something like WeaponDamage etc. just make sure it's the same.

-

Now that specific ability uses the damage table provided by X2Effect_WardenBladeShred.

You can edit the damage table by going into XcomGameData_SoldierSkills.ini in my mod file and altering the lines below

[WardenClass.X2Effect_WardenBladeShred]

You can set up how much armor you want to shred or how much bonus damage you want to do,








Last edited by Eramar; 13 Oct, 2018 @ 10:19pm
Redrumm 16 Oct, 2018 @ 10:29am 
Hey Eramar how would I go about making melee abilities apply to main hand weapon instead of offhand?
Eramar  [developer] 16 Oct, 2018 @ 11:05am 
You can go into my mod folder's config files. There you'll see XcomClassData.ini.

In it there'll be a list of abilities you can unlock at every rank, it'll look like:

; squaddie
+SoldierRanks=(AbilitySlots=((AbilityType=(AbilityName="WardenDecider")), ... etc

for example there is Warden's Advance right below that line:

(AbilityType=(AbilityName="WardensAdvance", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon)),

change that SecondaryWeapon into PrimaryWeapon so it'll look like:

(AbilityType=(AbilityName="WardensAdvance", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon)),


However I cannot guarantee everything will work as there are some effects which apply to secondary weapon as well, like Parting Strike, which is referred as "WardenBladeShredder" in there. you'd have to change those too, but then they won't apply to secondary..

You can play around with that file you might find something that works for ya.

In the mean time as I was testing the fixes I've done for the update I found out you were right, Foresight doesn't like taking values from the .ini for the Damage Threshold as soon as I get that fixed I'm gonna push the update so you want to duplicate and save the files you've changed into some other folder. Because when I push the update I think it will reset your config and src files.
Redrumm 16 Oct, 2018 @ 12:53pm 
Cool thx alot man! Ah so it was a bug, I thought it was something I caused by tweaking the files. Yeah I wanna try to apply to main hand weapon because I testing out a guy with a shield in offhand. I had a dream about making a tanking templar every since I got a guy with the random name "Warden" but I could never get it to work correctly with templars. But now you have literally made a warden class so this may be the ticket. I just need effects to apply to his sword in mainhand and not his shield.
Eramar  [developer] 16 Oct, 2018 @ 1:01pm 
yeah you are on the correct path then, the effects are tied to the ability templates.
Redrumm 16 Oct, 2018 @ 5:44pm 
Hey Eramar, not sure what I'm doing wrong but even when I change those abilities to primary weapon they still use the secondary weapon. Does that coding lie a lil deeper than the classdata .ini?🤔
Eramar  [developer] 16 Oct, 2018 @ 9:09pm 
Hmm, it never mentions a weapon slot in the ability code, that .ini file is the only place where I refer to it. But I do use melee animations so those might've been hardcoded to that slot. It's just a guess and very likely to be wrong however I've never tried what you are trying to do sorry. I know Musashi has some stuff for pirmary/secondaries, but the way to apply that might lie further down in the code yeah.
Eramar  [developer] 16 Oct, 2018 @ 9:49pm 
The way the animations are applied to the mod is a bit different now, I no longer use the GameUnit archetype. They are applied via an .ini file. Which does open up possibilities if you wanted to add your own animation on it:

steamapps\workshop\content\268500\1537495115\Config

There'll be a config file named

XComGameData_WardenAnim.ini

You'll see the way animations are applied in there, you can now add your own animations following that example. Obviously do not forget to add the animations in the ability template as well.
Last edited by Eramar; 20 Oct, 2018 @ 11:23am
Redrumm 16 Oct, 2018 @ 11:14pm 
Ah cool, thx man I'll look into it.
Redrumm 23 Jan, 2019 @ 11:11am 
Hey Eramar. I just started modding and I've been looking at your files trying to figure out how you added shred to your sword. Plz help :D
Eramar  [developer] 23 Jan, 2019 @ 2:12pm 
It's been a while since I played/modded the game but I'll try my best. There should also be comments in my code explaining how and why I did some of the things. (Any comments you see in the code ending with "EN Roa" are mine)

So I've created the weapon damage effect in X2Effect_WardenBladeShred.uc.. And every melee ability this class uses that effect when its activated instead of the base game formula. (I believe the base game version is X2Effect_ApplyWeaponDamage)

For example the basic melee attack Warden's Advance:

in X2Ability_WardenAbilitySet take a look at "static function WardensAdvance()"

you'll see it uses my own script instead of the vanilla:

DamageEffect = new class'X2Effect_WardenBladeShred';
Template.AddTargetEffect(DamageEffect);

So then lets take a look at WardenBladeShred.uc:

you'll see it uses the function WeaponDamageValue GetBonusEffectDamageValue, so all that's left is to understand how to use that function. There are a few comments in my code there which explains some of the choices I made but essentially what I've done is this:

1. Made sure the player has the passive WardenBladeShredder
2. Made sure the soldier has a melee weapon eqipped
3. Made sure the activated ability is melee ranged.

And only then it will apply my own specific shred formula.

----

How I've defined the shred value in that function:

Basic Example:

local WeaponDamageValue RedrummDamage;

RedrummDamage.Shred += 2

so it adds 2 Shred into any ability that uses this function to calculate damage. Obviously its a bit more complicated in my code but there should be comments explaining why I did what I did to some degree.

Hopefully this helps.


Redrumm 23 Jan, 2019 @ 5:27pm 
Ah man! I was hoping to see more mods from ya! Warden is one of my favorite classes, I hope you can do more in the future if you desire. Btw thx so much for responding, so I looked at your notes and it looks like its applying to the an abilty? Do I need to make an ability and apply shredding to that or did you put it directly on sword? Btw forgive me if I misread. Literally started modding on Monday lol
Last edited by Redrumm; 23 Jan, 2019 @ 5:27pm
Eramar  [developer] 24 Jan, 2019 @ 2:19pm 
no worries,

Short version is I've made my melee abilities use the Shredding not the weapon. That way if a player has NOT picked the necessary upgrade the weapon would keep performing normally like the base game.

Long version:

yeah I've made a passive ability "WardenBladeShredder" (Parting Strike). That ability only adds the +aim modifier to your melee weapon and the sole other reason for it to exist is so I can check if the player has picked it to apply the melee shred.

That way if a player has NOT picked WardenBladeShredder (Parting Strike) ability when they level up my script in X2Effect_wardenBladeShred.uc does not apply the melee shred.

You can see how I've applied that in the WardenBladeShred.uc

if ((SourceWeapon != none) && (SourceUnit != none) && !SourceUnit.HasSoldierAbility('WardenBladeShredder'))

so three conditions there, pretty self explanatory. Make sure there soldier has a weapon, make sure there is a soldier, make sure the soldier has the WardenBladeShredder (parting strike). If any of these conditions are not met the Shred value returns 0. If they are all met it takes the shred values from the config files and applies it on top of the damage.
< >
Showing 1-15 of 16 comments
Per page: 1530 50