XCOM Squadsight Aim Penalty Mod Alternate Formula

From Nexus Mods Wiki
Jump to: navigation, search

Overview

This provides more alternate aim penalty formula and details about how to customize the values of the formula for the XCOM_Squadsight_Aim_Penalty_Mod

Changing the formula

The formula is present in two of the hex changes.

The hex code part of the formula is exactly identical in each location. In each case a search-and-replace of the original formula hex code with the replacement formula hex code will apply the new formula.

Default Formula

Hex Code

Squadsight Aim Penalty Default Hex Code F9 93 93 90 2C 05 F9 36 19 1B 38 34 00 00 00 00 00 00 16 09 00 9A 30 00 00 00 01 9A 30 00 00 2C 05 16 16 2C 19 16 38 44 AB 1E CD CC 8C 3F AF 01 1A BC 00 00 38 3F 1A 2C 0A 19 01 E6 7B 00 00 09 00 0D 31 00 00 00 01 0D 31 00 00 16 16 16 2C 05 16

Decompiled Code

Min((5*Min(GetPrimaryTarget().m_arrEnemiesSeenBy.Length, 5) -25) - int (1.1*(m_fDistanceToTarget - float(m_kUnit.m_aCurrentStats[10]))), 5)

Alternative versions

No Range Penalty

Squadsight Aim Penalty No Range Penalty Hex Code F9 93 93 90 2C 05 F9 36 19 1B 38 34 00 00 00 00 00 00 16 09 00 9A 30 00 00 00 01 9A 30 00 00 2C 05 16 16 2C 19 16 38 44 AB 1E 00 00 00 00 AF 01 1A BC 00 00 38 3F 1A 2C 0A 19 01 E6 7B 00 00 09 00 0D 31 00 00 00 01 0D 31 00 00 16 16 16 2C 05 16

Decompiled Code

Min((5*Min(GetPrimaryTarget().m_arrEnemiesSeenBy.Length, 5) -25) - int (0.0*(m_fDistanceToTarget - float(m_kUnit.m_aCurrentStats[10]))), 5)

Only Range Penalty

Squadsight Aim Penalty Only Range Penalty Hex Code F9 93 93 90 2C 00 F9 36 19 1B 38 34 00 00 00 00 00 00 16 09 00 9A 30 00 00 00 01 9A 30 00 00 2C 05 16 16 2C 19 16 38 44 AB 1E CD CC 8C 3F AF 01 1A BC 00 00 38 3F 1A 2C 0A 19 01 E6 7B 00 00 09 00 0D 31 00 00 00 01 0D 31 00 00 16 16 16 2C 05 16/tt>

Decompiled Code

Min((0*Min(GetPrimaryTarget().m_arrEnemiesSeenBy.Length, 5) -25) - int (1.1*(m_fDistanceToTarget - float(m_kUnit.m_aCurrentStats[10]))), 5)

Customizing Values

Individual value can be changed.

Key parameters are : (in order as listed below)

  1. 2C 05 -- int const 5 -- the aim bonus per XCOM unit that can see the target
  2. 2C 05 -- int const 5 -- the maximum number of XCOM units that can contribute to the aim bonus
  3. 2C 19 -- int const 25 -- the constant penalty for shooting beyond visual range
  4. 1E CD CC 8C 3F -- float const 1.1 -- aim penalty for each "tile" of distance beyond visual range
  5. 2C 05 -- int const 5 -- the minimum aim penalty for shooting with squadsight

Breakdown of Formula

		F9 -- "Min" operator
			93 -- "-" subtration operator (int)
				93 -- "-" operator
					90 -- "*" operator (int)
						2C 05 -- int const 5
						F9 -- "Min" operator
							36 19 1B 38 34 00 00 00 00 00 00 16 09 00 9A 30 00 00 00 01 9A 30 00 00 -- GetPrimaryTarget().m_arrEnemiesSeenBy.Length
							2C 05 -- int const 5
						16 -- execute "Min"
					16 -- execute "*"
					2C 19 -- int const 25
				16 -- execute "+"
				38 44 -- float to int
				AB -- "*" operator (float)
					1E CD CC 8C 3F -- float const 1.1
					AF -- "-" operator (float)
						01 1A BC 00 00 -- m_fDistanceToTarget
						38 3F -- int to float
						1A 2C 0A 19 01 E6 7B 00 00 09 00 0D 31 00 00 00 01 0D 31 00 00 -- m_kUnit.m_aCurrentStats[10]
					16 -- execute "-"
				16 -- execute "*"
			16 -- execute "-"
			2C 05 -- int const 5
		16 -- execute "Min"



References

Referred to by this article:

That refer to this article: