Simple Eventing Question?

Hello all,

I'm having some difficulties with, what I assume should be, some rather simple eventing. Basically I have 2 character graphics, Light tube ON, Light Tube Off. And A room of lets say 30 Light Tubes. Each is it's own event that, when touched by the player, turns ON the light tube (change graphic) and any other tubes that the player has touched turn OFF(change graphic of other events???). All tubes start with the OFF graphic when the player enters the room. Also, if possible through eventing, I would like to place 1 event in the center of the room that can turn ON any light tube through choice dialog. (This center event also needs to turn all tubes, other than the players choice, OFF.) 

What are some suggestions on achieving these effects?
Do you have a diagram of some sort to show how you have the tubes laid out? I've got a few ideas but each one may not be relevant depending on how the room would look.

Are they in a grid format, along a linear path, or something else entirely?
They are in grid format,

I was thinking of using variables A-J to make a Battleship like grid (A1-10...J1-10) to use within the center events dialog (the command console if you will).

The room can hold 10x10 right now

[IMG]http://i.imgur.com/Ix4NiRj.png?1[/IMG]

This is what it'd look like but with more tubes and up to 10x10. The center being the little console 
I haven't tested this out so it's theoretical for now. You won't need any custom scripts but you'll need to do some script calls.

So I figure it's probably best to use two pages in each lamp, this way you just have to work with self switches and one variable.

We'll use variable 10 for this example, but you can change it to whatever. Just change 10 in the script calls below to whatever you want to use.

Call the variable "Last Triggered Lamp" if you want.

To keep things simple, make sure to make all of the lamps together in a batch. That is, copy and paste them one after another until all of them are made, so they are in order according to their IDs.

Each lamp event will have two pages.

Page 1 will be triggered via player touch. It will call a our special common event.

Page 2 will have a self switch A condition, it will be lit, and there will be no actions on it.

The common event is like so:

no trigger

Conditional Branch: if Variable 10 is greater than or equal to 1.

Then

$game_self_switches[[mapid, $game_variables[10], 'A']] = false

Turn on Self Switch A.

script call:

$game_variables[10] = self.id

Now when you touch a lamp, it will trigger the common event. First it will check if the Last Triggered Lamp is 1 or more. Since it hasn't been used yet, it wont turn any lamps off.

Next it will turn on self switch A. This will turn on the current lamp.

After that it will record the ID of this lamp onto the Last Triggered Lamp.

That means next time you trigger a lamp, it will turn the previous lamp off based on its ID.

As for the thing in the center of the room, I'll need more details exactly what you want it to do. Will there be any switches that turn all of them on or off?
Hmm, for some reason they wont stay lit. They flicker on then off once each time the action button is pressed.

Maybe I set up the common event wrong. All of that is placed under "Then" in the condition Right? Nothing is done with Else or after Branch End?
The only thing that goes inside the "then" for the conditional branch is the line directly underneath it, the $game_self_switches script call. Don't forget to replace mapID with the current map ID.

The rest are outside of the conditional branch in that order.
I have created a quick project that creates the effect that you are after. You can nab the project here : Light Switch


Each light event must be named in the following manner : 'light_event_{number}' (example : light_event_14). The required name can be altered, but that is the default. In this way, it will not matter what order you place the events on the map, as the scriplet determines if the event is a light by inspecting the name. Also, you can easily enable a light by using the number input command and saving that number to a variable.
The only thing that goes inside the "then" for the conditional branch is the line directly underneath it, the $game_self_switches script call. Don't forget to replace mapID with the current map ID.

The rest are outside of the conditional branch in that order.
Yea, after that last post my brain started working and I figured the first part out. After fixing that though (and mapid *faceplam*) I received the Script Game_Interpreter line 1411 error.  🙁   I appreciate the attempt to help  😀

I have created a quick project that creates the effect that you are after. You can nab the project here : Light Switch

Each light event must be named in the following manner : 'light_event_{number}' (example : light_event_14). The required name can be altered, but that is the default. In this way, it will not matter what order you place the events on the map, as the scriplet determines if the event is a light by inspecting the name. Also, you can easily enable a light by using the number input command and saving that number to a variable.
Thanks  😀 , I'll give that a look.

Original thread: https://forums.rpgmakerweb.com/threads/simple-eventing-question.18129/