Eufloria > Eufloria Classic Support
[Lua] Crash calling RemoveSeedlings(int, int)
(1/1)
elideb:
When calling Asteroid:RemoveSeedlings (int faction, int number), the most frequent result is a game crash. If the command is invoked from console, the crash does not happen, and the output is:
"Index was out of range. Must be non-negative and less than the size of the collection."
The error does not happen if the number of seedlings to remove is 0 or there are 0 seedlings of the faction in the asteroid.
The attachment is a small test level. Move the RemoveSeedlings calls around to check different results.
Mihhaelo:
I've had this issue before and I came to the conclusion that destroying seedlings is not instantaneous. I.E, a seedling in the process of being destroyed still counts as a seedling. Sometimes you're code will try and delete the same seedling twice and that's what causes the crash. Adding a time delay between subsequent removes fixes this (iirc).
Navigation
[0] Message Index
Go to full version