How to detect when an object has been broken

(For context, I’m trying to make a tree cutting game)

I have experience with programming in the past, but as I’ve been trying to learn Verse, I found myself stuck behind this seemingly simple problem. Here I have a script, or a device if you will, containing an array of 4 creative_prop items.

image_2023-12-04_155037424

My thought process was that the script would constantly run through the array with a for loop and then place a new tree once it has found an empty element. I have tried lots of things, yet I cannot seem to understand how it works.

This is the current snapshot of my code

The error that the red line gives me:

This variable expects to be initialized with a value of type ?creative_prop, but this initializer is an incompatible value of type ?type(creative_prop, creative_prop)

it have some sort of tree manager, then when the tree is destroyed it can call an event on the manager. this way you dont need to loop over all trees which theoretically could be hundreds.

alternativaly dont destroy the tree at all, just hide it and run some sort of event on it like respawn after x seconds

1 Like

Hi, how would i do the first option? I tried using prop manipulator but it does not detect new trees…

the tree manager could be a blueprint in the level, or maybe even a component on the gamemode for example.

you could then have the tree manager spawn the trees procedurally keeping a ref, or if you want to hand place the trees have them get a ref to the manager and add themselves on beginplay

when the tree is destroyed notify the manager from the saved ref and then handle the logic as you like