Long Conditional Branches Question

Hello all,

I am in the process of creating a harvest moon-style game which also has a friendship system. This means that I have a "Friendship Variable" for every person and I have it so that every 5 "points", they say something different all the way up until "Friendship Variable" equals 350 or 400.

The problem I have is that I have a whole bunch of nested conditional branches... So after a point, I can't see anything on the event screen because it's shifted too far to the right. Does anyone have any idea what I can do to make it easier to see? Is there a more efficient way than using conditional branches? Or is there another command I can use in the event window?

Thanks,

grem333
Unless you can somehow still make it while not making them nested, you can't do much about it. In your case, you might be able to just not use nesting, then to avoid unnecessary if block evaluations, just put a label at the end of the event, then after the text for each friendship level, use a jump to label to go to that label at the end. That way you at least avoid evaluation of all the if-blocks for the friendship levels after the current one. In case you're worried about the possible performance impact of those.


Another possibility is using arrays to save what each NPC has to say at each friendship level, then just obtain the text to show. But that would be more troublesome to set up.
Well, you could try unchecking the box for "if conditions do not apply", then have one conditional branch (through the script option) check the following:

$game_variables[id] >= 0 && $game_variables[id] < 5Then put another conditional branch immediately afterward that checks this:

$game_variables[id] >= 5 && $game_variables[id] < 10And so on.
 
So, in an event it'd look like this:
8nDrBXO.png

The very end will get cut off, but it'd be much easier to manage that way, yeah?
Thanks, that's a good idea about using labels. I was worried about performance issues, although I don't have any lag yet at least on my computer.

I think I figured out about what to do with the conditional branches. I can have a conditional branch checking to see if the Friendship Level is less than or equal to 20, but greater than 10, and have the dialogue for that particular level. So For each dialogue level, I can have a separate couple of conditional branches, if that makes sense, so I don't have a billion nested conditional branches anymore. In addition, I can have a label after each dialogue to jump to the end so it doesn't run through any of the other conditional branches.

So far while testing this, it's been working. (yay!)

@Hollow

Hmmm, I never thought about it that way using the script option. I guess that would work, too!
Basically, you should combine our methods... Since his method will still proceed with the next if-block evaluations to check if the things inside the block would need to be run or not, so it will be beneficial to still use the label method to avoid unnecessary evaluations.

Original thread: https://forums.rpgmakerweb.com/threads/long-conditional-branches-question.36750/