I would say you need to check the position of the feet (add a point to the object) compared to the floor corner position of the box (add a point), and adjust the Z-order of one of the two objects.
I have a half-baked idea:
Create a group “blocking” and add all objects to that group that might block the view of the player.
Then add a new “Ray Cast” condition like this:
Check collision with “blocking” objects
Starts at X,Y of the player’s feet
Max distance is player’s height
The corresponding action for this Ray Cast should set the player’s Z-Order to match the “blocking” object that the ray cast collided with’s (Z-Order - 1)
Well… it’s just an idea… but I think it could work well.
I have not practiced with groups of objects and instances of the same object. But I get the idea about the “ray cast”. I’ll try to test myself with this.
Thanks for the help.