Hi everyone,
I'm currently working on a project which involves a character creation at the start of the game. My idea is to ask a lot of questions, activate different switches, then in the end check for all the possibilities. (Yes, that's a lot of possibilities, if there's an easier method don't hesitate to share it.)
So all in all, this idea is very simple. However, i have no clue on how to check for so many switches. Basically, what i'm wondering is how you would do this:
If "this" and "this" and "that" and "this" etc.
create character based on the above switches and answers
All help will be greatly appreciated.
Regards,
- David
Well, you'd put them inside each other. Like so:
@>Conditional Branch: Switch [XXX] is ON
@> Conditional Branch: Switch [YYY] is ON
@> Whatever you want to happen when both are on
@>
: Else
@> Whatever you want to happen when just XXX is ON
@>
: Branch End
: Else
@> Conditional Branch: Switch [YYY] is ON
@> Whatever you want to happen when just YYY is ON
@>
: Branch End
: Branch End
@>
But, I would argue that for such a problem, variables are better, though you may need to be clever to use them.
For all the attributes you want your character to have, you can just assign one variable. That way, a response to a certain question can be assigned a certain value.
For instance, let's just take class selection now. Let's give one variable and two questions for simplicity
We have two possible classes:
Thief
Paladin
Now, we can say that for the character to become a Paladin, he would have to have an outcome above 4. Else he is a thief.
Question 1:
You see an old lady with expensive jewellry walking down the street and nobody is around. You:
(A) Mug her
(B) Offer to Escort her, out of the goodness of your heart
(C) Do nothing
Since (A) is something a Thief would do, add nothing to the variable
Since (B) is something a Paladin would do, add 4 to the variable
Since (C) is neither, add 2 to the variable
Question 2:
You see a lost child who appears to be rich in the wilderness. You:
(D) Offer to help her find her way back home
(E) Kidnap her and try to get a ransom.
(F) Point her in the right direction
Since (D) is something a Paladin would do, add 3 to the variable.
Since (E) is something a Thief would do, add 1 to the variable
Since (F) is something neither would do, add 2 to the variable
Now, we have these outcomes from answers:
AD - 3 - Thief
AE - 1 - Thief
AF - 2 - Thief
BD - 7 - Paladin
BE - 5 - Paladin
BF - 6 - Paladin
CD - 5 - Paladin
CE - 3 - Thief
CF - 4 - Thief
As you can see, it's much more dynamic than switches but somewhat harder to keep track of. That being said, it would take careful scoring (more careful than what I did) to make the choices -> class thing work logically, and the complexity only grows the more questions and classes you include. But, I would argue that those complexities exist also ion a switch based system.
Also, in response to your actual question - if you did it like this the branches would look like this:
@>Conditional Branch: Variable [Class] > 4
@>Class = Paladin
@>Else
@>Conditional Branch: Variable [Class] > 0
@>Class = Thief
:Branch End
: Branch End
In truth, the second con. branch is unnecessary in this case, as there are only two options. If it is not greater than 4, then you are a thief. I included it to show you how it would be done for more cases.
Amazing as always modern. I'm doing this with 4 classes now =D
Also, variables are a piece of cake if you've tried programming ;)
QUADOUBLE EDIT: Everything is fixed, and it's working. Thanks modern!
thanx soooo much man your the best! ;D