It doesnt matter what you intend. Its a player you have to deal with.
Will i be able to see inside the dark cave if i log out and log back in while inside the cave entrance? Yes. So ill do that and screw your making the cave dark.
Assume you have 2 triggers.
A and B.
A is at the mouth of the cave.
B is a little deeper in.
The player traverses both A And B - it entered the cave. Toggle skylight off.
The olayer traverses A. Doesn’t touch B. Touches A again. No need to do anything.
To make it cleaner and so that A can be B and B can be A you can just use the dot product to get a heading.
Place an arrow (not visible in game) within A.
The player touches A, take his acotr forward vector.
Dot product to arrow forward vector.
Is the result 0? Same direction.
Ofc you can’t use =0.
You have to use something like <= .5 and >= -.5
As thats the nature of dot product.
This enables you to determine if your first hit is “coming” or “going”.
Then you can re-use A as the second checker earlier called B.
Just add code in there to see if the player had already crossed what we called A.
If true and the direction is still correct, then affect the lighting.
If not, do nothing to the light and untoggle the check that says you passed through A.
You need to refine that some more for actual play, but it eliminates most possible hack while keeping your components to a bare minimum and its fairly easy to use to toggle other things - entering hose doors where you only have room for one check, for instance.
While you are at it, look up what interfaces are, and use those.
Implement one on the character to respond to whatever the entrance BP will tell it to respond to however the character sees fit.
Or the skylight, or whatever other things needs to be made to respond individually.
(Normally a light control BP that references other level objects as variables you can pick with the eye dropper within PIE and set to default is used to control all of this. And you sjojld really look into creating that so you dont need to “look around” for things within your project(s))