You could use a for each child. This would add all of the children.
Variables.
Events
Result
I added the items to a text object just to demonstrate the process.
That would be the basic setup. A more automatic setup would use a structure of structures.
Like
Items
–gems (as children of items)
------list of gems and quantities as children of gems
–wood
------list of wood
You could use nested for each child events to go through the entire list and create another structure with the totals or each catagory could have a child named total among the other items.
So it could be
.
Items.Wood.Total
Items.Wood.Ash
Items.Wood.Spruce
Items.Gems.Total
Items.Gems.Ruby
Items.Gems.Diamonds
The first for each child. Would get the children names of each Item and the nested For Each child would get the counts of each child.
I don’t have the time right now to create another example of that.
There might be a simpler way. Maybe using functions within the array tools extension.
If this is what you’re looking for, I can try to create an example later. It might sound tougher than it is. It would organize everything into 1 structure. It won’t require a lot of events. Just planning.
Edit: this would use nested for each child events. Note the events don’t use the same variables. I added Category to the first one to hold the child name.
I realize that you might only be interest in whether there’s a particular gem not the total. Meaning there’s 3 types of gems not a total of say 30 gems. This is just to showcase a method.
Variables. Click to open.
Events
Result
These are all the same
Set Category variable to “Wood”
Items[Category].Total
Items[“Wood”].Total
Items.Wood.Total
To just count how many unique items of each type then you could use the following.
This just has a slight change. Instead of adding the number of each item, it adds 1 to the total if the number isn’t zero. I think that better reflects your need.
Edit: I realize I had a at the beginning event. That’s a habit. In this example that’s not needed.