How to make stats variable depend on another stats variable?(with math operation)

As you can see in the picture, i have these main stats and the sub stats

the main stats should affect the sub stats whenever it changes
ex: if i upgrade the “phys” main stats from 0 to 5, the “max_life” sub stats will also rise from 0 to [main stat “phys” x3]

anyone have an idea how do i do this?

image

*set phys +5
*set max_life (phys*3)

Have you tried something like that?

3 Likes

if i put it in the startup file will it always automatically work whenever the main stat change or i have to put this code every time the stat changes?

I would put those two *set commands in a subroutine/label which I would call whenever necessary. The value to increment would be a parameter of that function.

1 Like

Both the options would work, with the individual command each time you modify the main one, and on a sub routine you’ll also call whenever you modify the main variable. As far as I know choicescript doesn’t have a background running checking for the variables so you have to do it manually one way or the other.

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.