Bug #4077

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

Added by Vladimir Ulisko 8 months ago. Updated about 1 month 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 8 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 8 months ago

  • Target version set to openmw-1.0

#3 Updated by scrawl . 8 months ago

Related to #1875

#4 Updated by Vladimir Ulisko 8 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 7 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 7 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 7 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 7 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).

#9 Updated by Dark Locq about 1 month ago

I'd like to beg and grovel for this to receive attention sooner rather than later, even if it comes at the expense of some other tweaks.

This is a severe problem on multiple levels:

  • It's an exploit: fight-and-run repeatedly against anyone with a bad-ass item, go charge your own gear, and come back and beat on them when their gear is drained. You can use this against this entire pack of Dark Brotherhood Assassins in Old Mourhold, at a fairly low level, if you use a speed boost and some poison and paralysis protection. The overall level of active magic in the game is going to gradually decrease over time from repeated conflicts. Even ones not involving you; e.g., the Brindisi High Ordinators use up some of their weapon charges fighting the fabricants, so you have a whole set of those guys who are now easier to beat, long-term, than they should be if you Taunt/Frenzy one at random who is "fresh". Could even seriously exploit this, by healing the fabricants during the fight until all the HO's weapons are drained dry. Same trick can be used against both sides in Ald Daedroth; I've actually done that just to see if it would work (I radius-healed each group of combatants repeatedly until there was no more magic happening from weapon hits).
  • It's a hassle: many cumulative hours can be wasted shuffling companion inventory back and forth to manually drop soul gems on it and make it work again, or to overencumber oneself with everyone's gear, Rest with all of it, then dole it back out again.
  • It can be a major changer of game dynamics away from the Bethesda-engine experience. E.g., huge encumbrance (and lots and lots of CE Fortify Strength to compensate) from dragging around excessive numbers of soul gems to use for frequent item-charging, instead of having a just a few and reserving Soul Trapping for special cases like I-want-to-make-a-new-item. My first custom enchantment in every playthrough is Soul Trap plus some damage effect of some sort, put onto my main weapon so I can trap everything I hit other than humanoids, unless I specifically choose to use a different weapon. And I still frequently run out of filled SG's to charge gear later in the game when I have a lot of magic goodies created with high-end souls and I'm running with a companion or two who also have a bunch.

#10 Updated by Andrei Kortunov about 1 month ago

If we do not want to alter a savegame format, we can try to build magic items list during savegame loading, when we read items data and add items to world, containers or inventory.
Then we can just add item to this list when an actor uses it, and remove it from list after full recharge.
This approach should cover most of cases (maybe excepts of items in inactive cells).

Also available in: Atom PDF