Tactical Charges File Changes Additional Items Mod XCOM:EU - 2012

From Nexus Mods Wiki
Jump to: navigation, search

Overview

This contains the file changes to set the correct number of charges in the tactical game:

  • The number of charges shown in each ability icon in the TacticalHUD UI
  • The number of times corresponding abilities can be used during a tactical mission


Back to Additional Items Mod

Details

The number of charges for each item in the tactical game are set via the function XGUnit.UpdateItemCharges.

The function sets the number of charges stored for each XGUnit based on absence/presence of perks and/or items.

Some abilities' charges are set regardless of any perks or items, as the ability is only available in certain circumstances.

Since equipping or unequipping an item adds/subtracts 2 from the perk array, the 0 bit will only be non-zero if the soldier has the perk from selection in the perk tree. Several locations in this code explicitly test the 0 bit when determining number of charges.

This hex change implements the following changes:

  • Sets number of Arc Thrower charges to 1 unless the soldier has the "Repair" perk, in which case the soldier receives 4 charges
  • Adds a case for item 83 (First Aid Kit) to set 3 charges if the soldier has the "Field Medic" perk
  • Sets Battlescanner charges to 2 if the soldier has the perk, plus 1 for each battlescanner item
  • Sets Smoke Grenade charges to 1 if the soldier has the perk, plus 1 for each smoke grenade item
  • Double the number of Smoke Grenade charges if the soldier has Smoke and Mirrors (double both perk and item charges)

File Changes

This hex change is applied to the XComGame.upk


GetItemCharges

XGUnit.UpdateItemCharges
original: 5D B1 00 00 50 55 00 00 00 00 00 00 48 B1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 25 0C 00 00 E9 89 01 00 57 06 00 00 B7 04 00 00 07 B6 00 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 30 16 1B 4B 62 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 4C 16 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 03 16 16 06 E2 00 1B 4B 62 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 4C 16 16 07 D4 01 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 5D 16 1B AC 62 00 00 00 00 00 00 92 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 16 16 06 3D 02 1B AC 62 00 00 00 00 00 00 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 16 07 6D 02 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 16 16 1B C8 62 00 00 00 00 00 00 26 16 07 ED 03 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 2C 16 07 84 03 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 5C 16 1B DA 62 00 00 00 00 00 00 92 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 16 16 06 ED 03 1B DA 62 00 00 00 00 00 00 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 01 00 F0 2C 00 00 00 26 16 07 7C 04 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 08 16 1B 63 61 00 00 00 00 00 00 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 02 16 07 C0 05 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 18 16 1B E9 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 55 16 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 02 16 16 1B 40 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 58 16 19 19 2E FE 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 F0 2C 00 00 00 01 F0 2C 00 00 02 00 F0 2C 00 00 00 2C 02 16 16 06 18 06 1B E9 61 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 55 16 16 1B 40 61 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 58 16 16 1B FE 61 00 00 00 00 00 00 2C 04 16 1B 58 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 50 16 2C 02 16 16 04 0B 53
new: 5D B1 00 00 50 55 00 00 00 00 00 00 48 B1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 25 0C 00 00 E9 89 01 00 4B 05 00 00 B7 04 00 00 07 98 00 97 9C 1A 2C 30 35 D1 0D 00 00 D5 0D 00 00 00 01 19 01 0A 31 00 00 09 00 C3 A2 00 00 00 01 C3 A2 00 00 26 16 25 16 1B 4B 62 00 00 00 00 00 00 92 90 2C 03 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 4C 16 16 90 2C 02 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 5A 16 16 16 16 06 E8 00 1B 4B 62 00 00 00 00 00 00 92 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 4C 16 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 5A 16 16 16 07 1C 01 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 5D 16 1B AC 62 00 00 00 00 00 00 2C 02 16 06 28 01 1B AC 62 00 00 00 00 00 00 2C 01 16 07 59 01 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 16 16 1B C8 62 00 00 00 00 00 00 2C 01 16 07 A2 01 97 9C 1A 2C 08 35 D1 0D 00 00 D5 0D 00 00 00 01 19 01 0A 31 00 00 09 00 C3 A2 00 00 00 01 C3 A2 00 00 26 16 25 16 1B 63 61 00 00 00 00 00 00 2C 02 16 07 01 02 97 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 63 16 25 16 1B 63 61 00 00 00 00 00 00 92 01 AD 30 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 63 16 16 16 07 4A 02 97 9C 1A 2C 2C 35 D1 0D 00 00 D5 0D 00 00 00 01 19 01 0A 31 00 00 09 00 C3 A2 00 00 00 01 C3 A2 00 00 26 16 25 16 1B DA 62 00 00 00 00 00 00 2C 01 16 07 A9 02 97 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 56 16 25 16 1B DA 62 00 00 00 00 00 00 92 01 AE 30 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 56 16 16 16 07 E5 02 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 5C 16 1B DA 62 00 00 00 00 00 00 90 2C 02 01 AE 30 00 00 16 16 07 6D 03 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 18 16 1B E9 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 55 16 2C 02 16 16 1B 40 61 00 00 00 00 00 00 90 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 58 16 2C 02 16 16 06 C5 03 1B E9 61 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 55 16 16 1B 40 61 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 58 16 16 1B FE 61 00 00 00 00 00 00 2C 04 16 1B 58 61 00 00 00 00 00 00 19 1B CC 32 00 00 00 00 00 00 16 0C 00 5D A6 00 00 00 1B A7 33 00 00 00 00 00 00 24 50 16 16 07 39 04 19 1B 7B 31 00 00 00 00 00 00 16 0C 00 EA A2 00 00 00 1B B8 36 00 00 00 00 00 00 2C 67 16 1B 58 61 00 00 00 00 00 00 90 2C 04 01 C7 30 00 00 16 16 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 04 0B 53

Decompiled Code

XGUnit.UpdateItemCharges

Original Code
function UpdateItemCharges()
{
	// End:0xb6 Loop:False
	if(GetCharacter().HasUpgrade(48))
	{
		SetMediKitCharges(GetInventory().GetNumItems(76) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.3);
	}
	// End:0xe2
	else
	{
		SetMediKitCharges(GetInventory().GetNumItems(76));
	}
	// End:0x1d4 Loop:False
	if(GetCharacter().HasUpgrade(93))
	{
		SetRockets(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1 + XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
	}
	// End:0x23d
	else
	{
		SetRockets(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
	}
	// End:0x26d Loop:False
	if(GetCharacter().HasUpgrade(22))
	{
		SetShredderRockets(1);
	}
	// End:0x3ed Loop:False
	if(GetCharacter().HasUpgrade(44))
	{
		// End:0x384 Loop:False
		if(GetCharacter().HasUpgrade(92))
		{
			SetSmokeGrenadeCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1 + XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
		}
		// End:0x3ed
		else
		{
			SetSmokeGrenadeCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
		}
	}
	// End:0x47c Loop:False
	if(GetCharacter().HasUpgrade(8))
	{
		SetBattleScannerCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2);
	}
	// End:0x5c0 Loop:False
	if(GetCharacter().HasUpgrade(24))
	{
		SetFragGrenades(GetInventory().GetNumItems(85) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2);
		SetAlienGrenades(GetInventory().GetNumItems(88) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2);
	}
	// End:0x618
	else
	{
		SetFragGrenades(GetInventory().GetNumItems(85));
		SetAlienGrenades(GetInventory().GetNumItems(88));
	}
	SetGhostCharges(4);
	SetArcThrowerCharges(GetInventory().GetNumItems(80) * 2);
}

New Code
 
function UpdateItemCharges()
{
    // End:0x98
    if((m_kCharacter.m_kChar.aUpgrades[48] & 1) > 0)
    {
        SetMediKitCharges((3 * GetInventory().GetNumItems(76)) + (2 * GetInventory().GetNumItems(90)));
    }
    // End:0xE8
    else
    {
        SetMediKitCharges(GetInventory().GetNumItems(76) + GetInventory().GetNumItems(90));
    }
    // End:0x11C
    if(GetCharacter().HasUpgrade(93))
    {
        SetRockets(2);
    }
    // End:0x128
    else
    {
        SetRockets(1);
    }
    // End:0x159
    if(GetCharacter().HasUpgrade(22))
    {
        SetShredderRockets(1);
    }
    // End:0x1A2
    if((m_kCharacter.m_kChar.aUpgrades[8] & 1) > 0)
    {
        SetBattleScannerCharges(2);
    }
    // End:0x201
    if(GetInventory().GetNumItems(99) > 0)
    {
        SetBattleScannerCharges(m_iBattleScanners + GetInventory().GetNumItems(99));
    }
    // End:0x24A
    if((m_kCharacter.m_kChar.aUpgrades[44] & 1) > 0)
    {
        SetSmokeGrenadeCharges(1);
    }
    // End:0x2A9
    if(GetInventory().GetNumItems(86) > 0)
    {
        SetSmokeGrenadeCharges(m_iSmokeGrenades + GetInventory().GetNumItems(86));
    }
    // End:0x2E5
    if(GetCharacter().HasUpgrade(92))
    {
        SetSmokeGrenadeCharges(2 * m_iSmokeGrenades);
    }
    // End:0x36D
    if(GetCharacter().HasUpgrade(24))
    {
        SetFragGrenades(GetInventory().GetNumItems(85) * 2);
        SetAlienGrenades(GetInventory().GetNumItems(88) * 2);
    }
    // End:0x3C5
    else
    {
        SetFragGrenades(GetInventory().GetNumItems(85));
        SetAlienGrenades(GetInventory().GetNumItems(88));
    }
    SetGhostCharges(4);
    SetArcThrowerCharges(GetInventory().GetNumItems(80));
    // End:0x439
    if(GetCharacter().HasUpgrade(103))
    {
        SetArcThrowerCharges(4 * m_iArcThrowerCharges);
    }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    //return;    
}
 


References

Referred to by this article:

That refer to this article:

  • <none>