I think you could just try adding this to Sumo's solution:

Flag 0 is ON:
+(limit condition) only one action when event loops
Soldier movement start

Flag 0 is OFF:
+(limit condition) only one action when event loops
Soldier movement stop


I guess the soldier doesn't stop at frame borders because it gets constantly "started" while its status is ON

(but switching constantly while he collides could cause the bug as well, then you may want apply additional code for extra safety)