Multiple stat checks at once

Hello!

Quick question, how would I go about checking two stats at once? For example…

#I’m a pretend choice. You need high intelligence and high strength to make this work.

Usually, you’d simply put “*if (strength > anumbergoeshere) *goto choicesuccess”

But how would I go about checking intelligence and strength at the same time?
I originally tried taking one of the required stats and if the requirement is met, bring it to a label that contains another *if statement that checks the other stat. However, this is quite messy and may lead to errors, especially if it is necessary that the code is right next to each other (no idea how I might separate the lines.) Is there a specific command to accomplish what I’m trying to achieve?

Thanks!

1 Like

What I normally do is add both stats as a sum and then check that.

For example:

*if (smarts + charm) > 100
*goto crit_success

1 Like

You can also use

*if (strength > 65) and (intelligence > 65)
    *goto choicesuccess
*else
    *goto choicefail

(There are some more possibilities for *if statements listed on the wiki as well.)

4 Likes

There’s, I think, a difference between these methods:

The first one checks for the sum of the stats. The second checks for the stats individually.
example:
Your character has, let’s say 20 Smooth-Talking and 40 Nimbleness. They have to woo the Contessa on the dancefloor.
Method one might check if Smooth-Talking and Nimbleness add up to 50, which they do by far, meaning the check would be passed.
Method two would check if both surpass 25, which the first skill fails. (meaning you dance well, but she’s really taking aback by your talk)

Pick which method is best for what you want to do.

Good Luck

6 Likes

There are 2 ways:

*selectable_if ( (strength > STRlimit) and (intelligence > INTlimit) )#I’m a pretend choice. You need high intelligence and high strength to make this work.




#I’m a pretend choice. You need high intelligence and high strength to make this work.
   *if ( (strength > STRlimit) and (intelligence > INTlimit) )
         You're successfully passed the check.
   *else
      Womp womp
2 Likes

Wow, super helpful! I had no idea I could just put and! I’ll definitely have to look over the wiki again, too. Thank you so much!

1 Like

Thank you so much, I get the difference a little better now. Some pretty cool stuff can be done with that, I think. I really appreciate it!

This is the best advice: There are several ways to accomplish the stated goal… in the abstract sense. But each of those methods produces different results! The “correct” method is the one that produces results closest to what was envisioned.

Building on from that, here’s a way you could take the sum of two variables, then give different outputs depending on how those two variables balanced:

*if ((str + int) >= 60)
	*if (str >= (int * 2))
		You succeed through brute force.
	*elseif (int >= (str *2))
		You succeed through sharp wit.
	*else
		You succeed through a balanced approach.
*else
	You fail.
3 Likes

Why no

str > int

instead of

str > int*2

?

Having STR/INT 30/40 would pass you through brute force, which is obviously not the case.
Messed my calculation. My point is be simple and avoid making things more complicated.

Though, actually, with the *2 approach, you can pass to “balanced approach” as long as your str/int ratio is in the range of 0.5 ~ 2.

Question resolved!