Jump to content

R&D Modding Ammo


Amineri

Recommended Posts

Well I don't know what it's doing but I only get 5 shots when I put 606 in the iSuppression value for Rifles.

 

Well, that's certainly not working as intended.

 

I'm sorry to ask a dumb question, but there wasn't any extra reaction fire in there or anything was there?

 

Assuming that you counted correctly, there is always the possibility that somewhere in the native code is calling the old GetAmmoCost and modifying the iAmmo field in XGWeapon for some actions. There's really nothing I can do to disable that.

 

I'll test out some numbers experimentally by using the Dev Console and UnlimitedMoves so that I can make sure I'm shooting standard fire actions over and over with no possibility of anything hinky going on.

 

Definitely thank you for stress-testing this and letting me know what is/isn't working ^_^

Link to comment
Share on other sites

  • Replies 71
  • Created
  • Last Reply

Top Posters In This Topic

Yax is correct. I've got assault rifles, no ammo conservation, with iSuppression=506, and I'm getting five shots, with a significant remainder showing on the ammo graphic:

 

http://cloud-2.steampowered.com/ugc/576738944271745027/714C86BF836B7BAC94B440D6B3735BC44BB4BFB8/

 

I did no reaction fire during this test -- did not overwatch. These were rookies with no special shots (suppression, flush, etc) available to them.

Link to comment
Share on other sites

Hrm....

 

I think I might know what is going on, and it will be kind of annoying to work around.

 

Both the ability-checking code and the GetAmmoCost code are native functions. My guess is that the FireAbility is checking the remaining ammo (which is 20 for your case // 100 - (5*16) = 20). Since the native function GetAmmoCost is returning 25 as the ammo cost for firing an assault rifle, the shot is disallowed as having too little ammo.

 

One way to get around this that I see is to re-map the ammo to the range 100-200. That way the native function test will always return true regardless of what the original GetAmmoCost function returns.

 

The ApplyAmmoCost function would be modified to set ammo to zero when the ammo count was under 104.

 

The UI Display would subtract 100 from the ammo count to generate the display number. Similarly the ReactionFire WeaponCheck would subtract 100 before testing.

 

This would introduce a minor issue involving Suppression and weapons with odd numbers of shots. If a weapon has 5 shots (20 ammo each shot) and can suppress (each suppression takes 40 ammo), then when remapped a weapon with 20 ammo would be storing 120 ammo, which would allow another suppression shot when it should be disallowed. Effectively weapons with odd NumShots would sometimes count as having 1 greater ammo for purposes of suppression.

 

An Assault Rifle with 3 shots could Suppress twice, for example, instead of only once.

 

Basically the new rule would be that any ability could be used as long as there is non-zero ammo remaining, regardless of remaining ammo. Greater ammo usage only takes the ammo count to zero faster, which then requires a reload.

 

Thoughts on this?

Link to comment
Share on other sites

I ran the same test with 5-shot assault rifles (which should have no remainder issues) and had the same result -- they only got off four shots before the game thought they were dry. So I think your diagnosis is correct.

 

Durn, I was hoping to see rifle suppression nerfed relative to LMG suppression, but I suppose that's a minor issue relative to control over ammo counts.

 

Edit: Could Rifle Suppression be set to cost 3x normal ammo?

Edited by johnnylump
Link to comment
Share on other sites

Okay, I've got a fix for the native code issue. Went with the plan of setting the ammo range to run from 100 to 200.

 

Reloading sets iAmmo to 200. iAmmo default value changed to 200.

 

It turns out that the native code checks iAmmo directly rather than using the GetRemainingAmmo helper function like the upk code, so I altered GetRemainingAmmo to return iAmmo-100.

 

ApplyAmmoCost now checks if iAmmo <= 104 and sets iAmmo = 0 if it is.

 

This means that GetRemainingAmmo returns -100 if the weapon is out of ammo, so I went though and patched up the six places where GetRemainingAmmo() == 0 was being tested. Three of those places were related to the AI reload behavior, so that bug might possible be fixed now.

 

I tested this on a mission with Assault Rifles set to iSuppression = 505, and confirmed 5 shots before ammo was depleted. Pistols were set to iSuppression = 402 and were depleted after 2 shots.

 

Here is the new, complete hex code (hex changes relative to vanilla code):

 

 

 

All hex changes for Ammo Cost mod

Change XGWeapon.ApplyAmmoCost to deal with remainders

original hex:
52 B9 00 00 50 55 00 00 00 00 00 00 3C B9 00 00 00 00 00 00 00 00 00 00 3D B9 00 00 00 00 00 00 D9 00 00 00 45 1A 00 00 31 00 00 00 21 00 00 00 A2 01 1E B9 00 00 00 3D B9 00 00 16 07 2E 00 9A 01 1E B9 00 00 26 16 0F 01 1E B9 00 00 25 04 0B 53 


new hex: (virtual 0x2D)
52 B9 00 00 50 55 00 00 00 00 00 00 3C B9 00 00 00 00 00 00 00 00 00 00 3D B9 00 00 00 00 00 00 D9 00 00 00 45 1A 00 00 2D 00 00 00 21 00 00 00 07 26 00 98 A2 01 1E B9 00 00 00 3D B9 00 00 16 2C 68 16 0F 01 1E B9 00 00 25 04 0B 0B 0B 0B 0B 53 



---------------------------------------------

Change XGAbilityTree.ApplyActionCost to call XGAbility_Targeted.GraduatedOdds instead of XGTacticalGameCore.GetAmmoCost

original hex for just function: (next 0x1EB)
iCost = XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.GetAmmoCost(kAbility.m_kWeapon.GameplayType(), kAbility.GetType(), kAbility.m_kUnit.GetPlayer().HasFoundryHistory(10), kAbility.m_kUnit.GetCharacter().m_kChar, kAbility.m_bReactionFire); (259 file, 379 virtual bytes -- 120 extra)
0F 00 C3 7E 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 13 01 42 10 00 00 00 1B 16 31 00 00 00 00 00 00 38 3A 19 19 00 C4 7E 00 00 09 00 E8 BB 00 00 00 01 E8 BB 00 00 0A 00 E8 9B 00 00 00 1B 92 30 00 00 00 00 00 00 16 19 00 C4 7E 00 00 0A 00 1C 7C 00 00 00 1B 1E 35 00 00 00 00 00 00 16 19 19 19 00 C4 7E 00 00 09 00 E6 7B 00 00 00 01 E6 7B 00 00 0A 00 EB B2 00 00 00 1B 0A 34 00 00 00 00 00 00 16 0C 00 9E 94 00 00 00 1B 7A 36 00 00 00 00 00 00 24 0A 16 19 19 19 00 C4 7E 00 00 09 00 E6 7B 00 00 00 01 E6 7B 00 00 0A 00 63 B4 00 00 00 1B 7B 31 00 00 00 00 00 00 16 09 00 C3 A2 00 00 00 01 C3 A2 00 00 19 00 C4 7E 00 00 0A 00 D2 7B 00 00 00 2D 01 D2 7B 00 00 16 

new function call:  (next 0x1EB)
iCost = kAbility.GraduatedOdds(0, 0, kAbility.m_kUnit.GetPlayer().HasFoundryHistory(10)); (89 file, 121 virtual bytes -- 32 extra)
0F 00 C3 7E 00 00 19 00 C4 7E 00 00 5A 00 B9 7C 00 00 00 1B E1 35 00 00 00 00 00 00 2C 00 2C 00 19 19 19 00 C4 7E 00 00 09 00 E6 7B 00 00 00 01 E6 7B 00 00 0A 00 EB B2 00 00 00 1B 0A 34 00 00 00 00 00 00 16 0C 00 9E 94 00 00 00 1B 7A 36 00 00 00 00 00 00 24 0A 16 16 0B 0B 0B 0B 0B 0B 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 00 C3 7E 00 00 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 


---------------------------------------------

Alter UITacticalHUD_WeaponPanel.SetWeaponAndAmmo to call XGAbility_Targeted.GraduatedOdds instead of XGTacticalGameCore.GetAmmoCost

****TWO IDENTICAL CALLS****

call 2 hex: (identical to call 1 ) (254 file, 370 virtual bytes -- 116 additional)
0F 35 C8 FC FF FF 32 F9 FF FF 00 01 00 72 27 00 00 38 3F 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 F5 00 42 10 00 00 00 1B 16 31 00 00 00 00 00 00 38 3A 19 19 00 70 27 00 00 09 00 E8 BB 00 00 00 01 E8 BB 00 00 0A 00 E8 9B 00 00 00 1B 92 30 00 00 00 00 00 00 16 19 00 70 27 00 00 0A 00 1C 7C 00 00 00 1B 1E 35 00 00 00 00 00 00 16 19 19 19 00 70 27 00 00 09 00 E6 7B 00 00 00 01 E6 7B 00 00 0A 00 EB B2 00 00 00 1B 0A 34 00 00 00 00 00 00 16 0C 00 9E 94 00 00 00 1B 7A 36 00 00 00 00 00 00 24 0A 16 19 19 19 00 70 27 00 00 09 00 E6 7B 00 00 00 01 E6 7B 00 00 0A 00 63 B4 00 00 00 1B 7B 31 00 00 00 00 00 00 16 09 00 C3 A2 00 00 00 01 C3 A2 00 00 4A 16 

new function call:  
myValue.N = float(kTAbility.GraduatedOdds(0, 0, kTAbility.m_kUnit.GetPlayer().HasFoundryHistory(10))); (102 file, 142 virtual bytes -- 40 extra)
0F 35 C8 FC FF FF 32 F9 FF FF 00 01 00 72 27 00 00 38 3F 19 00 70 27 00 00 5A 00 B9 7C 00 00 00 1B E1 35 00 00 00 00 00 00 2C 00 2C 00 19 19 19 00 70 27 00 00 09 00 E6 7B 00 00 00 01 E6 7B 00 00 0A 00 EB B2 00 00 00 1B 0A 34 00 00 00 00 00 00 16 0C 00 9E 94 00 00 00 1B 7A 36 00 00 00 00 00 00 24 0A 16 16 0B 0B 0B 0B 0B 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 00 70 27 00 00 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 


---------------------------------------------


Rewrite XGUnit.ReactionWeaponCheck to call XGAbility_Targeted.GraduatedOdds instead of XGTacticalGameCore.GetAmmoCost

original hex:
CA B7 00 00 50 55 00 00 00 00 00 00 B3 B7 00 00 00 00 00 00 00 00 00 00 B5 B7 00 00 00 00 00 00 F6 31 00 00 88 45 06 00 5F 01 00 00 07 01 00 00 0F 00 B4 B7 00 00 19 1B CC 32 00 00 00 00 00 00 16 0A 00 2C 0A 00 00 00 1B ED 30 00 00 00 00 00 00 16 07 3B 00 72 00 B4 B7 00 00 2A 16 04 28 07 2E 01 96 19 00 B4 B7 00 00 0A 00 3B B9 00 00 00 1B 6A 34 00 00 00 00 00 00 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 6F 00 42 10 00 00 00 1B 16 31 00 00 00 00 00 00 38 3A 19 00 B4 B7 00 00 0A 00 E8 9B 00 00 00 1B 92 30 00 00 00 00 00 00 16 2C 07 19 1B 0A 34 00 00 00 00 00 00 16 0C 00 9E 94 00 00 00 1B 7A 36 00 00 00 00 00 00 24 0A 16 19 1B 7B 31 00 00 00 00 00 00 16 09 00 C3 A2 00 00 00 01 C3 A2 00 00 27 16 16 04 28 07 52 01 19 00 B4 B7 00 00 0A 00 47 B9 00 00 00 1B F8 3D 00 00 00 00 00 00 16 04 28 04 27 04 3A B5 B7 00 00 53 


new hex: (virtual 0x15B)
CA B7 00 00 50 55 00 00 00 00 00 00 B3 B7 00 00 00 00 00 00 00 00 00 00 B5 B7 00 00 00 00 00 00 F6 31 00 00 88 45 06 00 5B 01 00 00 07 01 00 00 0F 00 B4 B7 00 00 19 1B CC 32 00 00 00 00 00 00 16 0A 00 2C 0A 00 00 00 1B ED 30 00 00 00 00 00 00 16 07 3B 00 72 00 B4 B7 00 00 2A 16 04 28 0F 00 54 B7 00 00 9E 35 9C 0D 00 00 AA 0D 00 00 00 00 19 00 B4 B7 00 00 09 00 14 B9 00 00 00 01 14 B9 00 00 94 1A 2C 0C 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 2C 10 16 16 07 2E 01 96 19 00 B4 B7 00 00 0A 00 3B B9 00 00 00 1B 6A 34 00 00 00 00 00 00 16 12 20 66 7D 00 00 37 00 BC 7C 00 00 00 1B E1 35 00 00 00 00 00 00 00 54 B7 00 00 2C 00 19 1B 0A 34 00 00 00 00 00 00 16 0C 00 9E 94 00 00 00 1B 7A 36 00 00 00 00 00 00 24 0A 16 16 16 04 28 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 27 04 3A B5 B7 00 00 53 


---------------------------------------------


Rewrite XGAbility_Targeted.GraduatedOdds into the new Ammo Costing function

original hex:
D4 7C 00 00 50 55 00 00 00 00 00 00 B8 7C 00 00 00 00 00 00 00 00 00 00 BF 7C 00 00 00 00 00 00 73 02 00 00 CF 54 00 00 3D 04 00 00 0D 03 00 00 0F 00 BA 7C 00 00 19 19 00 BE 7C 00 00 0A 00 56 94 00 00 00 1B C5 34 00 00 00 00 00 00 16 0A 00 40 AC 00 00 00 1B 95 33 00 00 00 00 00 00 16 07 F2 01 19 19 19 2E 64 2D 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 71 2D 00 00 00 01 71 2D 00 00 09 00 A3 9C 00 00 00 01 A3 9C 00 00 0A 00 A8 9F 00 00 00 2D 01 A8 9F 00 00 07 F2 01 82 81 19 01 E6 7B 00 00 0A 00 B5 32 00 00 00 1B DB 3D 00 00 00 00 00 00 16 16 18 21 00 19 1B 38 34 00 00 00 00 00 00 16 0A 00 B5 32 00 00 00 1B DB 3D 00 00 00 00 00 00 16 16 07 F2 01 82 82 2D 00 BD 7C 00 00 18 5F 00 77 19 2E 64 2D 00 00 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 69 2D 00 00 00 01 69 2D 00 00 2A 16 16 18 74 00 81 19 19 2E 64 2D 00 00 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 69 2D 00 00 00 01 69 2D 00 00 0A 00 97 4C 00 00 00 2D 01 97 4C 00 00 16 16 04 25 07 08 02 99 00 BA 7C 00 00 2C 04 16 04 1D FF FF FF FF 0F 00 B9 7C 00 00 93 F9 2C 04 19 19 00 BE 7C 00 00 0A 00 56 94 00 00 00 1B C5 34 00 00 00 00 00 00 16 0A 00 87 AC 00 00 00 1B AD 33 00 00 00 00 00 00 16 16 00 BA 7C 00 00 16 07 39 03 82 82 19 01 E6 7B 00 00 0A 00 B5 32 00 00 00 1B DB 3D 00 00 00 00 00 00 16 18 23 00 81 19 1B 38 34 00 00 00 00 00 00 16 0A 00 B5 32 00 00 00 1B DB 3D 00 00 00 00 00 00 16 16 16 18 0D 00 97 00 BF 7C 00 00 25 16 16 0F 00 BB 7C 00 00 91 00 BF 7C 00 00 2C 05 16 07 1E 03 99 00 BF 7C 00 00 2C 32 16 A1 00 BB 7C 00 00 F9 2C 1E 90 19 19 01 E6 7B 00 00 0A 00 EB B2 00 00 00 1B 0A 34 00 00 00 00 00 00 16 09 00 DB 93 00 00 00 01 DB 93 00 00 2C 0F 16 16 16 A1 00 BB 7C 00 00 90 00 B9 7C 00 00 2C 0F 16 16 06 18 04 07 18 04 82 81 19 01 E6 7B 00 00 0A 00 B5 32 00 00 00 1B DB 3D 00 00 00 00 00 00 16 16 18 21 00 19 1B 38 34 00 00 00 00 00 00 16 0A 00 B5 32 00 00 00 1B DB 3D 00 00 00 00 00 00 16 16 0F 00 BB 7C 00 00 90 8F 19 19 1B 38 34 00 00 00 00 00 00 16 0A 00 EB B2 00 00 00 1B 0A 34 00 00 00 00 00 00 16 09 00 DC 93 00 00 00 01 DC 93 00 00 16 2C 0A 16 07 FD 03 82 9A 00 BA 7C 00 00 26 16 18 0B 00 2D 00 BD 7C 00 00 16 0F 00 BB 7C 00 00 8F 00 BF 7C 00 00 16 06 18 04 A1 00 BB 7C 00 00 90 00 B9 7C 00 00 1D E7 FF FF FF 16 16 04 FB 92 00 BF 7C 00 00 00 BB 7C 00 00 16 25 2C 64 16 04 3A BC 7C 00 00 53 


new hex : (virtual 0x3C5)
D4 7C 00 00 50 55 00 00 00 00 00 00 B8 7C 00 00 00 00 00 00 00 00 00 00 BF 7C 00 00 00 00 00 00 73 02 00 00 CF 54 00 00 C5 03 00 00 0D 03 00 00 0F 00 BB 7C 00 00 25 07 37 00 9B 00 BF 7C 00 00 25 16 0F 00 BB 7C 00 00 9C 00 BF 7C 00 00 1D FF FF 00 00 16 06 CD 00 07 48 00 72 01 E8 BB 00 00 2A 16 04 25 07 6E 00 19 01 E8 BB 00 00 0C 00 4F B9 00 00 00 1B 9A 36 00 00 00 00 00 00 2C 0A 16 04 25 07 92 00 19 01 E8 BB 00 00 0A 00 4D B9 00 00 00 1B D6 3D 00 00 00 00 00 00 16 04 25 0F 00 BB 7C 00 00 35 9C 0D 00 00 AA 0D 00 00 00 00 19 01 E8 BB 00 00 09 00 14 B9 00 00 00 01 14 B9 00 00 07 F6 00 81 2D 00 BD 7C 00 00 16 0F 00 B9 7C 00 00 FD 00 BB 7C 00 00 2C 64 16 06 0D 01 0F 00 B9 7C 00 00 91 00 BB 7C 00 00 2C 64 16 07 3A 01 9B 00 BF 7C 00 00 25 16 0F 00 BA 7C 00 00 9C 95 00 BF 7C 00 00 2C 10 16 2C FF 16 06 8D 01 0F 00 BA 7C 00 00 1A 2C 0C 35 D1 0D 00 00 D5 0D 00 00 00 01 19 19 01 E6 7B 00 00 09 00 0A 31 00 00 00 01 0A 31 00 00 09 00 C3 A2 00 00 00 01 C3 A2 00 00 07 AC 01 97 9C 00 BA 7C 00 00 26 16 25 16 A1 00 B9 7C 00 00 2C 02 16 07 DA 01 97 9C 00 BA 7C 00 00 2C FE 16 25 16 A1 00 B9 7C 00 00 90 2C 01 95 00 BA 7C 00 00 26 16 16 16 0F 00 B9 7C 00 00 FA 00 B9 7C 00 00 2C 01 16 0F 00 BB 7C 00 00 91 2C 64 00 B9 7C 00 00 16 07 67 02 9A 00 BF 7C 00 00 25 16 07 3F 02 9A 1B 1E 35 00 00 00 00 00 00 16 2C 11 16 0F 00 BB 7C 00 00 90 2C 02 00 BB 7C 00 00 16 07 67 02 9A 1B 1E 35 00 00 00 00 00 00 16 2C 0C 16 0F 00 BB 7C 00 00 90 2C 01 00 BB 7C 00 00 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 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 00 BB 7C 00 00 53 


-----------------------------------------

Disable call to GraduatedOdds in XGAbility_Targeted.AdjustToHit

Change first conditional from:
if(kPlayer.m_bCantLose || XComTacticalGRI(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kBattle.m_kDesc.m_iDifficulty == 0)
07 C2 02 84 19 00 C1 7C 00 00 0A 00 D9 93 00 00 00 2D 01 D9 93 00 00 18 80 00 9A 19 19 19 2E 64 2D 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 71 2D 00 00 00 01 71 2D 00 00 09 00 A3 9C 00 00 00 01 A3 9C 00 00 09 00 B2 9F 00 00 00 01 B2 9F 00 00 25 16 16 

to:
if(kPlayer.m_bCantLose && XComTacticalGRI(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kBattle.m_kDesc.m_iDifficulty < 0)
07 C2 02 82 19 00 C1 7C 00 00 0A 00 D9 93 00 00 00 2D 01 D9 93 00 00 18 80 00 96 19 19 19 2E 64 2D 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 71 2D 00 00 00 01 71 2D 00 00 09 00 A3 9C 00 00 00 01 A3 9C 00 00 09 00 B2 9F 00 00 00 01 B2 9F 00 00 25 16 16 


-----------------------------------------


Change to XGGUnit.Reload

original:
kWeapon.iAmmo = 100;
0F 19 00 92 B6 00 00 09 00 1E B9 00 00 00 01 1E B9 00 00 2C 64 

new:
kWeapon.iAmmo = 200;
0F 19 00 92 B6 00 00 09 00 1E B9 00 00 00 01 1E B9 00 00 2C C8 


-----------------------------------------

Need to change default value of iAmmo from 100 to 200 

XGWeapon.default.iAmmo

original:
64 00 00 00 90 50 00 00 00 00 00 00 45 68 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 0B 00 00 00 4D 65 64 69 6B 69 74 20 49 49

new:
C8 00 00 00 90 50 00 00 00 00 00 00 45 68 00 00 00 00 00 00 0F 00 00 00 00 00 00 00 0B 00 00 00 4D 65 64 69 6B 69 74 20 49 49


-----------------------------------------

Change GetRemainingAmmo to return current amount - 100


original hex:
header:
50 B9 00 00 50 55 00 00 00 00 00 00 3A B9 00 00 00 00 00 00 00 00 00 00 3B B9 00 00 00 00 00 00 D5 00 00 00 0A 1A 00 00 15 00 00 00 0D 00 00 00 

body:
04 01 1E B9 00 00 04 3A 3B B9 00 00 53 


new hex: (virtual 0x11)
header:
50 B9 00 00 50 55 00 00 00 00 00 00 3A B9 00 00 00 00 00 00 00 00 00 00 3B B9 00 00 00 00 00 00 D5 00 00 00 0A 1A 00 00 11 00 00 00 0D 00 00 00 

body:
04 93 01 1E B9 00 00 2C 64 16 0B 0B 53 


-----------------------------------------

XGAIBehavior.HasPredeterminedAbility

original:
m_kUnit.GetInventory().GetPrimaryWeapon().GetRemainingAmmo() == 0 (part of)
18 4F 00 9A 19 19 19 01 B8 8A 00 00 0A 

new:
m_kUnit.GetInventory().GetPrimaryWeapon().GetRemainingAmmo() <= 0 (part of)
18 4F 00 98 19 19 19 01 B8 8A 00 00 0A 

-----------------------------------------

XGAIBehavior.GetPredeterminedAbility

original:
if(m_kUnit.GetInventory().GetPrimaryWeapon().GetRemainingAmmo() == 0) (part of)
07 EE 00 9A 19 19 19 01 B8 8A 00 00 0A 

if(m_kUnit.GetInventory().GetPrimaryWeapon().GetRemainingAmmo() <= 0) (part of)
07 EE 00 98 19 19 19 01 B8 8A 00 00 0A 

-----------------------------------------


XGAIAbilityDM.AI_IntangiblesScore

original:
kWeapon.GetRemainingAmmo() == 0) (part of)
18 23 00 9A 19 00 0A 89 00 00 0A 00 3B B9 

new:
kWeapon.GetRemainingAmmo() <= 0) (part of)
18 23 00 98 19 00 0A 89 00 00 0A 00 3B B9 


-----------------------------------------

XGAction_Fire.UpdateAimingView

original:
m_kWeapon.GetRemainingAmmo() == 0 (part of)
18 23 00 9A 19 01 E2 82 00 00 0A 00 3B B9 

new:
m_kWeapon.GetRemainingAmmo() <= 0 (part of)
18 23 00 98 19 01 E2 82 00 00 0A 00 3B B9 


-----------------------------------------

XGAction_Fire.InternalCompleteAction

original:
m_kUnit.UnitSpeak(((iAmmoLeft == 0) ? 8 : 7)); (part of)
45 9A 00 31 85 00 00 25 16 02 00 24 08 

new:
m_kUnit.UnitSpeak(((iAmmoLeft <= 0) ? 8 : 7)); (part of)
45 98 00 31 85 00 00 25 16 02 00 24 08 


-----------------------------------------

UITacticalHUD_WeaponPanel.SetWeaponAndAmmo

original:
(kWeapon.GetRemainingAmmo() == 0) && (part of)
82 9A 19 00 73 27 00 00 0A 00 3B B9 

new:
(kWeapon.GetRemainingAmmo() <= 0) && (part of)
82 98 19 00 73 27 00 00 0A 00 3B B9 

 

 

 

Link to comment
Share on other sites

So far so good, the Ammo system looks pretty nice. The only thing odd I noticed was converting the version in the middle of combat reduced everyone's ammo to 0. No biggie :biggrin:

 

Oh, well, yeah... the previous version had ammo scaled from [0, 100], and the new version scales ammo from [100, 200] (so anything below 100 counts as 0). Hence any save game in a mission from any old version would have all soldiers with 0 ammo with the new system. It only does this internally in order to trick the native code. Values reported with GetRemainingAmmo are still mostly in the range [0, 100] except that 0 is reported as -100. (If I'd had 2 more bytes I could have fixed that).

 

The new ammo system is basically a "can use any ability as long as ammo is non-zero". Even with 20 ammo left on a 5 shot weapon can still use suppression. Similarly a 10 shot weapon with 10 ammo left can still use suppression.

 

Higher ammo cost never prevents a unit from using an ability -- it only make the ammo run out to zero faster.

 

The check that prevents an ability from being used if there is insufficient (but non-zero) ammo is in native code, so there's not much I can do except circumvent it entirely.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...