Manipulating instance variables [Solved]

Hello. Is it possible to change specific instance variables during runtime? My AI is working, but it has a hivemind. I would like to only change the variable of the instance that triggered the change.

Yes, via object selection. Each time you use a condition (does not apply to expressions!) that uses an object, only the instances for which the condition is true will be picked. Actions that use that object will then only affect the picked instances, meaning only the ones for which the condition was true. For example, if I use the mouse over object condition (which has an object as parameter as you can see in the sentence in the event sheet), and an action that set the variable “a” of that object to 1, each time I will hover over an instance of the object it will set only for that instance the variable to 1.

I’ve been looking at the raycast in the “Basic ai with pathfinding” example, but when I implement it in my own project it always changes the variable of every instance.

The filtered or selected instances only apply for the event of the condition (and any subevent of that event).

This will change the damage variable of the StoneBlock instance that was in the path of the raycast:

As will this:

But this one will update all StoneBlock instances in the scene, because the action is not on the filtered group of StoneBlock instances:

Taking a break always works, after looking at the “Basic ai with pathfinding” example again I immediately saw what was the problem. You use the “For each object”-event instead of just a regular one.