Very hard scripting question, level God.

(late edit: Figured it out.(kinda). I'll leave the thread open for ideas on how to optimize this)
I want to dynamically create an event.
On top of that, said event will trigger a common event upon contact with the player.
ON TOP OF THAT, the condition for that event will be an area-based check.
(on the tippity top of that, I'm making two different triggers: radial and square, but that's another story)

I got the dynamic creation figured out.
I can create characters and random events, program them on the fly, put them on the map, send them wherever, make them do all sort of things. That works.
I got the area check part figured out, through some customization of the MoveRoute class and some tweaking of the Victor Engine plugin, which includes the function .in_rect?() and .in_radius?()

The problem comes when firing up the target common event.
I got the AreaCheck object coded, placed, and enabled.
I got the link to the common event, and I got the hook to the interpreter to run it.
The problem is, the event runs when the player gets in, and out, of the target zone.
It should run as the player enters the target zone.
(late edit: FIXED. Works as intended)

the RadiusCheck object works (ish, through a different approach), and it triggers the events within a map event manually placed and filled with its instructions.
(as in, it's an autorun event that fires when the player enables a variable, through the RadiusCheck)

what I need, is to do the same thing, via plain code, not by map eventing.

I know I'd have to inject a line somewhere down the run of the interpreter on watch, or pause it somehow, but $game_temp.reserve_common_event(id) does what I just explained.
I need not reserve it but run it, on the fly.
(late edit: NOT FIXED. Very crappy resolution)

any thoughts?
I can provide code examples if requested.... I don't want to overload the post.
Given that a reserved common event will run in the next map update cycle after reserving it, what will running it on the fly accomplish that the call to reserve_common_event doesn't?
Perhaps checking the following script for Ace might help you as it was written to support dynamic event creation:
http://himeworks.com/2013/06/event-wrapper/
Perhaps checking the following script for Ace might help you as it was written to support dynamic event creation:
http://himeworks.com/2013/06/event-wrapper/

That's basically what I did, minus the hook into the interpreter itself.
I'll keep that present, though..... right now, my solution works, with the benefit of not being a 3rd party script.
Mine is a bit more complex since it handles movement and interactions with the player

After I posted the thread, I went back to the code, and I think what was happening was that upon contact with the player, the trigger kept reserving the common event in an infinite loop.
When I got out of the trigger area, the event fired.
To solve that, I removed the event, so now it reserves the common event, removes itself, the map updates, and the common event fires.
As it is, it works for one-time triggers, and I don't think I'll need multiple triggers for now.... if I need the trigger re-enabled, I can just go back, trigger the sequence again, and it will reset normally.

This was designed for an open world kind of map, where the player must go from point A or character A, to point B or character B.
It can be either thing, so I needed a way to check for the player being in an area, anywhere on the map, without having to manually set up events in the editor, to account for dozens of diferent characters, who might or might not be there, depending on wether they are created or not, by a quest system that handles the narrative.
This way I can look for characterX by name, and if it's there, put the area check on top of them.

it's the whole point of scripting, to optimize work. 😀

Original thread: https://forums.rpgmakerweb.com/threads/very-hard-scripting-question-level-god.75362/