Jump to content

Script Editing


CarlBar

Recommended Posts

Ok finally got the mod tools installed and setup. I'm primarily interested in doing some class ability balance tweaking, though i've allready messed with some small ini tweaks whilst i waited for the mod tools to download but i haven't found any info on how you override a script file. Is it as simple as putting a copy of the script file's i want to change the code of into my mods appropriate folder and then editing it and hitting build, or do i need to setup a file telling the game which script files to override, or do somthing more complicated as was the case with ini tweaks where i had to specify the code lines to be removed and the code lines to be added?

Link to comment
Share on other sites

I've had a look at both of them allready as well as the LW team's leader class. None of them contain any clues because as far as i can tell none of them are changing anything contained within an existing script file. If i wanted to create a new class or weapon, i'm confident i could use them to do it. But i haven't found a single example mod that edits an existing script file in a way that changes the data contained therein. They're all just adding data for new features, functions, and so on and so forth.

 

EDIT: To be clear i've only edited the kind of script files that XCOM2 uses an handful of times before in other games and always through various tools that simplified the procedure so i admit it's possible there's somthing in those mods that i'm missing because i only understand most of what i'm seeing, and then only in very general terms, (i can see which values and lines set various things but their may be interactions i'm not seeing because they're not very obvious). but if i am missing somthing like that i'd need it pointing out.

Edited by CarlBar
Link to comment
Share on other sites

Sadly all the class mods i can find are flat out replacements or extras, there's none that i can see that actually edit existing class abilities yet.

 

In the end i'm doing it the long way, namely giving the abilities i want to edit new unique names using the existing method or replacing .ini data and the generating new renamed version of the desired abilities with the edited data. Unfortunately when i try that i get a build error and i quite literally have no clue what it means. Included below:

Warning/Error Summary
		---------------------
		H:\Steam\steamapps\common\XCOM 2 SDK\Development\Src\Engine\Classes\XComModOptions.uc(1) : Error, Missing 'Class' definition
Link to comment
Share on other sites

I think that means the .uc script is missing the header

 

You should start all your .uc scripts with something that looks like this:

class XComModOptions extends X2Ability dependson (XComGameStateContext_Ability) config(ModOptions);       // Will read XComModOptions.ini for variables.

the extends and dependson are based off what you're trying to access/change or do.

Link to comment
Share on other sites

Ok after pulling my hair out for quite some time and getting nowhere, (i even tried deleting all the files i created so it only had the ones it created when you first make a new project and got the same error), i re-created the project from scratch copying in the modified files. This time it failed with a diffrent error. I'm guesiing it means a typo mistake of some kind but i'm not sure what sort. Although i at least know which file to look in.

 

The error is:

 

 

 

H:\Steam\steamapps\common\XCOM 2 SDK\Development\Src\SharpshooterRework\Classes\X2Ability_SharpshooterAbilitySetRebalance.uc(51) : Error, Type mismatch in '='

 

In case it helps here's the relevant files code:

 

 

 

//---------------------------------------------------------------------------------------
//  FILE:    X2Ability_SharpshooterAbilitySetRebalance.uc
//  AUTHOR:  Joshua Bouscher
//  DATE:    15 Jul 2014
//  PURPOSE: Defines abilities used by the Sharpshooter class.
//           
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------
class X2Ability_SharpshooterAbilitySetRebalance extends X2Ability
	config(GameData_SoldierSkills);

var config int FACEOFF_COOLDOWN;
var config int FANFIRE_COOLDOWN;


static function array<X2DataTemplate> CreateTemplates()
{
	local array<X2DataTemplate> Templates;
	
	Templates.AddItem(ReturnFireRebalance());
	Templates.AddItem(FanFireRebalance());
	Templates.AddItem(LightningHandsRebalance());
	Templates.AddItem(FaceoffRebalance());

	return Templates;
}

static function X2AbilityTemplate ReturnFireRebalance()
{
	local X2AbilityTemplate						Template;
	local X2AbilityTargetStyle                  TargetStyle;
	local X2AbilityTrigger						Trigger;
	local X2Effect_ReturnFire                   FireEffect;

	`CREATE_X2ABILITY_TEMPLATE(Template, 'ReturnFire');
	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_returnfire";

	Template.AbilitySourceName = 'eAbilitySource_Perk';
	Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_NeverShow;
	Template.Hostility = eHostility_Neutral;

	Template.AbilityToHitCalc = default.DeadEye;

	TargetStyle = new class'X2AbilityTarget_Self';
	Template.AbilityTargetStyle = TargetStyle;

	Trigger = new class'X2AbilityTrigger_UnitPostBeginPlay';
	Template.AbilityTriggers.AddItem(Trigger);

	FireEffect = new class'X2Effect_ReturnFireRebalance';
	FireEffect.BuildPersistentEffect(1, true, false, false, eGameRule_PlayerTurnBegin);
	FireEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyLongDescription(), Template.IconImage,,,Template.AbilitySourceName);
	Template.AddTargetEffect(FireEffect);

	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	//  NOTE: No visualization on purpose!

	Template.bCrossClassEligible = false;       //  this can only work with pistols, which only sharpshooters have

	return Template;
}

static function X2AbilityTemplate FanFireRebalance()
{
	local X2AbilityTemplate                 Template;	
	local X2AbilityCost_Ammo                AmmoCost;
	local X2AbilityCost_ActionPoints        ActionPointCost;
	local X2Effect_ApplyWeaponDamage        WeaponDamageEffect;
	local X2AbilityMultiTarget_BurstFire    BurstFireMultiTarget;
	local X2AbilityCooldown                 Cooldown;
	local X2AbilityToHitCalc_StandardAim    ToHitCalc;

	// Macro to do localisation and stuffs
	`CREATE_X2ABILITY_TEMPLATE(Template, 'FanFire');

	// Icon Properties
	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_fanfire";
	Template.ShotHUDPriority = class'UIUtilities_Tactical'.const.CLASS_LIEUTENANT_PRIORITY;
	Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
	Template.DisplayTargetHitChance = true;
	Template.AbilitySourceName = 'eAbilitySource_Perk';                                       // color of the icon
	Template.AbilityConfirmSound = "TacticalUI_ActivateAbility";
	
	// Activated by a button press; additionally, tells the AI this is an activatable
	Template.AbilityTriggers.AddItem(default.PlayerInputTrigger);

	// *** VALIDITY CHECKS *** //
	Template.AddShooterEffectExclusions();

	// Targeting Details
	// Can only shoot visible enemies
	Template.AbilityTargetConditions.AddItem(default.GameplayVisibilityCondition);
	// Can't target dead; Can't target friendlies
	Template.AbilityTargetConditions.AddItem(default.LivingHostileTargetProperty);
	// Can't shoot while dead
	Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);
	// Only at single targets that are in range.
	Template.AbilityTargetStyle = default.SimpleSingleTarget;

	// Action Point
	ActionPointCost = new class'X2AbilityCost_ActionPoints';
	ActionPointCost.iNumPoints = 0;
	Template.AbilityCosts.AddItem(ActionPointCost);	

	Cooldown = new class'X2AbilityCooldown';
	Cooldown.iNumTurns = default.FANFIRE_COOLDOWN;
	Template.AbilityCooldown = Cooldown;

	// Ammo
	AmmoCost = new class'X2AbilityCost_Ammo';	
	AmmoCost.iAmmo = 1;
	Template.AbilityCosts.AddItem(AmmoCost);
	Template.bAllowAmmoEffects = true; // 	

	// Weapon Upgrade Compatibility
	Template.bAllowFreeFireWeaponUpgrade = true;                                            // Flag that permits action to become 'free action' via 'Hair Trigger' or similar upgrade / effects

	// Damage Effect
	WeaponDamageEffect = new class'X2Effect_ApplyWeaponDamage';
	Template.AddTargetEffect(WeaponDamageEffect);
	Template.AddMultiTargetEffect(WeaponDamageEffect);

	ToHitCalc = new class'X2AbilityToHitCalc_StandardAim';
	Template.AbilityToHitCalc = ToHitCalc;
	Template.AbilityToHitOwnerOnMissCalc = ToHitCalc;

	BurstFireMultiTarget = new class'X2AbilityMultiTarget_BurstFire';
	BurstFireMultiTarget.NumExtraShots = 2;
	Template.AbilityMultiTargetStyle = BurstFireMultiTarget;
		
	// Targeting Method
	Template.TargetingMethod = class'X2TargetingMethod_OverTheShoulder';
	Template.CinescriptCameraType = "StandardGunFiring";

	// Voice events
	Template.ActivationSpeech = 'FanFire';

	// MAKE IT LIVE!
	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;	

	return Template;	
}

static function X2AbilityTemplate LightningHandsRebalance()
{
	local X2AbilityTemplate                 Template;
	local X2AbilityCost_Ammo                AmmoCost;
	local X2Effect_ApplyWeaponDamage        WeaponDamageEffect;
	local array<name>                       SkipExclusions;
	local X2AbilityCooldown					Cooldown;

	`CREATE_X2ABILITY_TEMPLATE(Template, 'LightningHands');

	// Icon Properties
	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_lightninghands";
	Template.ShotHUDPriority = class'UIUtilities_Tactical'.const.CLASS_MAJOR_PRIORITY;
	Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
	Template.DisplayTargetHitChance = true;
	Template.AbilitySourceName = 'eAbilitySource_Perk';
	Template.AbilityConfirmSound = "TacticalUI_ActivateAbility";

	// Activated by a button press; additionally, tells the AI this is an activatable
	Template.AbilityTriggers.AddItem(default.PlayerInputTrigger);

	Cooldown = new class'X2AbilityCooldown';
	Cooldown.iNumTurns = 1;
	Template.AbilityCooldown = Cooldown;

	// *** VALIDITY CHECKS *** //
	//  Normal effect restrictions (except disoriented)
	SkipExclusions.AddItem(class'X2AbilityTemplateManager'.default.DisorientedName);
	Template.AddShooterEffectExclusions(SkipExclusions);

	// Targeting Details
	// Can only shoot visible enemies
	Template.AbilityTargetConditions.AddItem(default.GameplayVisibilityCondition);
	// Can't target dead; Can't target friendlies
	Template.AbilityTargetConditions.AddItem(default.LivingHostileTargetProperty);
	// Can't shoot while dead
	Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);
	// Only at single targets that are in range.
	Template.AbilityTargetStyle = default.SimpleSingleTarget;

	// Ammo
	AmmoCost = new class'X2AbilityCost_Ammo';
	AmmoCost.iAmmo = 1;
	Template.AbilityCosts.AddItem(AmmoCost);
	Template.bAllowAmmoEffects = true; // 	

	Template.AbilityCosts.AddItem(default.FreeActionCost);

	// Damage Effect
	WeaponDamageEffect = new class'X2Effect_ApplyWeaponDamage';
	Template.AddTargetEffect(WeaponDamageEffect);

	// Hit Calculation (Different weapons now have different calculations for range)
	Template.AbilityToHitCalc = default.SimpleStandardAim;
	Template.AbilityToHitOwnerOnMissCalc = default.SimpleStandardAim;

	// Targeting Method
	Template.TargetingMethod = class'X2TargetingMethod_OverTheShoulder';
	Template.bUsesFiringCamera = true;
	Template.CinescriptCameraType = "StandardGunFiring";

	// MAKE IT LIVE!
	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;
	return Template;
}

static function X2AbilityTemplate FaceoffRebalance()
{
	local X2AbilityTemplate                 Template;
	local X2AbilityCooldown                 Cooldown;
	local X2AbilityCost_ActionPoints        ActionPointCost;
	local X2AbilityToHitCalc_StandardAim    ToHitCalc;

	`CREATE_X2ABILITY_TEMPLATE(Template, 'Faceoff');

	Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_faceoff";
	Template.AbilitySourceName = 'eAbilitySource_Perk';
	Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_AlwaysShow;
	Template.Hostility = eHostility_Offensive;
	Template.ShotHUDPriority = class'UIUtilities_Tactical'.const.CLASS_COLONEL_PRIORITY;
	Template.AbilityConfirmSound = "TacticalUI_ActivateAbility";

	Cooldown = new class'X2AbilityCooldown';
	Cooldown.iNumTurns = default.FACEOFF_COOLDOWN;
	Template.AbilityCooldown = Cooldown;

	ToHitCalc = new class'X2AbilityToHitCalc_StandardAim';
	ToHitCalc.bOnlyMultiHitWithSuccess = false;
	Template.AbilityToHitCalc = ToHitCalc;

	ActionPointCost = new class'X2AbilityCost_ActionPoints';
	ActionPointCost.iNumPoints = 0;
	ActionPointCost.bConsumeAllPoints = true;
	Template.AbilityCosts.AddItem(ActionPointCost);

	Template.AbilityTargetStyle = default.SimpleSingleTarget;
	Template.AbilityMultiTargetStyle = new class'X2AbilityMultiTarget_AllAllies';
	Template.AbilityTriggers.AddItem(default.PlayerInputTrigger);

	Template.AbilityShooterConditions.AddItem(default.LivingShooterProperty);
	Template.AddShooterEffectExclusions();

	Template.AbilityTargetConditions.AddItem(default.GameplayVisibilityCondition);
	Template.AbilityTargetConditions.AddItem(default.LivingHostileTargetProperty);

	Template.AddTargetEffect(new class'X2Effect_ApplyWeaponDamage');
	Template.AddMultiTargetEffect(new class'X2Effect_ApplyWeaponDamage');

	Template.bAllowAmmoEffects = true;

	Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
	Template.BuildVisualizationFn = Faceoff_BuildVisualization;

	return Template;
}

function Faceoff_BuildVisualization(XComGameState VisualizeGameState, out array<VisualizationTrack> OutVisualizationTracks)
{
	local X2AbilityTemplate             AbilityTemplate;
	local XComGameStateContext_Ability  Context;
	local AbilityInputContext           AbilityContext;
	local StateObjectReference          ShootingUnitRef;	
	local X2Action_Fire                 FireAction;
	local X2Action_Fire_Faceoff         FireFaceoffAction;
	local XComGameState_BaseObject      TargetStateObject;//Container for state objects within VisualizeGameState	
	
	local Actor                     TargetVisualizer, ShooterVisualizer;
	local X2VisualizerInterface     TargetVisualizerInterface;
	local int                       EffectIndex, TargetIndex;

	local VisualizationTrack        EmptyTrack;
	local VisualizationTrack        BuildTrack;
	local VisualizationTrack        SourceTrack;
	local XComGameStateHistory      History;

	local X2Action_PlaySoundAndFlyOver SoundAndFlyover;
	local name         ApplyResult;

	local X2Action_StartCinescriptCamera CinescriptStartAction;
	local X2Action_EndCinescriptCamera   CinescriptEndAction;
	local X2Camera_Cinescript            CinescriptCamera;
	local string                         PreviousCinescriptCameraType;
	local X2Effect                       TargetEffect;


	History = `XCOMHISTORY;
	Context = XComGameStateContext_Ability(VisualizeGameState.GetContext());
	AbilityContext = Context.InputContext;
	AbilityTemplate = class'XComGameState_Ability'.static.GetMyTemplateManager().FindAbilityTemplate(AbilityContext.AbilityTemplateName);
	ShootingUnitRef = Context.InputContext.SourceObject;

	ShooterVisualizer = History.GetVisualizer(ShootingUnitRef.ObjectID);

	SourceTrack = EmptyTrack;
	SourceTrack.StateObject_OldState = History.GetGameStateForObjectID(ShootingUnitRef.ObjectID, eReturnType_Reference, VisualizeGameState.HistoryIndex - 1);
	SourceTrack.StateObject_NewState = VisualizeGameState.GetGameStateForObjectID(ShootingUnitRef.ObjectID);
	if (SourceTrack.StateObject_NewState == none)
		SourceTrack.StateObject_NewState = SourceTrack.StateObject_OldState;
	SourceTrack.TrackActor = ShooterVisualizer;

	if (AbilityTemplate.ActivationSpeech != '')     //  allows us to change the template without modifying this function later
	{
		SoundAndFlyOver = X2Action_PlaySoundAndFlyOver(class'X2Action_PlaySoundAndFlyover'.static.AddToVisualizationTrack(SourceTrack, Context));
		SoundAndFlyOver.SetSoundAndFlyOverParameters(None, "", AbilityTemplate.ActivationSpeech, eColor_Good);
	}


	// Add a Camera Action to the Shooter's track.  Minor hack: To create a CinescriptCamera the AbilityTemplate 
	// must have a camera type.  So manually set one here, use it, then restore.
	PreviousCinescriptCameraType = AbilityTemplate.CinescriptCameraType;
	AbilityTemplate.CinescriptCameraType = "StandardGunFiring";
	CinescriptCamera = class'X2Camera_Cinescript'.static.CreateCinescriptCameraForAbility(Context);
	CinescriptStartAction = X2Action_StartCinescriptCamera( class'X2Action_StartCinescriptCamera'.static.AddToVisualizationTrack(SourceTrack, Context ) );
	CinescriptStartAction.CinescriptCamera = CinescriptCamera;
	AbilityTemplate.CinescriptCameraType = PreviousCinescriptCameraType;


	class'X2Action_ExitCover'.static.AddToVisualizationTrack(SourceTrack, Context);
	
	//  Fire at the primary target first
	FireAction = X2Action_Fire(class'X2Action_Fire'.static.AddToVisualizationTrack(SourceTrack, Context));
	FireAction.SetFireParameters(Context.IsResultContextHit(), , false);
	//  Setup target response
	TargetVisualizer = History.GetVisualizer(AbilityContext.PrimaryTarget.ObjectID);
	TargetVisualizerInterface = X2VisualizerInterface(TargetVisualizer);
	BuildTrack = EmptyTrack;
	BuildTrack.TrackActor = TargetVisualizer;
	TargetStateObject = VisualizeGameState.GetGameStateForObjectID(AbilityContext.PrimaryTarget.ObjectID);
	if( TargetStateObject != none )
	{
		History.GetCurrentAndPreviousGameStatesForObjectID(AbilityContext.PrimaryTarget.ObjectID, 
															BuildTrack.StateObject_OldState, BuildTrack.StateObject_NewState,
															eReturnType_Reference,
															VisualizeGameState.HistoryIndex);
		`assert(BuildTrack.StateObject_NewState == TargetStateObject);
	}
	else
	{
		//If TargetStateObject is none, it means that the visualize game state does not contain an entry for the primary target. Use the history version
		//and show no change.
		BuildTrack.StateObject_OldState = History.GetGameStateForObjectID(AbilityContext.PrimaryTarget.ObjectID);
		BuildTrack.StateObject_NewState = BuildTrack.StateObject_OldState;
	}
	class'X2Action_WaitForAbilityEffect'.static.AddToVisualizationTrack(BuildTrack, Context);
	for (EffectIndex = 0; EffectIndex < AbilityTemplate.AbilityTargetEffects.Length; ++EffectIndex)
	{
		ApplyResult = Context.FindTargetEffectApplyResult(AbilityTemplate.AbilityTargetEffects[EffectIndex]);

		// Target effect visualization
		AbilityTemplate.AbilityTargetEffects[EffectIndex].AddX2ActionsForVisualization(VisualizeGameState, BuildTrack, ApplyResult);

		// Source effect visualization
		AbilityTemplate.AbilityTargetEffects[EffectIndex].AddX2ActionsForVisualizationSource(VisualizeGameState, SourceTrack, ApplyResult);
	}
	if( TargetVisualizerInterface != none )
	{
		//Allow the visualizer to do any custom processing based on the new game state. For example, units will create a death action when they reach 0 HP.
		TargetVisualizerInterface.BuildAbilityEffectsVisualization(VisualizeGameState, BuildTrack);
	}
	OutVisualizationTracks.AddItem(BuildTrack);
	
	//  Now configure a fire action for each multi target
	for (TargetIndex = 0; TargetIndex < AbilityContext.MultiTargets.Length; ++TargetIndex)
	{
		// Add an action to pop the previous CinescriptCamera off the camera stack.
		CinescriptEndAction = X2Action_EndCinescriptCamera( class'X2Action_EndCinescriptCamera'.static.AddToVisualizationTrack( SourceTrack, Context ) );
		CinescriptEndAction.CinescriptCamera = CinescriptCamera;
		CinescriptEndAction.bForceEndImmediately = true;

		// Add an action to push a new CinescriptCamera onto the camera stack.
		AbilityTemplate.CinescriptCameraType = "StandardGunFiring";
		CinescriptCamera = class'X2Camera_Cinescript'.static.CreateCinescriptCameraForAbility(Context);
		CinescriptCamera.TargetObjectIdOverride = AbilityContext.MultiTargets[TargetIndex].ObjectID;
		CinescriptStartAction = X2Action_StartCinescriptCamera( class'X2Action_StartCinescriptCamera'.static.AddToVisualizationTrack(SourceTrack, Context ) );
		CinescriptStartAction.CinescriptCamera = CinescriptCamera;
		AbilityTemplate.CinescriptCameraType = PreviousCinescriptCameraType;

		// Add a custom Fire action to the shooter track.
		TargetVisualizer = History.GetVisualizer(AbilityContext.MultiTargets[TargetIndex].ObjectID);
		FireFaceoffAction = X2Action_Fire_Faceoff(class'X2Action_Fire_Faceoff'.static.AddToVisualizationTrack(SourceTrack, Context));
		FireFaceoffAction.SetFireParameters(Context.IsResultContextMultiHit(TargetIndex), AbilityContext.MultiTargets[TargetIndex].ObjectID, false);
		FireFaceoffAction.vTargetLocation = TargetVisualizer.Location;


		//  Setup target response
		TargetVisualizerInterface = X2VisualizerInterface(TargetVisualizer);
		BuildTrack = EmptyTrack;
		BuildTrack.TrackActor = TargetVisualizer;
		TargetStateObject = VisualizeGameState.GetGameStateForObjectID(AbilityContext.MultiTargets[TargetIndex].ObjectID);
		if( TargetStateObject != none )
		{
			History.GetCurrentAndPreviousGameStatesForObjectID(AbilityContext.MultiTargets[TargetIndex].ObjectID, 
																BuildTrack.StateObject_OldState, BuildTrack.StateObject_NewState,
																eReturnType_Reference,
																VisualizeGameState.HistoryIndex);
			`assert(BuildTrack.StateObject_NewState == TargetStateObject);
		}
		else
		{
			//If TargetStateObject is none, it means that the visualize game state does not contain an entry for the primary target. Use the history version
			//and show no change.
			BuildTrack.StateObject_OldState = History.GetGameStateForObjectID(AbilityContext.MultiTargets[TargetIndex].ObjectID);
			BuildTrack.StateObject_NewState = BuildTrack.StateObject_OldState;
		}

		// Add WaitForAbilityEffect. To avoid time-outs when there are many targets, set a custom timeout
		class'X2Action_WaitForAbilityEffect'.static.AddToVisualizationTrack(BuildTrack, Context);
		BuildTrack.TrackActions[BuildTrack.TrackActions.Length - 1].SetCustomTimeoutSeconds((10 + (10 * TargetIndex )));

		for (EffectIndex = 0; EffectIndex < AbilityTemplate.AbilityMultiTargetEffects.Length; ++EffectIndex)
		{
			TargetEffect = AbilityTemplate.AbilityMultiTargetEffects[EffectIndex];
			ApplyResult = Context.FindMultiTargetEffectApplyResult(TargetEffect, TargetIndex);

			// Target effect visualization
			AbilityTemplate.AbilityMultiTargetEffects[EffectIndex].AddX2ActionsForVisualization(VisualizeGameState, BuildTrack, ApplyResult);

			// If the last Effect applied was weapon damage, then a weapon damage Action was added to the track.
			// Find that weapon damage action, and extend its timeout so that we won't timeout if there are many
			// targets to visualize before this one.
			if ( X2Effect_ApplyWeaponDamage(TargetEffect) != none )
			{
				if ( X2Action_ApplyWeaponDamageToUnit(BuildTrack.TrackActions[BuildTrack.TrackActions.Length - 1]) != none)
				{
					BuildTrack.TrackActions[BuildTrack.TrackActions.Length - 1].SetCustomTimeoutSeconds((10 + (10 * TargetIndex )));
				}
			}

			// Source effect visualization
			AbilityTemplate.AbilityMultiTargetEffects[EffectIndex].AddX2ActionsForVisualizationSource(VisualizeGameState, SourceTrack, ApplyResult);
		}
		if( TargetVisualizerInterface != none )
		{
			//Allow the visualizer to do any custom processing based on the new game state. For example, units will create a death action when they reach 0 HP.
			TargetVisualizerInterface.BuildAbilityEffectsVisualization(VisualizeGameState, BuildTrack);
		}
		OutVisualizationTracks.AddItem(BuildTrack);
	}
	class'X2Action_EnterCover'.static.AddToVisualizationTrack(SourceTrack, Context);

	// Add an action to pop the last CinescriptCamera off the camera stack.
	CinescriptEndAction = X2Action_EndCinescriptCamera( class'X2Action_EndCinescriptCamera'.static.AddToVisualizationTrack( SourceTrack, Context ) );
	CinescriptEndAction.CinescriptCamera = CinescriptCamera;

	OutVisualizationTracks.AddItem(SourceTrack);
} 

 

 

Edited by CarlBar
Link to comment
Share on other sites

Please use spoiler tags if you post a huge code segment. You recognize that the (51) in the message is a line number? Then the problem is that you have a mismatched type in that line. You will have to change the type assignment at line 34. If you have no programming experience, this type of editing is still possible, but it may be more challenging and require more time to learn.

Link to comment
Share on other sites

You recognize that the (51) in the message is a line number?

 

No i didn't thank you :smile:.

 

Also sorry about the spoiler tags. I'll go back and change after finishing typing this.

 

And yes i didn't expect this to be easy :smile:. I learn my modding mostly by examining other code, then start with editing that code, then splicing it together in new ways, and so on and so forth till i can create from scratch, but this kind of full on really finicky scripting language is a bit

 

Ok this appears to be the problem code line:

	FireEffect = new class'X2Effect_ReturnFireRebalance';

TBH i had a suspicion this was going to give me trouble doing.

 

I'm guessing from what you just said that this line:

	local X2Effect_ReturnFire                   FireEffect;

Tells the game with other file to pull up to find the effect and the code thereof and my not changing this created the issue?

 

Anyway i'll try it and see what happens. Thank you :smile:. I'm liable to be back with more problems and questions over time i'm afraid till i really get to understand this.

 

EDIT: And build succeeded after i fixed that, (much obliged), so time to jump in game and test it.

Edited by CarlBar
Link to comment
Share on other sites

Ok that sorta fixed it. Turned out there was a couple of improperly edited lines in the big piece of text as well that created in game bugs, (basically the game was looking at two copies of each ability because i hadn't edited a line that defined the template created). Fixed that but then discovered that the edited ClassData file is not being properly used. It's not actually switching the abilities out for the new ones.

 

Here's the code from that file:

 

 

 

[Sharpshooter X2SoldierClassTemplate]
; squaddie
-SoldierRanks=(  aAbilityTree=(	(AbilityName="PistolStandardShot",  ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
-								(AbilityName="Squadsight") \\
-							 ), \\
-				aStatProgression=((StatType=eStat_Offense,StatAmount=10), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=1)),\\
-			)
; corporal
-SoldierRanks=(  aAbilityTree=(	(AbilityName="LongWatch", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
-								(AbilityName="ReturnFire", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
-							 ), \\	 	
-				aStatProgression=((StatType=eStat_Offense,StatAmount=4), (StatType=eStat_HP,StatAmount=0), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=0)),\\
-			)
; sergeant
-SoldierRanks=(  aAbilityTree=(	(AbilityName="Deadeye", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
-								(AbilityName="LightningHands", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
-							 ), \\
-				aStatProgression=((StatType=eStat_Offense,StatAmount=3), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=5), (StatType=eStat_CombatSims,StatAmount=0)),\\
-			)
; lieutenant
;-SoldierRanks=( aAbilityTree=(	(AbilityName="DeathFromAbove", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
;-								(AbilityName="Quickdraw") \\
;-							), \\
;-			   aStatProgression=((StatType=eStat_Offense,StatAmount=3), (StatType=eStat_HP,StatAmount=0), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=0)),\\
;-			)
; captain
-SoldierRanks=( aAbilityTree=(	(AbilityName="KillZone", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
-								(AbilityName="Faceoff", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
-							), \\
-				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=1), (StatType=eStat_Hacking,StatAmount=5), (StatType=eStat_CombatSims,StatAmount=0)),\\
-			)
; major
;-SoldierRanks=( aAbilityTree=(	(AbilityName="SteadyHands"), \\
;-								(AbilityName="SharpshooterAim", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon) \\				
;-							), \\
;-			   aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_HP,StatAmount=0), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=0)),\\
;-			)
; colonel
-SoldierRanks=( aAbilityTree=(	(AbilityName="InTheZone", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
-								(AbilityName="FanFire", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
-							), \\
-			   aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=5), (StatType=eStat_CombatSims,StatAmount=0)),\\
-			)

; squaddie
+SoldierRanks=(  aAbilityTree=(	(AbilityName="PistolStandardShot",  ApplyToWeaponSlot=eInvSlot_SecondaryWeapon), \\
+								(AbilityName="Squadsight") \\
+							 ), \\
+				aStatProgression=((StatType=eStat_Offense,StatAmount=10), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=1)),\\
+			)
; corporal
+SoldierRanks=(  aAbilityTree=(	(AbilityName="LongWatch", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
+								(AbilityName="ReturnFireRebalance", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
+							 ), \\	 	
+				aStatProgression=((StatType=eStat_Offense,StatAmount=4), (StatType=eStat_HP,StatAmount=0), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=0)),\\
+			)
; sergeant
+SoldierRanks=(  aAbilityTree=(	(AbilityName="Deadeye", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
+								(AbilityName="LightningHandsRebalance", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
+							 ), \\
+				aStatProgression=((StatType=eStat_Offense,StatAmount=3), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=5), (StatType=eStat_CombatSims,StatAmount=0)),\\
+			)
; lieutenant
;+SoldierRanks=( aAbilityTree=(	(AbilityName="DeathFromAbove", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
;+								(AbilityName="Quickdraw") \\
;+							), \\
;+			   aStatProgression=((StatType=eStat_Offense,StatAmount=3), (StatType=eStat_HP,StatAmount=0), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=0)),\\
;+			)
; captain
+SoldierRanks=( aAbilityTree=(	(AbilityName="KillZone", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
+								(AbilityName="FaceoffRebalance", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
+							), \\
+				aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=1), (StatType=eStat_Hacking,StatAmount=5), (StatType=eStat_CombatSims,StatAmount=0)),\\
+			)
; major
;+SoldierRanks=( aAbilityTree=(	(AbilityName="SteadyHands"), \\
;+								(AbilityName="SharpshooterAim", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon) \\				
;+							), \\
;+			   aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_HP,StatAmount=0), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=0), (StatType=eStat_CombatSims,StatAmount=0)),\\
;+			)
; colonel
+SoldierRanks=( aAbilityTree=(	(AbilityName="InTheZone", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), \\
+								(AbilityName="FanFireRebalance", ApplyToWeaponSlot=eInvSlot_SecondaryWeapon) \\
+							), \\
+			   aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=0), (StatType=eStat_Hacking,StatAmount=5), (StatType=eStat_CombatSims,StatAmount=0)),\\
+			)

 

 

 

Any clue as to why?

Edited by CarlBar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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