I get an error message about illegal wait substate
From OHRRPGCE-Wiki
This error message probably indicates a bug in either the plotscript compiler or in the game player. This error is not caused by a mistake you made in your script.
You should report it in bugzilla. If possible, try to reduce your script to the smallest possible script that still produces the error message.