Trying to delete a simset causes T2D to crash
by Philip Mansfield · in Torque Game Builder · 01/10/2006 (5:10 am) · 2 replies
I'm having an intermittant problem trying to delete a simset in my game.
I create an animated sprite object, fill in its details, and then add it to the simset. I loop through this procedure several times to create a simset containing my enemy objects.
Then, when I leave the game to return to the menu, I want to delete all the items so I can start the next game with a clean enemy simset. The code I'm using to do this is:
I don't know if I'm queing up too many safedelete operations - there can be upto 40 items in the simset when I iterate through it. Should I add a schedule to the WaveSet.delete call in order to delay it for the safedelete to take effect?
Or there is a different way I should be doing this?
I create an animated sprite object, fill in its details, and then add it to the simset. I loop through this procedure several times to create a simset containing my enemy objects.
Then, when I leave the game to return to the menu, I want to delete all the items so I can start the next game with a clean enemy simset. The code I'm using to do this is:
if (isObject(WaveSet))
{
for (%i=0; %i<WaveSet.getCount(); %i++)
{
%obj = WaveSet.getObject(%i);
%obj.safeDelete();
}
WaveSet.delete();
}To my understanding, this should loop through the simset, grab each item, queue it for a safedelete and then delete the simset. However from time to time T2D will crash with a 'T2D has encountered a problem and needs to close' message generated by Windows.I don't know if I'm queing up too many safedelete operations - there can be upto 40 items in the simset when I iterate through it. Should I add a schedule to the WaveSet.delete call in order to delay it for the safedelete to take effect?
Or there is a different way I should be doing this?
Employee Melv May
- Melv.