Variable and (or) event updating problem?

So in my game (wich is basicaly a Zelda game) to prevent massive lag, ennemies are loaded in the map segment when the player enter it. The problem is, even using two different methods, the result is (almost the same) some variables or an event don't update correctly, thus causing random dispawns (the common event that place events first put them into an unreachable area, the load into the respective map segment using conditional branchs). My game also use a zelda-like camera script but I don't think it is the problem here.

Method 1
This method involve the use of screen position X Y (not player position) ,I determined every combinaision as you can see here when the player reach the corner of the screen and the camera start to move (after some test, the camera script indeed update the screen position), so in the overworld, I set up a paralell process event wich when the player is facing either one of the 4 direction it call for the common event {RW}::region_id.int . In said common event two variable get the hero screen X Y , there is multiple conditional branches with script call like this:
Code:
$game_variables[253] == 16.0 && $game_variables[254] == 32.0
(note: i found the ,0 required later after creating the pic earlier and only the variable in the green area are used) in the conditional branches it call for an common event called {RW}::region_id.handler. In this common event it set a condition were in each region what region id it should update to based on the possible map segment direction (north, south etc...) based on this (I did account the part where i mess up with the counting) , after the region id is determined it call for the common event {RW}::Ennemies_handler. In {RW}::Ennemies_handler the ennemie spawn are reset (placed in a unreachable area) and then reloaded using conditional branch based on the region-id. Now testing in the game, going south and north seem to work relatively well, (sometimes they dosen't spawn though?) but east and south are absolutely catastrophic sometime it jump from 5 or -5 region id and then continue to add a region until it reach a region that dosent have a conditional branch as it is not supossed to be ever entered, regardless of the player position. At this point I archived the current game file before trying method 2.

Method 2
This method is way less complex, but still have relatively same result. Instead of having one variable for the region id I now have two (map X and map Y) and the center of the (whole) map is 8 4). The parallel process event in the overworld is exactly the same, but when {RW}::region_id.int is loaded instead of getting hero screen XY it get his actual map position, the conditional branch instead of checking if the screen corners are reached it check for X Y position like this:
Code:
$game_variables[253] == 126 && $game_variables[254] == 91
and then call {RW}::region_id.handler. Now in this one only have 4 conditonal branchs which basicaly do ↓ Y-1 _ ↑ Y+1 _ → X+1 _ ← X-1 with the direction the player is facing and the map region X Y then it call for {RW}::Ennemies_handler. In this one, the only diffence with method 1 is instead having a conditional branch for the single region id variable there is a script call like
Code:
$game_variables[257] == 8 && $game_variables[258] == 2
(the starting area set the region ids variable to 8 1 and 8 2 is the area north of it), then it loads the ennemies. The problem is that even if the game do not load the ennemy at all, but if there is event after like a message box saying test show it indeed show it in the game but nothing spawn (wich use place event) in.

Anyone have any theory on what is wrong for any method? Thanks.

Original thread: https://forums.rpgmakerweb.com/threads/variable-and-or-event-updating-problem.83321/