You have to improve the AI.
One thing you can do is add an invisible colider that always has its position set to an image point in front of the NPC. (This can be done by making a new sprite just fill in the square with any color and then hit okay. Set the viability to invisible).
Next go to your NPC and add another Image point and set it a bit infront of the direction that the NPC is facing.
In your code say;
--Everytick // "WhateverYouNamedCollider" | Set position to "TheNPCYouAreFixing" (Image point 1)
Now you just need to program the colider to check if it is overlapping something else that the NPC shouldn't and then tell the NPC to turn a different direction.
Another alternative is to have the solid object cause the NPC's x or y position to change based on its location to the solid object.
For example :
--IF NPC.x < object.x // Npc.x = npc.x -1
--IF NPC is overlapping Object
--IF NPC.x > object.x // Npc.x = npc.x +1
--IF NPC is overlapping Object