Adding new ability to replace existing one, need help

Post Reply
ConradKurze
Posts: 35
Joined: Tue Jan 24, 2017 9:25 pm

Adding new ability to replace existing one, need help

Post by ConradKurze »

I'm interested in removing concussion rockets and replacing them with Shredder Rockets, however after applying these changes I still see Concussion Rocket for my technicals Sergeant rank.

Code I've got so far:

XComClassData.ini

Code: Select all

[LWS_Sharpshooter X2SoldierClassTemplate]
+AllowedWeapons=(SlotType=eInvSlot_PrimaryWeapon, WeaponType="rifle")

[LWS_Technical X2SoldierClassTemplate]
; Remove old Ranks
; Squaddie
-SoldierRanks=(	aAbilityTree=(	(AbilityName="HeavyArmaments",		ApplyToWeaponSlot=eInvSlot_Unknown) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=4), (StatType=eStat_CombatSims,StatAmount=1))\\
			)
; LCPL
-SoldierRanks=(	aAbilityTree=(	(AbilityName="FireInTheHole",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="Suppression_LW",		ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
								(AbilityName="Roust",				ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=4), (StatType=eStat_HP,StatAmount=1)) \\
			)
; CPL
-SoldierRanks=(	aAbilityTree=(	(AbilityName="BiggestBooms_LW"		), \\
								(AbilityName="Fortify"				), \\
								(AbilityName="NapalmX",				ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0)) \\
			)
; SGT
-SoldierRanks=( aAbilityTree=(	(AbilityName="ConcussionRocket",	ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="Shredder",			ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
								(AbilityName="Burnout",				ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_HP,StatAmount=1))\\
			)
; SSGT
-SoldierRanks=( aAbilityTree=(	(AbilityName="TandemWarheads"		), \\
								(AbilityName="Formidable"			), \\
								(AbilityName="PhosphorusPassive",	ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_Strength,StatAmount=1))\\
			)
; TSGT
-SoldierRanks=( aAbilityTree=(	(AbilityName="JavelinRockets",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="FireandSteel",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="Incinerator",			ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_HP,StatAmount=1))\\
			)
; GSGT
-SoldierRanks=( aAbilityTree=(	(AbilityName="Salvo",				ApplyToWeaponSlot=eInvSlot_Unknown), \\
								(AbilityName="TacticalSense"		), \\
								(AbilityName="Quickburn",			ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0))\\
			)
; MSGT
-SoldierRanks=( aAbilityTree=(	(AbilityName="BunkerBuster",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="RapidFire",			ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
								(AbilityName="Firestorm",			ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_HP,StatAmount=1)) \\

;Add new Ranks
; Squaddie
+SoldierRanks=(	aAbilityTree=(	(AbilityName="HeavyArmaments",		ApplyToWeaponSlot=eInvSlot_Unknown) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=4), (StatType=eStat_CombatSims,StatAmount=1))\\
			)
; LCPL
+SoldierRanks=(	aAbilityTree=(	(AbilityName="FireInTheHole",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="Suppression_LW",		ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
								(AbilityName="Roust",				ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=4), (StatType=eStat_HP,StatAmount=1)) \\
			)
; CPL
+SoldierRanks=(	aAbilityTree=(	(AbilityName="BiggestBooms_LW"		), \\
								(AbilityName="Fortify"				), \\
								(AbilityName="NapalmX",				ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0)) \\
			)
; SGT
+SoldierRanks=( aAbilityTree=(	(AbilityName="ShredderRocket",	ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="Shredder",			ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
								(AbilityName="Burnout",				ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_HP,StatAmount=1))\\
			)
; SSGT
+SoldierRanks=( aAbilityTree=(	(AbilityName="TandemWarheads"		), \\
								(AbilityName="Formidable"			), \\
								(AbilityName="PhosphorusPassive",	ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_Strength,StatAmount=1))\\
			)
; TSGT
+SoldierRanks=( aAbilityTree=(	(AbilityName="JavelinRockets",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="FireandSteel",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="Incinerator",			ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_HP,StatAmount=1))\\
			)
; GSGT
+SoldierRanks=( aAbilityTree=(	(AbilityName="Salvo",				ApplyToWeaponSlot=eInvSlot_Unknown), \\
								(AbilityName="TacticalSense"		), \\
								(AbilityName="Quickburn",			ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0))\\
			)
; MSGT
+SoldierRanks=( aAbilityTree=(	(AbilityName="BunkerBuster",		ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
								(AbilityName="RapidFire",			ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
								(AbilityName="Firestorm",			ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
							), \\
				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_Will,StatAmount=0), (StatType=eStat_HP,StatAmount=1)) \\
XComLW_SoldierSkills.ini

Code: Select all

[LW_Overhaul.X2Ability_LW_TechnicalAbilitySet]
FLAMETHROWER_DIRECT_APPLY_CHANCE=70
MOVEMENT_SCATTER_TILE_MODIFIER=3
NUM_AIM_SCATTER_ROLLS=3
-SCATTER_REDUCTION_ABILITIES[0]="FireInTheHole"
-SCATTER_REDUCTION_MODIFIERS[0]=-2
+SCATTER_REDUCTION_ABILITIES[0]="FireInTheHole"
+SCATTER_REDUCTION_MODIFIERS[0]=-3

SHREDDER_ROCKET_ENV_DAMAGE = 20
SHREDDER_ROCKET_RADIUS=3
SHREDDER_ROCKET_DAMAGE_VALUE=(Damage=2, Spread=1, PlusOne=50, Crit=0, Pierce=0, Shred=3, Tag="", DamageType="Explosion")
SHREDDER_RUPTURE = 3

-CONCUSSION_ROCKET_DAMAGE_VALUE=(Damage=1, Spread=0, PlusOne=0, Crit=0, Pierce=0, Shred=0, Tag="", DamageType="Explosion")
-CONCUSSION_ROCKET_ENV_DAMAGE=1
(Localization Text)
XComGame.int

Code: Select all

;Place localized text in this file


[FireInTheHole X2AbilityTemplate]
LocFriendlyName="Fire In The Hole"
LocFlyOverText="Fire In The Hole"
LocLongDescription="Your rockets are more accurate."
LocHelpText="Your rockets are more accurate."
LocPromotionPopupText="<Bullet/> Your rockets are more likely to hit their intended point of impact, or at least close to it.<br/><Bullet/> The maximum it can miss by is reduced by three tiles."

[ShredderRocket X2AbilityTemplate]
LocFriendlyName="Shredder Rocket"
LocFlyOverText="Shredder Rocket"
LocLongDescription="Fire a special rocket that does less damage and has a limited radius, but shreds more armor and applies rupture to anything hit."
LocHelpText="Special Rocket that applies rupture. <Ability:ROCKETSCATTER/>"
LocPromotionPopupText="<Bullet/> One use per mission.<br/><Bullet/> Shreds armor and applies rupture.<br/><Bullet/> Requires one action and ends the soldier's turn."

src/Mod/Classes/X2Ability_LW_TechnicalAbilitySet.uc
Text enclosed in ** <text> ** is not part of my modifications, just there for comments here, and because I need to cut characters to reach the limit.

Code: Select all

//---------------------------------------------------------------------------------------
//  FILE:    X2Ability_LW_TechnicalAbilitySet.uc
//  AUTHOR:  Amineri (Pavonis Interactive)
//  PURPOSE: Defines all Long War Specialist-specific abilities
//---------------------------------------------------------------------------------------

class X2Ability_LW_TechnicalAbilitySet extends X2Ability
	dependson (XComGameStateContext_Ability) config(LW_SoldierSkills);

var config int FLAMETHROWER_BURNING_BASE_DAMAGE;
var config int FLAMETHROWER_BURNING_DAMAGE_SPREAD;
var config int FLAMETHROWER_DIRECT_APPLY_CHANCE;
var config int FLAMETHROWER_CHARGES;
var config int FLAMETHROWER_HIGH_PRESSURE_CHARGES;

var config float ROUST_CONEEND_DIAMETER_MODIFIER;
var config float ROUST_CONELENGTH_MODIFIER;
var config int ROUST_DIRECT_APPLY_CHANCE;
var config int ROUST_CHARGES;
var config float ROUST_DAMAGE_PENALTY;
var config int ROUST_HIGH_PRESSURE_CHARGES;

var config int INCINERATOR_CONEEND_DIAMETER_MODIFIER;
var config int INCINERATOR_CONELENGTH_MODIFIER;
var config int FIRESTORM_NUM_CHARGES;
var config int FIRESTORM_HIGH_PRESSURE_CHARGES;
var config int FIRESTORM_RADIUS_METERS;
var config float FIRESTORM_DAMAGE_BONUS;
var config int SHOCK_AND_AWE_BONUS_CHARGES;
var config int JAVELIN_ROCKETS_BONUS_RANGE_TILES;
var config WeaponDamageValue BUNKER_BUSTER_DAMAGE_VALUE;
var config float BUNKER_BUSTER_RADIUS_METERS;
var config int BUNKER_BUSTER_ENV_DAMAGE;
var config int FIRE_AND_STEEL_DAMAGE_BONUS;
var config int SHREDDER_ROCKET_ENV_DAMAGE;
var config int SHREDDER_ROCKET_RADIUS;
var config int SHREDDER_ROCKET_DAMAGE_VALUE;
var config int SHREDDER_RUPTURE;
var config float BURNOUT_RADIUS;
var config int MOVEMENT_SCATTER_AIM_MODIFIER;
var config int MOVEMENT_SCATTER_TILE_MODIFIER;
var config int NUM_AIM_SCATTER_ROLLS;
var config array<name> SCATTER_REDUCTION_ABILITIES;
var config array<int> SCATTER_REDUCTION_MODIFIERS;
var config array<int> ROCKET_RANGE_PROFILE;

var config int QUICKBURN_COOLDOWN;

var name PanicImpairingAbilityName;

var localized string strMaxScatter;

static function array<X2DataTemplate> CreateTemplates()
{
	local array<X2DataTemplate> Templates;
	
	Templates.AddItem(PurePassive('HeavyArmaments', "img:///UILibrary_LW_Overhaul.LW_AbilityHeavyArmaments"));

	Templates.AddItem(CreateLWFlamethrowerAbility());  

	Templates.AddItem(PurePassive('PhosphorusPassive', "img:///UILibrary_LW_Overhaul.LW_AbilityPhosphorus"));
	Templates.AddItem(PurePassive('NapalmX', "img:///UILibrary_LW_Overhaul.LW_AbilityNapalmX"));
	Templates.AddItem(PurePassive('Incinerator', "img:///UILibrary_LW_Overhaul.LW_AbilityHighPressure"));
	//Templates.AddItem(PurePassive('Quickburn', "img:///UILibrary_LW_Overhaul.LW_AbilityQuickburn"));
	Templates.AddItem(AddQuickburn());
	Templates.AddItem(CreateRoustAbility());
	Templates.AddItem(CreateBurnoutAbility());
	Templates.AddItem(BurnoutPassive());
	Templates.AddItem(RoustDamage());
	Templates.AddItem(CreateFirestorm());
	Templates.AddItem(FirestormDamage());
	Templates.AddItem(CreateHighPressureAbility());
	Templates.AddItem(CreateTechnicalFireImmunityAbility());

	Templates.AddItem(LWRocketLauncherAbility());
	Templates.AddItem(LWBlasterLauncherAbility());
	Templates.AddItem(PurePassive('FireInTheHole', "img:///UILibrary_LW_Overhaul.LW_AbilityFireInTheHole"));
	Templates.AddItem(PurePassive('TandemWarheads', "img:///UILibrary_LW_Overhaul.LW_AbilityTandemWarheads"));
	Templates.AddItem(AddShockAndAwe());
	Templates.AddItem(AddJavelinRockets());
	Templates.AddItem(CreateShredderRocketAbility());
	Templates.AddItem(CreateBunkerBusterAbility());

	Templates.AddItem(CreateNapalmXPanicEffectAbility());

	Templates.AddItem(CreateFireandSteelAbility());

	return Templates;
}

**Snipped out stuff here to meet character limit, nothing in this section changed**
**Just for reference the CreateShredderRocketAbility function is right where the concussion rocket function used to be**

//TODO: Modify this to Shredder
static function X2AbilityTemplate CreateShredderRocketAbility()
{
	local X2AbilityTemplate						Template;	
	local X2AbilityCharges					Charges;
	local X2AbilityCost_Charges				ChargeCost;
	local X2AbilityCost_ActionPoints        ActionPointCost;
	local X2AbilityTarget_Cursor            CursorTarget;
	local X2AbilityMultiTarget_Radius       RadiusMultiTarget;
	local X2AbilityToHitCalc_StandardAim    StandardAim;
	local X2Effect_ApplyWeaponDamage        WeaponDamageEffect;
	local X2Effect_ApplySmokeGrenadeToWorld WeaponEffect;
	local X2Condition_UnitEffects			SuppressedCondition;
	local X2Condition_UnitProperty			UnitPropertyCondition;

	`CREATE_X2ABILITY_TEMPLATE(Template, 'ShredderRocket');

	Template.AbilitySourceName = 'eAbilitySource_Perk';
	Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_AlwaysShow;
	//TODO: Potentially change the icon if I feel less lazy
	Template.IconImage = "img:///UILibrary_LW_Overhaul.LW_AbilityConcussionRocket";
	Template.bCrossClassEligible = false;
	Template.Hostility = eHostility_Offensive;
	Template.ShotHUDPriority = class'UIUtilities_Tactical'.const.CLASS_COLONEL_PRIORITY;

	Template.AbilityTriggers.AddItem(default.PlayerInputTrigger);
	Template.TargetingMethod = class'X2TargetingMethod_LWRocketLauncher'; 
	Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);
	Template.AddShooterEffectExclusions();

	SuppressedCondition = new class'X2Condition_UnitEffects';
	SuppressedCondition.AddExcludeEffect(class'X2Effect_Suppression'.default.EffectName, 'AA_UnitIsSuppressed');
	SuppressedCondition.AddExcludeEffect(class'X2Effect_AreaSuppression'.default.EffectName, 'AA_UnitIsSuppressed');
	Template.AbilityShooterConditions.AddItem(SuppressedCondition);

	CursorTarget = new class'X2AbilityTarget_Cursor';
	CursorTarget.bRestrictToWeaponRange = true;
	Template.AbilityTargetStyle = CursorTarget;
	
	StandardAim = new class'X2AbilityToHitCalc_StandardAim';
	StandardAim.bAllowCrit = false;
	StandardAim.bGuaranteedHit = true;
	Template.AbilityToHitCalc = StandardAim;
	
	ActionPointCost = new class'X2AbilityCost_HeavyWeaponActionPoints';
	Template.AbilityCosts.AddItem(ActionPointCost);
	
	Charges = new class'X2AbilityCharges';
    Charges.InitialCharges = 1;
	//TODO: Add a second charge with Extra Rocket? Probably too powerful.
	Template.AbilityCharges = Charges;

    ChargeCost = new class'X2AbilityCost_Charges';
    ChargeCost.NumCharges = 1;
    Template.AbilityCosts.AddItem(ChargeCost);

	UnitPropertyCondition = new class'X2Condition_UnitProperty';
	UnitPropertyCondition.ExcludeDead = true;
	Template.AbilityShooterConditions.AddItem(UnitPropertyCondition);

	RadiusMultiTarget = new class'X2AbilityMultiTarget_Radius';
	RadiusMultiTarget.bUseWeaponRadius = false;
	RadiusMultiTarget.fTargetRadius = default.SHREDDER_ROCKET_RADIUS * 1.5; // meters
	Template.AbilityMultiTargetStyle = RadiusMultiTarget;
	
	WeaponDamageEffect = new class'X2Effect_ApplyWeaponDamage';
	WeaponDamageEffect.bIgnoreBaseDamage = true;
	WeaponDamageEffect.EffectDamageValue=default.SHREDDER_ROCKET_DAMAGE_VALUE;
	WeaponDamageEffect.bExplosiveDamage = true;
	WeaponDamageEffect.EnvironmentalDamageAmount=default.SHREDDER_ROCKET_ENV_DAMAGE;
	Template.AddTargetEffect(WeaponDamageEffect);
	Template.AddMultiTargetEffect(WeaponDamageEffect);

	//Rupture
	ShredderEffect = ShredderDamageEffect();
	ShredderEffect.EffectDamageValue.Rupture = default.SHREDDER_RUPTURE;
	Template.AddTargetEffect(ShredderEffect);
	Template.AddMultiTargetEffect(ShredderEffect);

	Template.ActivationSpeech = 'Explosion';
	Template.CinescriptCameraType = "Soldier_HeavyWeapons";

	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;
	Template.BuildInterruptGameStateFn = TypicalAbility_BuildInterruptGameState;
	return Template;	
}


**Snip stuff here, nothing changed in this section **


Anyone know what other changes I need to make to finish this?
Phantom
Posts: 31
Joined: Fri Jan 13, 2017 5:03 pm

Re: Adding new ability to replace existing one, need help

Post by Phantom »

If it is just for your own use write in [LWS_Technical X2SoldierClassTemplate] instead off ....AbilityName="ConcussionRocket".... the name of your custom ability (in your case the shredder rocket) which looks like (AbilityName="ShredderRocketCustom") for example. You do not need to change the whole code with + &-.....

Of course you will also need the ability template of your shredderrocket
ConradKurze
Posts: 35
Joined: Tue Jan 24, 2017 9:25 pm

Re: Adding new ability to replace existing one, need help

Post by ConradKurze »

Yeah, I could just change local files instead, but I was hoping to make a mod to revamp Technicals (mod scatter, which I got working, change up concussion rocket for something useful, and some minor flame thrower tweaks, plus damage boosts with technology), so I was hoping to be able to get it to work legitimately.
cerebrawl
Posts: 137
Joined: Mon Jan 30, 2017 10:41 am

Re: Adding new ability to replace existing one, need help

Post by cerebrawl »

Pretty sure the stuff in the /src/ folder is source code, and needs to be compiled. Are you using the sdk at all?

Maybe a tutorial would be useful? Note the part where he creates a clone version of stealth(conceal).
https://youtu.be/OUJzsv3TfPs?t=9m38s
Post Reply