You need to check if you have 4 pieces in a row in array.
For each array element check if it has neighbor at X = +1 and -1 , and y = +1 and -1.
if there is neighbor in some direction just count how many pieces you have in that direction.
To make everything easier:
-every time you move one piece, populate array that has false/true for each grid space. To do so get all actors from class (of your piece) get their locations, divide by 100 and place in 2d array.
you cannot make 2d arrays in unreal, so you need to use onedimensional and create functions to set and read cell and x,y index.
- when you have populated array just check each cell in array if its filled, then try 3 neighbors in each direction
Doing it all above on vectors may be easier or more messy depends on implementation.
You could create function that checks if there is neighbor at 100 units distance. For it use trace line at +100,0,100 down to +100,0,-100 (or so) and checks if it hits object that has class same as piece of puzzles.
If you find neighbor there you call another function that asks neighbor to check its neighbor in this same direction and increase some counter. Then return to sender. So you know number of pieces in that direction.
So either you battle arrays or blueprint to blueprint communication.