Help with "Repeat for each instance"

Hello everyone!

I wanted to create an object when the condition where all lines are drawn from an object to another object is performed.

In my code here, a line is drawn from CentrosomeLeft to BlueChromRight by pressing the BlueChromRight. I have 4 BlueChromRights.

I want it so that when all is attached a variable changes it’s value. And, depending on that value an object is created on the scene.

For example: When all lines are attached then a boolean variable is set to true, when false delete the created object.

Idk if I’m making sense hahahaa

To check if all of the objects are linked, you can use 2 approaches.

You can use the conditions that count the objects.

Linked = true
The number of picked objects = the number of objects in the scene (I believe it says living)

The other option is the NOT condition .

NOT Linked = false

Normally, if there weren’t any objects set to false then checking if it equals false wouldn’t trigger the actions but if you NOT the condition then it inverts the result.

If there were objects set to false
NOT Linked = false would normally return true but the NOT inverts it and makes it false so nothing gets triggered.

If there wasn’t any objects set to false then normally nothing would get triggered but the NOT inverts the result and triggers any actions.

The difference between inverting a condition and inverting the result is subtle and can be confusing. Counting the number of objects would probably be more straightforward .

1 Like

Thank you @Keith_1357 I will try this :smiling_face:

1 Like

I’m not sure how to do this

This is an example of both methods using Nodes as the target object. I used “angle” just for testing.

The first event would need the pick all because it’s not picking any objects because there’s nothing to pick. Meaning none of the object variables equals false. It only triggers the actions because of the NOT condition.

My test project

The NOT is under other conditions.
image

Thank you so much @Keith_1357 this worked! :tada:

1 Like

It worked for a moment. :sob: I don’t know what happened, I must’ve misplaced something @Keith_1357

now my line won’t draw

Check all of your variables and objects.

Note:. The placement of the trigger once will only check the variable when the location changes. So, if it triggers the first time because of the location of the object and the variable is false then it won’t trigger the actions. Later, if the variable changes to true nothing will happen because the trigger once is only using the x, y of that object as a method to decide whether to trigger again. The object would have to move away and then back again to trigger a second time.

Otherwise, I’m not seeing anything.