Multiple gains — how to take into consideration all of them at once?


#1

Hello!

I hope you guys are doing great!

I am trying to code different endings that would depend on what you have or haven’t gained in your story. For example, you can gain someone’s respect, love and, say find a special item. I use gains for all these commands.

Then, I’d like to code different endings, for example, the first one where you managed to gain everything, the second one where you gain a combination of features and the third one where you gain nothing.

How would I code that using the if/elif command if I just put in brackets one gain?

For example, can I put if (gain_respect, gain_love, gain_item) together for the 1st ending and, say, elif (gain_respect, gain_item) and elif (gain_love, gain_item), elif (gain_respect, gain_love) and else . If not, how do I do that?

Basically, how would I code this type of thing? I hope I explained it clearly enough.

I would highly appreciate any help on that!

Thank you very much in advance!
:blue_heart::blue_heart::blue_heart:


Tara explains: Ifs, elses, gains, labels, gotos and the points system!
#2

Hi, Alex :slight_smile:
It would look like that:

if (gain_respect and gain_love and gain_item) {

} elif (gain_respect and gain_item) {

} elif (gain_love and gain_item) {

} elif (gain_respect and gain_love) {

}


#3

I see, thank you very much, I will try that out!

:blue_heart::blue_heart::blue_heart:


#4

Did this answer your question? :slight_smile:


#5

I hope so. I haven’t tried this out yet though.


#6

Be sure to let us know if it works! :slight_smile:


#7

I will, thank you!