[Solved] Multiple entity AI not working

Greetings, I’m testing out the 3D tools and encountered an issue

So, I have a spinning apple cat, which stands idle for 1 second, but then enters it’s “spin” state, where it’ll start spinning and bounce around the room

Here, I want this to apply to multiple apple cats, waiting 1 second before spinning, but only the first instance of apple cats spins. The rest of them just stand there (The debugger says they’re in their spin state, but they aren’t doing anything. Additionally, the debugger only has a timer for the first apple cat, the rest of them don’t even have a timer for some reason)

I tried many things like adding for each, removing trigger onces, rearranging code, but it either broke the AI or did nothing…


Only the first apple cat spawned behaves normally, the others just stand there…

Does anybody know how I can make EVERY apple cat behave like they’re supposed to?

This event will only happen once, and once only. Not once for every cat. Once ever:


You want to duplicate this condition into 2 events:

The first one have the trigger once action on it, and the actions that are on the current trigger once event.

The second event has all the timer “animChange” and subevents.


Also, I suspect this event is kicked off around 60 times (if your game is 60 FPS), until state of applecat is set to “spin”. Not sure if that’s healthy. Maybe use an intermediate state:


Alright, I updated it. I also added a Trigger Once to the “idle” event

However, it just throws back the same result. The actions to move the apple cat is still only being called once. Did I order them incorrectly?

The order doesn’t matter. I think it’s the trigger once within the Repeat for each object loop that behave differently to how we think it should.

The way I would fix it would be:

  1. to introduce 2 more states - “prespin” and “firstspin”.
  2. remove the both of the Trigger once
  3. in the idle event, set the state to “prespin”, and use a timer instead of a wait.
  4. add an event with condition `state = “prespin” and timer >1, and action to set state to “firstspin”
  5. change the state in event below to “firstspin”, and add an action to set state to “spin”
1 Like

Nice, thanks, it works just fine now, and I understand what I was doing wrong too. Turns out I didn’t even need the For Each group either
Thanks again