public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

Way to reduce 700+ Conditional Branches in Common Event?

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Way to reduce 700+ Conditional Branches in Common Event?
  • Original author: ZombieKidzRule
  • Original date: January 11, 2024
  • Source thread: https://forums.rpgmakerweb.com/threads/way-to-reduce-700-conditional-branches-in-common-event.164711/
  • Source forum path: Game Development Engines > RPG Maker MZ Support

Summary

EDIT EDIT: I changed my approach and everything seems to be working better. My Event is now creating 55% of a Sudoku puzzle (randomly) without any conflicts. Of course, the last 45% will probably be where things go off the rails. But there is still valuable information in this thread. I would just disregard my initial concept. EDIT: NEVERMIND FOR NOW. @Mac15001900 helped me release that my approach isn't going to work. It is not making my brain hurt. Urgh Argh! Hello, everyone. I posted a status update about realizing...

Archived First Post

EDIT EDIT: I changed my approach and everything seems to be working better. My Event is now creating 55% of a Sudoku puzzle (randomly) without any conflicts. Of course, the last 45% will probably be where things go off the rails. But there is still valuable information in this thread. I would just disregard my initial concept.

EDIT: NEVERMIND FOR NOW. @Mac15001900 helped me release that my approach isn't going to work. It is not making my brain hurt. Urgh Argh!


Hello, everyone. I posted a status update about realizing that the way I designed a concept in a Sudoku puzzle was going to require up to 32 Common Events that each have 700+ Conditional Branches to make work. At least the way I know it will work based on what I know how to do.

I have made a working Sudoku puzzle before, but it had pre-generated puzzles. So all the squares of the puzzle had a predetermined, fixed value.

I want to generate a random Sudoku puzzle. So the solution I came up with is this.

I have Location Arrays and Value Arrays for the 9 Columns, 9 Rows, and 9 Groups of the puzzle (81 total squares). Each Location Array has 9 values depicting the 9 possible squares in that Column, Row, or Group. Each Value Array has 9 values depicting the possible values in the Sudoku puzzle (example numbers 1-9).

I am also allowing the player to choose the number of displayed hints (14 is the lowest and 32 is the highest).

To randomly place the values in the puzzle, the Events go through all the Columns then the Rows then the Groups (until the Hint limit is reached).

So, the first Common Event randomly removes a Location value from the Column 1 Location Array to determine which square in Column 1 the hint will be displayed. Then it randomly removes a value from the Column 1 Value Array to determine which number is displayed (example 1-9).

The Location and Value are also removed from the appropriate Row and Group Arrays. So if the 1st square in Column 1 is picked, the 1st square location from the Row 1 and Group 1 Location arrays would also be removed so that square can't be picked again. And the value picked is also removed from the Row 1 and Group 1 value arrays.

All of that really isn't that bad.

But then I decided to have 9 different puzzle types just because I wanted to (Numbers, Letters, Colors, Hero Portraits, Villain Portraits, NPC Portraits, Food Icons, Elements Icons, and RPG Gear Icons).

Therefore, depending on what puzzle type is picked, what is displayed in the randomly selected square for the randomly selected value could be one of 9 things.

So, the 1st square in Column 1 is randomly selected and has a randomly selected value of 1. The player choose the traditional number puzzle so the number 1 will be displayed in that square. If they had chosen letter, then A would appear.

After the random square and value from column 1 is selected and displayed, it moves on to Column 2, then 3, up to Column 9. Then it starts on the Rows. Then the Groups. Then back to Columns until all hints are displayed.

This works and makes sure that no square is picked twice and no value is repeated in any given Column, Row, and Group.

The only way I know how to do this is nested Conditional Branches. Something like:

If Column 1 Location = 1
If Puzzle Type = 1
If Column 1 Value = 1
Show Picture in the correct spot
If Column 1 Value = 2
Show Picture in the correct spot
.....
If Puzzle Type = 2
If Column 1 Value = 1
Show Picture in the correct spot
....
If Column 1 Location = 2
...
ETC...ETC...ETC...LOTS OF CONDITIONAL BRANCHES.

So all of this is just to create a randomly generated puzzle.

I hope I explained this in a way that makes sense.

Can anyone see an easier way to approach this?

Protected downloadProtected downloadProtected download

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

Referenced Images / Attachments

Random Sudoku 1.png
Random Sudoku 1.png
Random Sudoku 2.png
Random Sudoku 2.png
Random Sudoku 3.png
Random Sudoku 3.png
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rpg-maker-archive#mz-support

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar