Script call for Terrax Lighting?

Hello there!!
I'm trying to create a stealth mission for my game (with very bad results 🤣)! I'm using, as said, terrax lighting.

The structure of the dungeon is the following:
- The player must get from point A to point B passing through a hallway, which is guarded.
- A guard is walking from side to side parallel to the hallway, with five stops along the way.
- For each stop, there is a torch which lights in the moment the guard gets in front of it. Once the guard moves, the torch turns off.
- If the player is found next to a lighted torch, an event will trigger and the player loses.
- If the player stays in the dark, so standing next to a turned off torch waiting for the lighted one to shut, it will not be noticed.


I've put five different regions, one for each torch. What I'm trying to do is to create several conditional branches that check if the player is standing in the same region as the guard. The thing that i'm missing is the script call that checks if the light is on or off. In fact, if this last part is missing, the guard will notice the player even if the torch is not lighted.
There is a plugin command that turns on or off the light, but I don't know how to use it in a conditional branch.

Could someone help me? Or even suggest a different way to get what I want?

I hope everything is understandable ☺️
Hi!!

How about instead of checking if the light is on or off via script (which i dont think there is a script call for that within Terrax lightning), instead, have a switch on and off when the light is turned on/off. Then you can check the region of the player and the guard.

To check the region a player is standing, just save the players coordinate in two different variables and then run a Get location info, where you will get the region on those coordinates.

To check the region of the guard, you can check in a conditional branch, script: if $gameMap.event(IDofGUARDevent).regionId() === X; where X is the region he is standing.

So if everything checks out, switch of light is ON, player is standing on region X and guard is standing on the same region X, bam! caught.

Something like that hehe
Actually, I was trying to do it without using any switch to become more independent by them and learn some scripting hahaha. Yet, is obviously the best solution, so I'm going to do it the way you said it!
Thank you very much!!

Hi!!

How about instead of checking if the light is on or off via script (which i dont think there is a script call for that within Terrax lightning), instead, have a switch on and off when the light is turned on/off. Then you can check the region of the player and the guard.

To check the region a player is standing, just save the players coordinate in two different variables and then run a Get location info, where you will get the region on those coordinates.

To check the region of the guard, you can check in a conditional branch, script: if $gameMap.event(IDofGUARDevent).regionId() === X; where X is the region he is standing.

So if everything checks out, switch of light is ON, player is standing on region X and guard is standing on the same region X, bam! caught.

Something like that hehe

Original thread: https://forums.rpgmakerweb.com/threads/script-call-for-terrax-lighting.111175/