SetAV vs. ForceAV

Post » Tue Nov 20, 2012 1:08 am

Hello!

Can anyone explain the difference between these two functions?

I'm using the Fame AV as a stand-in for actor level by calling forceAV (or setAV, idunno, thus the thread XD) inside an OnLoad block on a constant effect ability that I plan to add to everyone at the race level.

Should I use forceAV or setAV? What's the difference? Why isn't level just its own AV to begin with?
User avatar
Lucy
 
Posts: 3362
Joined: Sun Sep 10, 2006 4:55 am

Post » Mon Nov 19, 2012 10:43 am

I believe SetAV sets the base, while ForceAV sets the total.

For example, let's say my sneak is 50, and I have armor that gives me +15 sneak. My sneak is 65.

SetAV of 70, would give me 70 base sneak, +15 from my armor, giving me a total of 85.

ForceAV of 70, would force the total value to 70, regardless of modifiers, giving me a total of 70.

I think... :P
User avatar
Stacy Hope
 
Posts: 3391
Joined: Thu Jun 22, 2006 6:23 am

Post » Mon Nov 19, 2012 11:28 pm

Level is not an AV because, well, it isn't. I wish it was.

SetAV sets the base value of the AV, before any modifiers.
ForceAV just sets the current AV to whatever you pass to it, modifiers and all. This has potential to mess up the base value.
User avatar
Noraima Vega
 
Posts: 3467
Joined: Wed Jun 06, 2007 7:28 am

Post » Mon Nov 19, 2012 5:18 pm

Testing with the actor value 'Fame', it looks like they've taken the teeth out of ForceAV. In previous games forceAV effectively breaks the Actor Value. I would still avoid using ForceAV, but now, ForceAV seems to just update the PERM value to the value you are forcing it to. ModAV adds or subtracts to the PERM value. The effective value (GetAV) is the base plus the PERM. So if you are going to just track some value, I would use SetAV to set the base value.
You can test this at the console by using the GetActorValueInfo command.
User avatar
Damned_Queen
 
Posts: 3425
Joined: Fri Apr 20, 2007 5:18 pm

Post » Mon Nov 19, 2012 9:55 am

Just a performance note:

Get/Set/ModAV are all just shorthand for Get/Set/ModActorValue and are thus measurably slower than their native equivalents.

Spoiler
[10/10/2012 - 09:54:07PM] Code Comparer log opened (PC)[10/10/2012 - 09:54:07PM] Code Comparer Version: 1.010000[10/10/2012 - 09:54:07PM] Skyrim Version: 1.7.7.0[10/10/2012 - 09:54:07PM] SKSE Version: 1.060100[10/10/2012 - 09:54:22PM] === 'GetActorValue' ===[10/10/2012 - 09:54:22PM] Time elapsed (calibration offset) for an empty test: 0.013000[10/10/2012 - 09:54:22PM] Started 'GetActorValue' at: 21.684999 | Iterations to complete: 1000[10/10/2012 - 09:54:22PM] Finished 'GetActorValue' at: 31.790001 | Iterations completed: 1000[10/10/2012 - 09:54:22PM] Time elapsed (Raw) for 'GetActorValue': 10.105001[10/10/2012 - 09:54:22PM] Time elapsed (Calibrated) for 'GetActorValue': 10.092001[10/10/2012 - 09:54:22PM] Approximate time for each iteration (Raw): 0.010105[10/10/2012 - 09:54:22PM] Approximate time for each iteration (Calibrated): 0.010092[10/10/2012 - 09:54:32PM] === 'GetAV' ===[10/10/2012 - 09:54:32PM] Time elapsed (calibration offset) for an empty test: 0.009998[10/10/2012 - 09:54:32PM] Started 'GetAV' at: 31.841000 | Iterations to complete: 1000[10/10/2012 - 09:54:32PM] Finished 'GetAV' at: 42.040001 | Iterations completed: 1000[10/10/2012 - 09:54:32PM] Time elapsed (Raw) for 'GetAV': 10.199001[10/10/2012 - 09:54:32PM] Time elapsed (Calibrated) for 'GetAV': 10.189003[10/10/2012 - 09:54:32PM] Approximate time for each iteration (Raw): 0.010199[10/10/2012 - 09:54:32PM] Approximate time for each iteration (Calibrated): 0.010189[10/10/2012 - 09:54:41PM] Log closed

Not much of a difference, but every little bit helps... Also, if using any of the 'Set' commands, passing a float value rather than an int will shave a bit of expense as it will negate the slight cost of autocasting.


You should never use ForceActorValue - instead, use ModAV to adjust the stat to the required value. If several mods make changes to the same value at the same time, and one of them uses ForceAV the stat is likely to end up irrevocably altered.
User avatar
Astargoth Rockin' Design
 
Posts: 3450
Joined: Mon Apr 02, 2007 2:51 pm


Return to V - Skyrim