Jump to content

R&D Modding Ammo


Amineri

Recommended Posts

I discovered another UI glitch --

 

When initiating the reload action, the weapon icon flashes ammo usage as if the action were a regular shot. This has no effect on game-play -- reloading still fills the weapon to full ammo. This is a rather low-priority bug, so I'll hold off fixing it until I see if anyone finds a more pressing one :)

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 71
  • Created
  • Last Reply

Top Posters In This Topic

Okay, I finally traced down the problem with the ammo and loading from tactical save games.

 

It turns out that XGWeapon's checkpoint record only save the iAmmo and iOverheatChance variables, and not the m_iTurnFired variable the ammo mod uses to store the "real" ammo amount.

 

Upon loading a save game m_iTurnFired would be set to the default 100, in effect re-loading the weapon. However, the iAmmo value was saved and loaded properly, meaning that an out-of-ammo weapon would still not be able to fire, and a partially discharged weapon would have the reload ability available.

 

I tried a few things that didn't work (made things much worse, in fact). However, I finally was able to figure out how to modify the XGWeapon CheckPoint structure so that the m_iTurnFired variable was saved/reloaded instead of the iOverheatChance variable. I'm actually amazed that it worked!

 

The new structure definition reads like so:

struct CheckpointRecord_XGWeapon extends CheckpointRecord_XGInventoryItem
{
    var int iAmmo;
    var int m_iTurnFired;
};

It is implemented via the hex change:

(XGWeapon.CheckpointRecord_XGWeapon.iOverheatChance Table Buffer, to make m_iTurnSaved part of the CheckpointRecord instead of iOverheatChance
change:
95 FE FF FF 00 00 00 00 21 B9 00 00 35 3C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 07 00 28 00 00 00 7E 1C 92 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
to:
95 FE FF FF 00 00 00 00 21 B9 00 00 1E 4C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 07 00 28 00 00 00 7E 1C 92 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

This can be installed onto the existing ammo mod code I've released and should fix the save-game issue.

 

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

 

There's still a couple of display-only issues to resolve. Non-damaging abilities like Reload and the "Aim ability" (renamed Steady Rifle in Long War) still display ammo usage, even though they don't actually use any (or in Reload's case set ammo back to 100).

 

Once I get those patched up I'll re-release the whole hex change package.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...