In my opinion, using an if statement is the most correct and logical approach. However, you could also set a trigger to call the first function and, within that function, reassign it to the second.
How can I correctly write this in Lua? Could you provide a small example?
And here's another issue. Why does a map with a dialogue scene work normally the first time, but when the map is launched again, the game crashes when the dialogue starts playing. If you remove the script that starts the dialogue, everything works fine. I don't know what to do.