[RM2K3] MULTIPLE VARIABLE CHECK?

Posts

Pages: 1
I suppose the easiest way to explain my question is to tell what kind of game it's for: a visual novel/dating sim. Nothing serious--just a silly little birthday present for my sister. But that isn't important.

Basically, I'm trying to figure out if there's a way to set up a conditional branch that checks and acts based on the values of multiple variables. Every girl in the game has a "Like" variable. Every time you make one happy, a point is added to the variable.
Toward the end, I need a way for the game to check every girl's "Like" value and execute certain scenes based on which one is the highest. How would I go about that?

Thanks for any help!
Trihan
"It's more like a big ball of wibbly wobbly...timey wimey...stuff."
3359
Basically you need to have a bunch of nested conditional branches that compare the girls' like values against all the others. Like say you had Sadie, Leona and Tanya;
conditional branch: if Sadie's like value is higher than Leona's
conditional branch: if Sadie's like value is higher than Tanya's
# code for event that happens if Sadie is highest
else
# code for event that happens if Tanya is highest
end
else
conditional branch: if Leona's like value is higher than Tanya's
# code for event that happens if Leona is highest
else
# code for event that happens if Tanya is highest
end
end
Dunno if Trihan's way is better, but I'd tackle it like this:

If Var. LikeGirl_1 is grater/equal than Var. LikeGirl_2
-If Var. LikeGirl_1 is grater/equal than Var. LikeGirl_3
--Set Var. HighestLike to 1

If Var. LikeGirl_2 is grater/equal than Var. LikeGirl_1
-If Var. LikeGirl_2 is grater/equal than Var. LikeGirl_3
--Set Var. HighestLike to 2

If Var. LikeGirl_3 is grater/equal than Var. LikeGirl_1
-If Var. LikeGirl_3 is grater/equal than Var. LikeGirl_2
--Set Var. HighestLike to 3

Obviously, the more girls in your game the more tedious this will be to code. But the real problem comes when two or more girls have the same Like level, in which case this code will select the last one of them in descending order. If you want that to me more randomized, or depending on some other factors, well... good luck with that. -_-;
Trihan is correct, although that method becomes cumbersome and very, very long as the number of girls increases.

This is a very important topic, because comparing variables in an array is also the way a programmer would determine turn order in a turn-based battle system.

Here's a snippet from my own code which will give you an idea on how to construct an array comparison:



author=alterego
Obviously, the more girls in your game the more tedious this will be to code. But the real problem comes when two or more girls have the same Like level, in which case this code will select the last one of them in descending order. If you want that to me more randomized, or depending on some other factors, well... good luck with that. -_-;

A-ha, don't worry. I've made sure there's an event where the player makes a decision between the girls, so someone will always have one more point. And there are only four girls, luckily.

Anyway, thanks everyone. I think I'll test all these methods and see which one works best.
What happens if they're equal? We can't do greater/equal because the multiple variable checks will need to check against each other. Meaning there has to be one triple nested telling if everything is equal.

Maybe a special bad condition that makes a crappy romance.
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
More like a special awesome condition that makes a three-way
author=LockeZ
More like a special awesome condition that makes a three-way


I love you.
Pages: 1