Stealth game concept -- I need help with making it work !

You could also look at https://forums.rpgmakerweb.com/index.php?threads/ocram-lights-plugin.108614/
This plugin makes it so that if player gets inside light range, the enemy can see them. But! It doesn't block light for obstacles. But I think khas one is better for your situation :/
Oh I didn't saw your message sorry ! Well actually I think I'd rather have them see obstacles. I managed to make something work quite alright : https://www.loom.com/share/db7d3a23cd05434bbe63ff4ca45e30f8


One thing I am struggling with is that I want to make common events for the flashlight and Sight. However it doesn't seem to work, do you have any idea why ?
1595955971083.png


And I also have an issue that I dunno how to resolve. I have this guard standing at the end. My character can switch of a light wich makes the guard start to move to turn it back on.
However, while he is walking, he does not detect the player any longer..Do you know how I could make it so itdoes both at the same time ?

1595957641650.png
The comments are meant for normal events I guess. I don't think comments will work from common events.
Is the sight shape set to poly? Is the player behind the guard? If the guard isn't facing the player he won't see him.
Oh so I guess no common events for me then ^^

The thing is the guard can detect my character BEFORE I active the light switch. But after that it doesn't work anymore. It only works when the guard is back at his original position.
See here : https://www.loom.com/share/58ac3eb141894b689dea7ef918845a5f

I feel like he switch off the detection when he is under an other command :
1595961228652.png
Hmm... it's hard to understand what's wrong here. I'm not the best at debugging. If you can't figure it out, you can try making a new thread so more people can help.
Alright I'll try again and if nothing works I'll do a new thread ;D
Thanks a lot again !
Hey just for your info, I managed to debug it. I just had to put the guard's movement in a separate event :
1595967673449.png

Original thread: https://forums.rpgmakerweb.com/threads/stealth-game-concept-i-need-help-with-making-it-work.124589/