Jump to content

Modifying Return fire to use primary weapon


hybridmerc

Recommended Posts

Hey guys, Like the title suggests i'm trying to modify return fire the sharpshooter perk.
To prevent doing anyhting silly i've created a new ability called primaryReturnFire and copied the template setup from the sharpshooter ability set.
Now if I do not change anything the new class has return fire, albeit under a different name, primaryReturnFire. The crux of this, as far as I can see, is the X2Returnfire_effect:

 

class X2Effect_ReturnFire extends X2Effect_CoveringFire;
DefaultProperties
{
EffectName = "ReturnFire"
DuplicateResponse = eDupe_Ignore
AbilityToActivate = "PistolReturnFire"
GrantActionPoint = "returnfire"
MaxPointsPerTurn = 1
bDirectAttackOnly = true
bPreEmptiveFire = false
bOnlyDuringEnemyTurn = true
}

You can see in the snippet that the return fire effect activates the PistolReturnFire ability, which in turn causes a pistol overwatchShot. So I guess what I want to do is have a standard overwatch shot,

I checked out how overwatch ability set up the covering fire effect but had not result, i'm wondering if i'm missing something that actually triggers the shooting part of the ability. Any help would be appreciated, heres a link to the mod on github.

 

I believe there are two parts of this reactive ability:

--Initial setup template - sets skill name and skill trigger--

--Actual shooting part--

 

I'm a bit of a github noob so hopefully this will do: https://github.com/megamattman/mattclass2.git

Edited by hybridmerc
Link to comment
Share on other sites

Luckily, this is actually an easy one to do.

 

Edit XcomClassData ini and inside you will see what each ability is bound to (in terms of weapons). So for instance, you could bind a typically sniper ability to your secondary weapon (a pistol, say).

; corporal
SoldierRanks=( aAbilityTree=(    (AbilityName="LongWatch", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
                                (AbilityName="ReturnFire", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon) \\
Link to comment
Share on other sites

Have you seen this inaction?

 

This was my first port of call but it didn't get the expected result :sad:

 

I have done some more research and tracked return fire down to several different abilities.

 

Return fire - ability activates at start of play, with x2returnfire_effect inside it template

 

x2returnfire_effect extends covering_fire which adds to the eventmanager (not sure about eventmanager)

 

when returnfire effect gets called it activate the PistolReturnFire fuction which in turns activates the pistol overwatch shot

 

What I would like to do is have this effect start a different ability.

 

Really this is an excercise in creating different context sensitive abilities.

 

Its worth noting that I tried replacing 'PistolReturnFire' to overwatchshot, standardshot but to no avail,

 

After looking through those particular abilities it looks like they have activation conditions, which may be the route of my problem.

 

Anyone else played with context abilities?

Edited by hybridmerc
Link to comment
Share on other sites

I got this working after a fashion, ideally I want to create an which, on a trigger, activates another ability. What I ended up doing was tying my returnfireprimary ability to overwatch a custom effect.

 

The real gotcha i saw here was the idea of reserveactionpoints, the overwatchshot requires a reserve overwatch action point

credit to fxsjosh from r/xcom2mods for soloution

 

Frustraingly enough when I copied the overwatchshot ability and renamed it and tried to call that via the custom effect it didn't work as expected!

 

Here is the custom effect setup to call overwatchshot, hope this helps someone :D

 

 

class ReturnFirePrimary_Effect extends X2Effect_CoveringFire;
DefaultProperties
{
EffectName = "ReturnFire"
DuplicateResponse = eDupe_Ignore
AbilityToActivate = "OverwatchShot"
GrantActionPoint = "overwatch"
MaxPointsPerTurn = 1
bDirectAttackOnly = true
bPreEmptiveFire = false
bOnlyDuringEnemyTurn = true
}

 

 

Edited by hybridmerc
Link to comment
Share on other sites

I've been attempting the exact same thing here.

 

The thing that you're missing right now is that the ability to activate from the effect (your renamed overwatch shot, and in the future your own custom shots or abilities) must be available to the soldier in question. It's not enough that the ability exists and is a part of the game. The ability must either be known by the soldier through ability training or similar, or available through items or weapons they have equipped.

 

OverwatchShot, for example, is an ability added to pretty much all weapons in the game, so it's always available.

 

So to make your CustomOverwatchShot work, you would need to add this ability to your soldier somehow, either by adding the ability to weapons or to your soldier.

 

In my case, my custom ability was for a new custom soldier class. I was able to modify my XcomClassData ini to add my CustomOverwatchShot to the ability tree at Squaddie rank (I think you can add as many as you want here, and only the last one will appear as the main squaddie ability on the abilities screen).

 

Give that a try and good luck.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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