Errors with Heavy Weapon Reload Script

Post Reply
John Luke Pack Hard
Posts: 11
Joined: Mon Mar 20, 2017 9:05 am

Errors with Heavy Weapon Reload Script

Post by John Luke Pack Hard »

Hi all, for those of you more experienced with .uc files, I need help working around an error.

The full script is here: https://pastebin.com/3mw7gRjG

The error is specifically here:

Code: Select all

	Charges = new class'X2AbilityCharges_BonusCharges';
	Charges.InitialCharges = class'X2ReloadStages'.GetFlamethrowerReloadStages(AffectState);
	Template.AbilityCharges = Charge
I'm trying to simulate the number of stages of reload using charges. I'm setting the initial charges on the reload to the number of charges in the config determined by the function in the class X2ReloadStages named GetFlameThrowerReloadStages.

The intended behavior is once the number of charges hits 0 upon an activation, the charges should refresh back to its previous state, and then reload a single charge into the intended heavy weapon.

This is what that function looks like right now:

Code: Select all

simulated function int GetFlamethrowerReloadStages(XComGameState_BaseObject AffectState)
{
	if (XComGameState_Unit(AffectState).HasSoldierAbility('AutoloaderArmaments'))
	{
		return default.FLAMETHROWER_RELOAD_STAGES - default.AUTOLOADER_ARMAMENTS_BONUS;
	}
	return default.FLAMETHROWER_RELOAD_STAGES;
}
The error/warning log currently shows:

Code: Select all

C:\Program Files (x86)\Steam\steamapps\common\XCOM 2 SDK\Development\Src\TechnicalHeavyWeaponReload\Classes\X2Ability_LW_TechnicalHeavyWeaponReload.uc(46) : Error, Unrecognized member 'GetFlamethrowerReloadStages' in class 'Class'
			C:\Program Files (x86)\Steam\steamapps\common\XCOM 2 SDK\binaries\..\Development\Src\TechnicalHeavyWeaponReload\Classes\..\..\XComGame\Mods\TechnicalHeavyWeaponReload\X2Item_LWGauntlet.uc : Warning, Duplicate class name: X2Item_LWGauntlet also exists in package LW_Overhaul
The last warning is presumably because I override Gauntlet by creating a second Gauntlet class. Any help would be appreciated, thanks.
shiremct
Posts: 7
Joined: Wed Apr 26, 2017 3:07 pm

Re: Errors with Heavy Weapon Reload Script

Post by shiremct »

For your first error, I notice on line 54 you do not have X2ReloadStages enclosed in class' '. I'm not sure if you can do that kind of evaluation in the template itself anyway... It may be possible, but I've never really seen dynamic handling done in the Ability template.

I can't look at it more closely right now, but that's someplace to start.
Post Reply