Sokoban Puzzle

I just copied the holes and the boxes (along with the characters/!Chest image), but it doesn't work for me. Could that be clashing with some plugins in the project I'm making?

To explain my issue further, the box goes into the hole, fills it up, no problem. The player stepping on it is under the texture though, and when I move another box over it, it's getting filled up again even though it's already full. It works fine in utunnels' demo, which is awesome, but there's probably something I'm missing.
It sounds like the hole is not erased properly. Have you copied the move route of page 2?
It sounds like the hole is not erased properly. Have you copied the move route of page 2?
Yes, the custom move route is
if(foundAHole){foundAHole.erase();this.setPriorityType(0);}
Maybe it has something to do with move frequency. What if you change it to highest?
Maybe the code is delayed when another chest is pushed.
Maybe it has something to do with move frequency. What if you change it to highest?
Maybe the code is delayed when another chest is pushed.

I have attached a zip file containing the images of the settings and a video showcasing what happens.
From your video it seems at least it actives page 2. But for some reason the route doesn't work.
Are the chest events all identical?
From your video it seems at least it actives page 2. But for some reason the route doesn't work.
Are the chest events all identical?
All copy+pasted from your demo, so they should be. I checked at least 5 times by now, if all the options were identical :/
Odd. It is unlikely a plugin can affect move route. Do you have any button common event?
Maybe you can upload a small demo somewhere for me to check?
Oh my god, I'm having a headache. I did a little test, copied the map where the events are, and it works in a new project. I'll get back to this thread later in the evening, I have to run to work. I'll try to think about it a bit more in depth too, what could be affecting it.

Thank you so far.
No problem, just take your time. 🙂
No problem, just take your time. 🙂
Finally found the issue on my notebook. The problem is with the plugin YEP_CoreEngine, as it does change Event Movement speed, queue, and event collisions. But I use a lot of YEP_ plugins... Is there a fix for this?
Yeah, I don't use YEP but maybe it can be fixed by removing page 2 and move all code to page 1.

Just change the last line of script to this:
JavaScript:
if(foundAHole){foundAHole.erase();this.setDirectionFix(false);this.setDirection(4);this.setDirectionFix(true);this.setPriorityType(0);}
Its logic is simple:erase the hole, change the box's direction to left, and change its priority to below the player.

1721576027555.png
Yeah, I don't use YEP but maybe it can be fixed by removing page 2 and move all code to page 1.

Just change the last line of script to this:
JavaScript:
if(foundAHole){foundAHole.erase();this.setDirectionFix(false);this.setDirection(4);this.setDirectionFix(true);this.setPriorityType(0);}
Its logic is simple:erase the hole, change the box's direction to left, and change its priority to below the player.

View attachment 312086
This approach finally works. I have one more question for the checking, as ShadowDragon pointed out, what do I do with the +=1 variable and checking if they equal 8 (all spots filled out)? How do I implement it in this event?
You need to use a variable, if "foundAHole", add 1 to the variable. Then check if the variable equals to 8.
You need to use a variable, if "foundAHole", add 1 to the variable. Then check if the variable equals to 8.
1721608213030.png



Got this error when I did this:

1721608254281.png
Hmm, don't remove original script.
1721608938736.png
Here is a demo. I also changed some lines so the picture can actually be used.
I also use a fixed route on page 2 to erase the hole.
It seems there's a 1 frame delay when change a self switch, so if you erase the hole and change the chest's self switch at the same time, the image disappear for 1 frame. So I let page 2 do the erase job in its route.
View attachment 312033
This was actually much more practical than just with events, but I didn't understand why there are two "foundHelo" checks, one for each page, the hole event takes almost 2 seconds to disappear...
To resolve this, I removed the SCRIPT from the movement on the second page and just included it at the end of the call within the event and the hole is instantly erased when changing the Local Switch:
JavaScript:
if(foundAHole){$gameSelfSwitches.setValue([$gameMap.mapId(),this.eventId(),'A'],true);foundAHole.erase()}

This way it is not necessary to start the event with priority at the same level, so it is not necessary for the scripts to be executed every time the player returns to this map.
1721609927060.png
@Dev_With_Coffee Yeah, if he needs to return to the map. But if so, the position of the chest need to be memorized, and there may be other cleaning up job to do.
If it is a one-time puzzle, it is much simpler.
Anyway, I have changed the code as mentioned above. Page 2 is no longer necessary.
It is a one-time puzzle for now, but I might return to it later in the game.

Also, @Dev_With_Coffee, may I ask for the dark theme of RPG Maker MV? It's really burning my eyes over at my huge work monitor. Thank you for your prompt response!
@utunnels
In this case, wouldn't it be better to leave page 2 of the "Box" event without a graphic and instead of deleting the hole event, create a new page also activated by Switch where the graphic is the hole with the box?

@feelNice
Tools -> Options -> UI -> Theme -> Select Dark

Original thread: https://forums.rpgmakerweb.com/threads/sokoban-puzzle.167767/