Download

Only count trees in a Trace

I need some logic help… I’m trying to count trees :slight_smile:

I can count all the items around the Player. I can get the string for each item. How can I filter the string so I only get entries containing “spruce”?

These trees are a procedurally generated instance; counting Actors doesn’t work.

Ultimately, I want to be able to filter for specific items the user can type in as a string - “spruce”, “stone”, “house” etc.

I see you have ‘contains’ there, what’s wrong with that?

That’s the bit I was stuck on - you can get a True / False result if a scanned item contains “spruce” in its name string… but how do you count how many times that is True or False?

I was looking to do something like this: “IF string contains “spruce” THEN +1 to Total” But once I’d gotten the True / False result I couldn’t figure how to count it…

I’ve managed to get around it with help from Loraash on Reddit which lets me apply a filter using custom collision.

If you know how to do this with the Boolean output from the contains node though I’d appreciate knowing how :slight_smile: could be useful for other projects!

I can count ‘cubes’, for instance, like this: