Script that works on any but the same object

Hi. This is my first post.

The effect I want to get:
For each “tree”, I want to increase
bar. For example, from 0 to 100.

The problem is that the script only works on one “tree” object. And not on the second one.
Maybe i need to assign each bar somehow.

Anyone know how to resolve it?

I think you need to link two objects when you create the interaction_Tree so then you can. refer to interaction_Tree linked to the Tree in your foreach

If I understand you correctly, without effect;/

No I mean you can have 30 trees but 1 interaction_Tree so to which tree is that interaction_Tree linked? if you do a link to when you create the interaction_Tree later in the foreach Tree you can associate the
(Tree and interaction_Tree) and act in kind.

2 Likes

the problem is your condition is in collusion.
PC_citizen is likely in collusion with only 1 tree, so therefore only that tree is affected.
There is a condition or action “pick all objects” that you can use to pick … well, all objects :slight_smile:

Edit:
is your Interaction_Tree object the “bar” for your trees? if yes, you should put the condition citizen is not in collusion with tree inside the for each loop, to check each collusion individually, and then, as UlisesFreitas suggested link each bar to the tree and use the condition “take into account linked objects” or you give each tree and bar an object variable (call it id) number and use the condition if id of tree = bar.variable(id)

2 Likes

Omg. Thank you.
my english is not very great
I needed some time to myself
translate it in depth and make it real xD

I didn’t know about this condition

I added “pick all objects” and deleted for each object.


and it worked perfectly. Thank you @Slash @UlisesFreitas