Setting servo output value when batt failsafe is activated

Hello all.
Is there anyway to set servo output value when fs is triggered? For example setting servo to certain pwm when Rtl fs is triggered.
This would be extremely useful in our sprayer programme as we can set to turn off the sprayer when fs is activated or turn on red led when bat fs is activated and green led once fs is cleared.

Probably can be done with lua script.


@Corrado_Steri thanks we will give that a try.