SetActorValue operating weirdly...

Post » Fri Jan 14, 2011 3:18 am

It was my understanding that setActorValue (or setAV) was supposed to set a value directly; however in one of my recent scripts I have found this not to be the case. It seems to coincide with using modActorValue to change the value first. I wanted to know firstly is this working as intended or is it a bug and secondly is there a way to work around it?

For example: (note: I have no other mods running)

- Take the rightMobilityCondition (right leg health)
- Its current value is 100 (ie full health)

- If I use the following commands:
- player.setAV rightMobilityCondition 0
- player setAV rightMobilityCondition 100

- I will get 0 (right leg crippled) or 100 (right leg full health) respectively

However if I use the "modActorValue" function beforehand to change the current health to 50 for example:

- player.modAV rightMobilityCondition -50
- (now the right leg is at 50 health)
- I then repeat the two setAV commands

- player.setAV rightMobilityCondition 0
- player setAV rightMobilityCondition 100

- I get 50 or 150 respectively
- Rather than what I would expect; ie 0 and 100

- Also if the current health were 50 again but I do:
- player.setAV rightMobilityCondition -100
- I get -150


Its almost as if 50 has become setAV's new "zero point", which is bizarre and not how I expect the command to work at all. I have also noticed the same behavior when setting the "radiationRads" value.

Take another example; if I use modAV to get the rightMobilityCondition to 0 and then do:
- player.setAV rightMobilityCondition 100

I would fully expect to see the rightMobility condition be 100, but no instead it remains as 0.

I don't understand why it is doing this?
User avatar
Beast Attire
 
Posts: 3456
Joined: Tue Oct 09, 2007 5:33 am

Post » Thu Jan 13, 2011 7:36 pm

When you 'mod' a value, its a new piece of the math that is incorporated into the total.
When you 'set' a value, that is the new starting point.

So, you 'mod' the value to -50. The set value is still at 100 so its mathed together to give you 50.
And then you 'set' the value to -100. That maths the two values together to make -150.

Other maths can include perks and equipment bonuses/curses.
User avatar
DAVId MArtInez
 
Posts: 3410
Joined: Fri Aug 10, 2007 1:16 am

Post » Thu Jan 13, 2011 10:39 pm

The only one you should use on the player is ModAV, because once you use SetAv or ForceAv, you can't undo it. Use player.GetActorvalueinfo at the console to see what I mean.
User avatar
Ron
 
Posts: 3408
Joined: Tue Jan 16, 2007 4:34 am

Post » Thu Jan 13, 2011 5:16 pm

Looks like using setAV is a big no no.

Will have to stick to modAV then.
User avatar
latrina
 
Posts: 3440
Joined: Mon Aug 20, 2007 4:31 pm

Post » Fri Jan 14, 2011 1:44 am

When you 'mod' a value, its a new piece of the math that is incorporated into the total.
When you 'set' a value, that is the new starting point.

So, you 'mod' the value to -50. The set value is still at 100 so its mathed together to give you 50.
And then you 'set' the value to -100. That maths the two values together to make -150.

Other maths can include perks and equipment bonuses/curses.


OK I just tested what you said and it appears to be correct. Thanks
User avatar
Darlene Delk
 
Posts: 3413
Joined: Mon Aug 27, 2007 3:48 am

Post » Fri Jan 14, 2011 4:51 am

OK I just tested what you said and it appears to be correct. Thanks

I am glad you tested it yourself. You should take nothing as gospel. :)
User avatar
Irmacuba
 
Posts: 3531
Joined: Sat Mar 31, 2007 2:54 am


Return to Fallout 3