Bug #4077

Enchanted items are not recharged if they are not in the player's inventory

Added by Vladimir Ulisko 5 months ago. Updated 4 months ago.

Game Mechanics
Target version:
Start date:
% Done:


Operating system:


In OpenMW version 0.42, enchanted items are recharged only if they are in the player's inventory. Tested: enchanted items located elsewhere are not recharged. The following locations of enchanted items were tested:

  • containers;
  • inventory of NPCs/creatures;
  • surface of the ground.

Enchanted items must be recharged even if they are at a considerable distance from the player (even if they are in a cell not loaded into memory). The factor of resting/waiting should also be taken into account.


#1 Updated by Andrei Kortunov 5 months ago

  • Status changed from New to Confirmed

Can reproduce it with upstream master.

The only place where we recharge magic items is MechanicsManager::advanceTime

#2 Updated by Andrei Kortunov 5 months ago

  • Target version set to openmw-1.0

#3 Updated by scrawl . 5 months ago

Related to #1875

#4 Updated by Vladimir Ulisko 5 months ago

Here is an approximate algorithm for solving this issue.

While loading a saved game, the engine builds a list of used magic items using the data in the saved game file. The term "used magic item" means an item with a charge level less than 100%. During the game, the engine works with this list as follows:

  1. If someone uses a fully charged magic item, this item is added to the list.
  2. If any magic item is fully charged (himself or using a soul gem by player), then such an item is deleted from the list.
  3. Every (1 / fMagicItemRechargePerSecond) seconds of game time, the engine scans the entire list and increases the number of charges by 1 in each item from the list. If any magic item on the list is fully charged, it is deleted from the list (see step 2).


  • The game setting fMagicItemRechargePerSecond can have a value greater than 1. In this case, the engine can increase the number of charges by fMagicItemRechargePerSecond every second.
  • When programming the algorithm, you should take into account pauses in the game, factors of resting/waiting.

#5 Updated by Dark Locq 4 months ago

Question: Would an item recharge in Bethesda's engine under all of the following circumstances?:

  • An NPC used it against me, and I ran away, and came back several days later to finish the fight.
  • An NPC used it against me, I won, and I left it on their corpse then came back for it before the corpse disappeared.
  • I gave the item to a companion, like Tribunal's Calvus Horatius, or a mod companion, and they used it (or I used it before giving it).
  • I left it on a shelf near my bed before going to sleep.
  • I left it outside on the ground in Caldera and then spent several days in the Red Mountain area.
  • I put it in a chest in my player home, then stuck around for several days.
  • I put it in a chest in my player home, then left for several days.

As far as I can tell, an item will not recharge under any of these circumstances in OpenMW, only while the item is in the player's inventory (though whether equipped or not). I'm not on MS Windows, so I don't know what Bethesda does.

#6 Updated by Randy Davin 4 months ago

I tested this in vanilla-> here is the result

Items dropped from your inventory are recharged anywhere, chest, ground, your inventory. Even the player is far away.
Items do not recharge in an NPC.
Items do not recharge in a dead NPC.
Items do not recharge if you take the item from the dead NPC, even if you rest for many days.
Items taken from dead NPC, will recharge, ->IF you use it at least once!(spend the charge or just cast it even theres no charge left).

It looks like items only recharge when the player has used it or owned it first.

A little inconsistent and buggy IMO.

#7 Updated by Chris Robinson 4 months ago

Goody goody Yum yum wrote:

I understand ill stop posting patches until I can sort out a clean repo that only has the openmw changes.

You should be able to simply make a branch from OpenMW's git head which excludes your other changes (leaving them on your normal branch), and make your patches and pull requests from there. Having a clean branch is also good because it lets you properly test your patches, in case your other changes influence the patch's behavior and would work incorrectly without them.

#8 Updated by Dark Locq 4 months ago

Items do not recharge in an NPC.

Zoiks, that's a terrible exploit. All you have to do to beat a tough NPC with a badass weapon is start a fight with them, run away before you die, come back and repeat, until their weapon is drained, and it will never refill until you own and use it. This shouldn't be possible. The NPC should be auto-refilling their items' charges at the same rate the player does (or using the same or a comparable algorithm, if that rate isn't a constant).

Also available in: Atom PDF