Event update problem

My question may be stupid but here is my situation:

I would like to do a sort of section of parkour with lasers that we have to avoid and which go out from time to time. The event of my laser have an ON state and an OFF state.
And on the ON state, the player is teleported to the start if the player is in the laser. Except that if the player is on the off laser when it turns ON, it is as if the player is not detected and nothing happens.

Do you have an idea of a solution?
Welcome!

For one thing, your conditional branch seems pointless. If laser_desactivate is on, you wouldn't be seeing that event page at all, you'd be seeing page 2 which has that switch as its condition. So that conditional will never be true.

Aside from that...no, the engine doesn't automatically check touch triggers when event pages change.

You don't show the event that turns the switch on and off, but what you can do is this. After turning the switch off (so the lasers are activated), use the Script event command and paste this in:
Code:
$gamePlayer.checkEventTriggerHere([1, 2]);

That will activate any touch events the player is standing on.
Welcome!

For one thing, your conditional branch seems pointless. If laser_desactivate is on, you wouldn't be seeing that event page at all, you'd be seeing page 2 which has that switch as its condition. So that conditional will never be true.

Aside from that...no, the engine doesn't automatically check touch triggers when event pages change.

You don't show the event that turns the switch on and off, but what you can do is this. After turning the switch off (so the lasers are activated), use the Script event command and paste this in:
Code:
$gamePlayer.checkEventTriggerHere([1, 2]);

That will activate any touch events the player is standing on.
Thanks 🙂

Here is the event that turns the switch on and off,
I actually try to put your code everywhere is the event and it don't work
I'm very bad with all the scripts stuff so it may be obvious for you but what ([1, 2]) means in the code? Do I need to put the coordinates of the laser on the map?
Just as a tip, you may want to look up some tutorials on YouTube (or read through the instructions) regarding events.

Each thing you've shown has some basic errors - the conditional in your first post, and in this second post there should not be a Loop inside of it. Parallel events already loop.

I'm very bad with all the scripts stuff so it may be obvious for you but what ([1, 2]) means in the code? Do I need to put the coordinates of the laser on the map?
As I said above:
use the Script event command and paste this in:
Code:
$gamePlayer.checkEventTriggerHere([1, 2]);
That will activate any touch events the player is standing on.

I did not say you had to change anything.

If it's not working for you, please post a screenshot of your event where you're trying it - I don't see it anyplace in the screenshot above.
Just as a tip, you may want to look up some tutorials on YouTube (or read through the instructions) regarding events.

Each thing you've shown has some basic errors - the conditional in your first post, and in this second post there should not be a Loop inside of it. Parallel events already loop.


As I said above:


I did not say you had to change anything.

If it's not working for you, please post a screenshot of your event where you're trying it - I don't see it anyplace in the screenshot above.
OH IT'S WORKING THANKS!!!!

Idk why it works now but not before...
The only thing I did is remove the loop like you said and place again the script
BUT IT WORKS! x)
😂
in case you want a plugin to do this for you for all events which I used,
this might work too as I use it in my game jam to make it work, but there
is another part for moving events that does not, depending on the event
itself, when you stand on the event, it triggers directly when doing nothing,
useful if you have a lot of it, so copy paste and save as JS
JavaScript:
    // Event start when not moving
    const GameEvent_setupPage = Game_Event.prototype.setupPage;
        Game_Event.prototype.setupPage = function() {
            GameEvent_setupPage.call(this);
                this.checkEventTouch();
        };

    Game_Event.prototype.checkEventTouch = function() {
        if (this._trigger == 1 || this._trigger == 2) {
            if ($gamePlayer.x == this.x && $gamePlayer.y == this.y) {
                this.start();
            }
        }
    };

if you have a few, the scriptcall you use can do the trick.
what ([1, 2]) means in the code? Do I need to put the coordinates of the laser on the map?
The checkEventTriggerHere function is running on the $gamePlayer object, so it's using the player's coordinates. It's checking for trigger 1 (Player Touch) or 2 (Event Touch). No, it wasnt obvious, you would've had to search for that function in the core files to know what it did and what arguments it took.

Original thread: https://forums.rpgmakerweb.com/threads/event-update-problem.166633/