script stops - because of killing target?
I have a script attached to a static sprite, but for some reason it seems this script stops functioning.
It has a loop in the main procedure that creates an enemy sprite every 2 to 4 seconds, only stopping if either more than 100 scripts are detected via a scripts_used() variable, or if the sprite itself is destroyed by a bomb. There is a wait() inside this loop.
Now for some reason the loop seems to break, and the script stops, but I've got debug lines in place and the only thing that happens that I can see according to the log is
killing target
killing sound cache
Now killing sound cache seems to happen even while the make enemies loop is running, so I doubt that it is this.
Best I can figure out is that these command/functions are called by the engine, the script stops making enemies. The weird thing is the script is still there, because I can still plant a bomb that blows up the static sprite via it's hit procedure, even though it has stopped the create new enemies loop in the main procedure.
I've tried adding a set_callback_random() custom function that is basically a goto command to the start of the make enemies loop, didn't help. Using script_attach(0) or script_attach(1000) didn't do anything.
Any ideas?
======================================
EDIT - okay I think it is the hit procedure that was stopping the main loop, d'oh! If the player or other sprites hit the rock then the main loop stops, so put a goto in there if no bomb being used and it works... generating lots of enemies for some reason, not just waiting between 2 and 4 seconds, which is kinda cool, so going to do more testing.
It has a loop in the main procedure that creates an enemy sprite every 2 to 4 seconds, only stopping if either more than 100 scripts are detected via a scripts_used() variable, or if the sprite itself is destroyed by a bomb. There is a wait() inside this loop.
Now for some reason the loop seems to break, and the script stops, but I've got debug lines in place and the only thing that happens that I can see according to the log is
killing target
killing sound cache
Now killing sound cache seems to happen even while the make enemies loop is running, so I doubt that it is this.
Best I can figure out is that these command/functions are called by the engine, the script stops making enemies. The weird thing is the script is still there, because I can still plant a bomb that blows up the static sprite via it's hit procedure, even though it has stopped the create new enemies loop in the main procedure.
I've tried adding a set_callback_random() custom function that is basically a goto command to the start of the make enemies loop, didn't help. Using script_attach(0) or script_attach(1000) didn't do anything.
Any ideas?
======================================
EDIT - okay I think it is the hit procedure that was stopping the main loop, d'oh! If the player or other sprites hit the rock then the main loop stops, so put a goto in there if no bomb being used and it works... generating lots of enemies for some reason, not just waiting between 2 and 4 seconds, which is kinda cool, so going to do more testing.