Stats as a function of other Stats


#1

So this is probably really basic and might be the case that I haven’t thought it all the way through but I wouldn’t mind some input. My situation is that I’ve decided to split a major stat that would otherwise cover a lot of actions in three and track each element of it individually, but I would also like to record and track it sort of as a separate stat all it’s own.

Basically I want it to be expressed on the stat screen and for all checks as the sum of all three of its “sub” stats divided by three since its a percentage and I want it to never go over the hundred mark.

For starters is this actually possible within the code and if so how would one go about implementing it?


#2

That depends a lot of how you want to work it. Do you want the other three stats capped at 33? Do you just want them capped at fullStat - (firstStat + secondStat)? Are you using fairmath? Honestly, the easiest way is to just not track the combined stat, and just have it equal round(((firstStat + secondStat) + thirdStat)/3).


#3

That’ll do it, but for anyone who’s interested in doing something similar, I think I got the best of both worlds by running @RETowers code as a simple subroutine so that it updates on the stat screen.

For anyone (like m’self) who hasn’t used them before that looks like:

*label swordroutine
*set swordsmanship round(((offense + defense) + (counteroffense))/3)
*return

The only slightly annoying thing about this is that every time I increase one of the component stats I have to remember to run it in the next line or nothing gets updated. That and you can’t run subroutines at the top of a Chapter or else it loops on its own return so you have to find somewhere (between two other labels worked for me) to nest it where it wont cause problems.

Thanks for that anyway, made my game better and saved me a few hours of contemplating my own navel! =D