Conditional Branches around Events?

Hey folks,

So I want to know if there's a way to have a certain event happen when you are in line of sight.

For example, if you were added an event that is a cop, walking around... and if the cop is within a certain range of you and you do something illegal, it will activate another event. Best I can think of right now, if weed were illegal and you used a weed-item in game and the cop sees you... then something occurs. I do know about setting up conditional branches and randomized variables for different results and whatnot, but the specific thing I need is to figure out how to let an cop npc "see" you commit crimes.

Any help would be greatly appreciated.

[For RPG MAKER MV]
"How do I questions" belong in the Support forum for the engine you are using. Please confirm which it is so that this can be moved.
Moved to: MV Support

Depending on exactly what you want to do it can be done by events (just checking corrodinates with a lot of variables), or it might need plugins (especially for complex ranges or line of sight problems).

I suggest you start with the event options first however.
The method here is to have the cop event two pages, the second conditioned on a switch "crime committed" and setting that switch in the event where the player does something wrong. That will allow you to switch the event behaviour from "standing guard" to something else like "hunting player".
My apologies for the incorrect thread --- I appreciate the response Andar, I'll give it a go!


[[EDIT]]
For anyone interested, I got somewhat what I was trying to accomplish thanks to Andar...

Cop page 1: Whatever you want a cop to do.
Cop page 2: He chases you when a switch is turned on.

Illegal activities in my game, if done, is controlled via variables and conditional branches.
So, if the player, for example, randomly attacks a person, theres a chance it can turn on the switch... triggering all the cops on the same map to chase you.

You can make different switches for each thing considered a crime so you can have different things occur depending on the crime committed, if caught.

Figured I'd post the full steps I took from the original question in case anybody watching is curious.

Thanks for the support guys! One thing I still have not done (because it seems impossible without a script) is giving cops a line of sight, so with that in mind, all I can do are variables giving cops a chance to catch you whether or not you commit a crime in their line of sight.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branches-around-events.77720/