Scripts - ApplyEffect() format


#1

I was wondering…

I see 3 formats using 3 or 4 arguments:

ApplyEffect(confidence,-0.35,0.8,dumped);
ApplyEffect(happiness,-0.14,_HAPPINESS_DEGRADE,default bad);
ApplyEffect(stress,0.310,_STRESS_DEGRADE);

The first argument seems to be the attribute. Followed with a min/max value.
The _CAP_LETTERS seem some default or current value.
What is the (optional) 4th label?


#2

I think the 4th argument is some kind of debug information to track where changes to an attribute came from.

I don’t think that the second argument has something to do with min/max value, it seems to be simply amount the value should change, so a negative value will make it go down.

What I am puzzled about is what exactly the third argument does. The Caps letters just seem to point to a constant defined somewhere else.
Probably this is some kind of min max value or some other kind of factor to decrease a change when approaching the extremes 0 and 1.
Anyone knowing more details?


#3

Ok forget about my guessing former guessing stuff regarding the third parameter.

After playing around a bit I’m now quite sure it works this way:
The third parameter is the dracrease factor of the attribute change.
The value of an attribute is it’s default value plus all the changes in history.
After every day all the changes are multiplied by their decrease factor, being removed if they became too small.
So a decrease factor of 0.0 means, the change is just for one day, a factor of 1.0 and the change will be permanent.
Given the exponential curve the values will decrease quite fast, unless the values is very near to 1.0, this is why you see values like 0.97
which results in a half-value period of about 3 weeks.

All this becomes quite clear if you take a look into the save game files.