
I'm building a turn of the century interurban/streetcar route, and i felt the need to make driving on the route more challenging by minimizing the amount of visual signals for the player to see.
at a certain part of the route the mainline, and the interurban interchanges at a diamond crossover. I felt that having a flagman serve as a visual warning device for the interurban would be a far more immersive way to signify that i need to stop, and wait for a mainline train to pass.
so after 5 days of trial, and error i managed to make a working asset that has 2 animations. one for standing still "open", and one for waving the flag "warn"

However when it comes down to the scripting part i am truly stumped. Mostly because I never worked on the LUA code format before. I'm using the Woodhead Levelcrossing script as a base, but i'm still struggling to make it work even after i dabbled in the code a tiny bit.
however what i basically want to do is this. I have 2 animations i want to loop "open", and "warn". I want the open animation to loop while the level crossing is in the open state, and the warn flag animation to loop while the animation is in the Closed state.
If anyone could assist me on this issue it would be great.