Basically, it's not quite right:
I didn't use a trigger; instead, I ran the 'lost_PL_4' function in a separate thread, starting from the moment the task to kill PLAYER_4 was given, with an interval of 5 sleeps. I did it so that the check would also run during the opponent's turn.
I replaced "~1" with "2," but nothing still happens. Then I did this: when one city is captured, it checks if the second city is also captured. Now, when two cities are captured, the game crashes :D. I also don't understand that quest... I guess I'll have to redo it.