The for loop optimization added in #86 sometimes generates code that causes an infinite loop.
Disabling the optimization results in the script working correctly, when using nwn_script_comp you can pass the -O 0 flag to disable the optimization
Test script: testscript.txt