OOOR, you could simply make a script resetting the flags on certain points so you can re-use them... What about storing the flags 90-99 to do this:
Lets say you have many sections, we will call them A,B,C,D and E, I know, lame names, I feel lazy.
You want X events to activate on section A when you replay it, and Y events on B, etc.
Simple: after you end stage A, there is a script that enables one of the flags between 90-99 and disables every single other flag below the ones choosen as chapter resets. 95-99 will do it in our example
If you go back to A, a script activated by flag 95 will re-activate every relevant flag to the section A.
If you go to B, similarly, the flags for a replay will be set on at the start by a script related to flag 96. Again, leaving will trigger a script that will disable every flag and enable 96.
This way you can have a practically unlimited amount of flag-related scripts. And if you somehow run out of space, use a binary-like code with the flags so you have 2^N resets, N being the number of flags you save for the resetting script.