Jump to content

found weird engine bug affecting food values


Turija

Recommended Posts

So, in working on my mod Immersive Ingestibles, I have discovered a weird engine bug that affects food values.  To see the bug in action, just open the CK, find Boar Meat (xx03bd14) change restore health to restore health duration and give it a 60 second duration.  save in a new test esp.  load it up in the game and voila, the value of boar meat is 90 Septims.

 

Go back into the CK (or xEdit) to make sure you did not alter the value of Boar Meat, and you will find the value remains at 2.  Since the value displayed in the CK (and xEdit) is different from the value displayed in the game, this appears to be some type of engine bug.

 

If you increase the duration to 3600, the value increases to over 9000 Septims in the game.  Obviously, I do not want my mod's foods to provide durational effects if the side effect is they become worth more than a daedric weapon.

 

This bug only seems to affect a small handful of foods, including Boar Meat, Cooked Boar Meat, Pumpkins (added by ETaC), Gourds, Clam Meat, Ash Hopper Legs, and Ash Hopper Meat.  I am planning on releasing a version 1.1 of Immersive Ingestibles to remove those food items from the mod if there is no solution.

 

Anyone have any advice?

Link to comment
Share on other sites

Hmm...  I wonder if the 2 value after you edit the Boar Meat is just a multipier like this.

 

45x<2>=90

 

Have you test it with 1 instead of 2 and then 3,4,5 just to see what happens in-game?

 

The value for Boar Meat could actually already being set by a different record or a subrecord and the Boar Meat (xx03bd14) record only has a multipier value.

Link to comment
Share on other sites

I tried it with a value of 0, 1 and fractions (like 0.001), but nothing worked.  It would not let me put in a fractions.  0 and 1 still gave me very high values when I loaded it into the game.  I think something is getting multiplied, but I have not been able to figure exactly what the math is behind this weird bug and even with a value of 1 in the CK, the value in game is very high.  

Link to comment
Share on other sites

According to UESP Boar Meat requires Dragonborn unless I missed something.  When you created this altered Boar Meat price esp in CK, did you have Dragonborn loaded when testing it in-game?

Link to comment
Share on other sites

Yes.   :)   I did have Dragonborn.  It is a requirement for my Immersive Ingestibles mod and I always include it in my load order when working on it or testing these issues.

 

But you can see the same thing happen with Gourds and Clam Meat, which are from Skyrim.esm and don't require Dragonborn, so the issue does not seem to be limited to Dragonborn, although several of the effected foods (Boar Meat, Cooked Boar Meat, Ash Hopper Meat and Ash Hopper legs) are from Dragonborn.

Link to comment
Share on other sites

Have started to run out of ideas, so I guess you need to wait for the others here who can help you.  But there could be one last thing to test.  Did you have Requiem loaded after your Boar Meat price.esp in your loadorder?

Link to comment
Share on other sites

No,  all of my mod's esp files are loading after Requiem.  But that is a good point about the possibility of interference from other mods.

 

to test that, I loaded up a new game with only the DLC, Alternative Start and my test esp with a durational effect for boar meat active and consoled in some boar meat and still had the wonky value.  So, I think we can rule out interference from other mods.  

 

Thanks for the help.  For now I am going to remove these foods from my mod.

Link to comment
Share on other sites

Can't help a lot

Would it be better to work with aliases rather than directly modifying base objectsThis mod edits a levelled list and plays around with restore values.

This mod also changes the restore time, although it looks like he's out of the loop atm. :)

Edit: Not editing the levelled lists by any chance?

Link to comment
Share on other sites

Aliases can only work with references. Assigning a base object would not be possible.

 

As for the problem, I've not seen this happen before but are you sure it's not triggering an auto-calc based on hidden values?

Link to comment
Share on other sites

Edit: Not editing the levelled lists by any chance?

Nope, not editing leveled lists.

 

As for the problem, I've not seen this happen before but are you sure it's not triggering an auto-calc based on hidden values?

Not that I am aware of, but how do I check for hidden values?

Link to comment
Share on other sites

These functions are in the SKSE "Potion" script:

Scriptname Potion extends Form

; Is this postion classified as hostile?
bool Function IsHostile() native

; SKSE additions built 2015-05-24 00:46:48.937000 UTC
; Is this potion classified as Food?
bool Function IsFood() native

; Is this potion classified as Poison?
bool Function IsPoison() native

; return the number of the effects
int Function GetNumEffects() native

; return the magnitude of the specified effect
float Function GetNthEffectMagnitude(int index) native

; return the area of the specified effect
int Function GetNthEffectArea(int index) native

; return the duration of the specified effect
int Function GetNthEffectDuration(int index) native

; return the magic effect of the specified effect
MagicEffect Function GetNthEffectMagicEffect(int index) native

; return the index of the costliest effect
int Function GetCostliestEffectIndex() native

; sets the magnitude of the specified effect
Function SetNthEffectMagnitude(int index, float value) native

; sets the area of the specified effect
Function SetNthEffectArea(int index, int value) native

; sets the duration of the specified effect
Function SetNthEffectDuration(int index, int value) native

; gets the use sound of this potion
SoundDescriptor Function GetUseSound() native

; Returns all the magnitudes of this object in order
float[] Function GetEffectMagnitudes() native

; Returns all the areas of this object in order
int[] Function GetEffectAreas() native

; Returns all the durations of this object in order
int[] Function GetEffectDurations() native

; Returns all the magic effects of this object in order
MagicEffect[] Function GetMagicEffects() native

The only things that can be modified are magnitude, area, duration. Some scripting required?

Link to comment
Share on other sites

Thanks for the suggestion, but if I have to resort to scripting to get the effects to work properly, I will probably just leave those few foods out of the mod.  I'd like the mos to remain script free.  As long as the mod only alters the food records and does nothing else, it should be safe to install and uninstall (as long as there are no active food effects) and it should not affect performance.  If I start adding scripts, it could affect performance (in conjunction with other scripted mods) and would no longer be safe to uninstall.

 

There are only six different types of food affected, plus one added by ETaC.  If scripting around the problem is the only to make those foods work, it is probably not worth it.

Link to comment
Share on other sites

It's probably just using the properties on the scripts to get the effects, rather than pages of code.

But yeah, there might be something more to it as some of the other food mods that edit these potions appear not to use the SKSE functions (or at least don't mention SKSE as a requisite)...

Link to comment
Share on other sites

  • 1 month later...

I finally figured out the cause of this weird issue. If you want to use duration effects on food, you need the no auto-calc flag to be checked. xEdit says this flag is unused but it actually does have an effect.

  • Like 2
Link to comment
Share on other sites

Glad you solve your modding problem. :)

Thanks. I figured it out when I was working on the sandwiches and creating new ingestibles. That's when I noticed the no auto-calc flag . . . turned out it was not checked on gourds or any of the other food items that were giving me issues, so I did a quick test and checking it solved the issue with the value. Now I can update Immersive Ingestibles to include those items.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...