RESOLVED : Deleting induvidual items from replicator

Hi all,

I need some help deleting individual items from a replicator. I always end up fighting with the replicator trying to get it to do what I want.

Very often I need to delete individual components that are generated from a replicator. Lets say within each replicated item there is a network that determines whether or not that item will delete itself. I have tried the following:

If I call “me.parent().destroy()” from within the item’s network, TD will crash.

If I try to delete the item’s index from the template DAT. The replicator will just delete the last item, not the item at the specified index. Using index or item’s name will not make a difference.

What I usually resort to is the following:

When I want to replicate an item. I set the replicator’s “allowCooking” flag to True. Then to the template DAT I will call “appendRow”. And I set the replicator’s “allowCooking” flag back to False.

When I want to delete an item. I disconnect all inputsConnectors. I remove the item’s index from the template DAT. I rename the item to something like “null_id”. I append the item to a garbage table. Then on each frameEnd inside an execute DAT, I destroy that item.

This works pretty well, but it feels like a hack and it’s annoying to setup. Is there a better way to do this? Or should I just build my own replicator comp?

I have attached a toe file of my technique.

Thanks
replicate.toe (5.37 KB)

Have you explored the callbacks of the replicator comp? I often make dynamic connections inside each replicated piece by using it. Sometimes I iterate through allops rather than newops.

The crash with me.parent().destroy() should be fixed in builds 54020+, which includes the latest experimental. What build are you using? If it is not the latest, can you give it a go?