Jump to content

Changes to weapon attributes are not stored in savegames?


jaime74

Recommended Posts

Hi everybody,

 

I am completely confused after spending hours analyzing the following problem:

 

I am trying to change weapon attributes at runtime using the following OBSE commands

 

setAttackDamage
setObjectHealth
setWeaponReach
setWeaponSpeed
setObjectCharge
setEquippedCurrentCharge

 

This seems to work fine, because I can immediately see all the changes applied to the weapon.

When I save after applying the changes and reload the savegame, the changes are still present. That's fine.

 

But... whenever I quit Oblivion completely, restart, and then reload the savegame, all changes are lost! The weapon always snaps back to the default values from its base form.

Does anybody know why that happens?

 

Here's what I tried to find the answer:

 

At first, I placed the weapon directly inside a cell in CS, i.e. I created a non-dynamic reference with a unique EditorID ("MyWeapon"). In my script, I then used to to change values, like that:

setAttackDamage 50 WeaponEditorID

 

Then I tried to do it dynamically by adding the weapon to the player ingame with code like

ref weaponRef

...

player.addItem MyWeaponFormID 1
player.equipItem MyWeaponFormID 
weaponRef = player.GetEquippedObject 16
setAttackDamage 50 weaponRef

 

At last, in order to see if there is some problem with my scripts, I tried to bypass them by directly selecting the weapon in the console and then using the simple console command:

setAttackDamage 50

 

But the effect is always the same, no matter which method I choose:

- All the changing of attributes works absolutely perfect!

- Reloading a savegame without quitting the game works perfect!

- However, quitting the game and then restarting/reloading does NOT work!

 

Please help... this nasty problem completely overthrows my mod, because without being able to save the changes, it's absolutely useless :(

 

Thanks for any hints!!!

Link to comment
Share on other sites

I believe the problem is that Oblivion resets all of the weapon attributes to their base (i.e. Vanilla) values when it's reloaded. That overrides any changes you made in a mod script, at least until the script runs again. That attribute reset doesn't happen when you merely reload a save game.

I had the same problem with a mod I created which also modifies weapon values. I was able to get around it by creating a script that reapplies the attributes If GetGameLoaded == 1. Or you might be able to get away with using If GetGameRestarted == 1.

Link to comment
Share on other sites

I believe the problem is that Oblivion resets all of the weapon attributes to their base (i.e. Vanilla) values when it's reloaded. That overrides any changes you made in a mod script, at least until the script runs again. That attribute reset doesn't happen when you merely reload a save game.

I had the same problem with a mod I created which also modifies weapon values. I was able to get around it by creating a script that reapplies the attributes If GetGameLoaded == 1. Or you might be able to get away with using If GetGameRestarted == 1.

 

It's good to hear that, because I that is exactly what I was already supposing, though it really confuses me. I have never read anything like that in any documentation, tutorial etc.

Now I have already started to modify my script to do exactly what you are proposing (i.e. to silently reapply attributes via script on getGameLoaded/getGameRestarted).

So thanks for your reply!!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...