Need last minute help with brother's Light Puzzle script
BMM_Archive · July 15, 2026
Original Source
- Original title: Need last minute help with brother's Light Puzzle script
- Original author: Valkymie
- Original date: August 7, 2015
- Source thread: https://forums.rpgmakerweb.com/threads/need-last-minute-help-with-brothers-light-puzzle-script.43355/
- Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSSx Script Support
Summary
First off, the script in question: Also, Demo Spoiler module Light_Puzzle def self.initialize() # This maps the event IDs to the physical location indices used by the code # 1st ID -- 2nd ID -- 3rd ID # | | | # 4th ID -- 5th ID -- 6th ID # | | | # 7th ID -- 8th ID -- 9th ID @mirror_id_mapping=[1,2,3,4,5,6,7,8,9] ...
Archived First Post
Also, Demo
Now then, for the last puzzle in my game I wanted it to be a light puzzle. It's the only thing I have left to work on for my game, but since I cant get it to work yet, I made a back-up version that just skips this part of the game...
My brother has work, so he can't really help me anymore before the deadline for IGMC2015
How it goes is that:
There are 9 mirrors you can rotate, add a color prism to, or remove a color prism from. That part pretty much works.
When the mirrors are lined up a certain way, a path of light will shine (another event) The mirrors have to "make" a 90 degree angle. So a path of light can't shine through the back of another mirror so to speak.
Here's an example of a "winning" path.
x x---x
|
x x---x
|
x---x x
Which is from top-middle to bottom-left like so. (As far as I'm concerned there's only one other path that works)
But as you can see, there are no "3-in-a-row" straight lines of light beams
THE PROBLEM:
is when it comes to figuring out the colors of the light beams, and whether the graphic will be horizontal or vertical. Let's start with the latter.
At the bottom of the script is where my brother told me to put all the combinations of what prisms are set in the mirrors, and what color beam that will produce, the first (top middle) mirror having a white prism in it to start, and the last (bottom left) has a blue prism in it, but I believe he said the script doesn't "count" that last mirror's prism (its prism also isn't counted in the when calls at the end of the script).
So for example, if you have a path set up like diagram above, putting a red prism in the top-right will make the light beam it produces below it red. Put a blue prism in that next mirror, the next light beam will be violet, put another blue in the next one, the beam will be blue-violet, etc. (player has 3 red, blue, and yellow prisms each)
However, I can't figure out how to make the script check which direction the mirror is facing. Because if it's up or down (2 or 8??), it needs to use the vertical light graphics (ends in V instead of H)
My brother via skype said the following:
The light ID index stores the positions indirectly. You know if it's first or last in the group of 4 that it's vertical. Try to use that to know whether it's vertical.
I can't write the code or anything but that's the way I'd do it
Actually use dir the mirror direction
I made it so the next beam of light to draw is in the mirrors direction
Change the get color index function to accept dir as a parameter, and use that to determine the orientation
So doing that should fix the problem with the colored light beams all showing up as horizontal.
The Other Problem:
is the deal with the color itself. There's a section in the script that says "uncomment these lines when you're ready", which are commented in the script I posted. Lines 75-77 in rpg maker
IF I keep them commented, the lights remain default white, and the puzzle is complete-able in its monochrome state, but it would mean not using the colored prisms at all.
When I uncomment these commands, and try to re-create the path in that diagram I made, the first light beam is white as it should be, but the second one is blue despite there not being any prism in that second (top right) mirror (is this another side effect of not being able to use the vertical beam images yet?) I even tried removing the blue crystal from the last mirror, and the " && color == "!$BlueViolet": from line 62 (defining that you need the last beam to be that color in order to succeed), but it was still showing up with a blue horizontal beam instead of a white vertical one
and then, when I try to move the next mirror (middle-right), I get an error that says:
Script: 'Game_CharacterBase' line 246: NoMethodError occurred.
undefined method `[]' for nil:NilClass
Idk if that's a problem in the script or if it's a problem in the event itself.
Also, here's screenshot examples of what the mirror event pages look like, just in case.
[IMG]http://i.imgur.com/6AT3Raj.png[/IMG]
[IMG]http://i.imgur.com/ixGn4Lc.png[/IMG]
[IMG]http://i.imgur.com/UVCzp3O.png[/IMG]
[IMG]http://i.imgur.com/ouHWilt.png[/IMG]
[IMG]http://i.imgur.com/CuQEnu6.png[/IMG]
Personally I don't think it's an issue with the events but hey what do I know.
So basically yeah, I just can't get the colored beams to work right
If anyone can help me before the contest ends, that would be hella lovely
Thank you so much in advance!
P.S. if you need more information, let me know!
Downloads / Referenced Files
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadCreator 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.
Replies (0)
No replies yet.
Topic Summary
Loading summary...