Instances conditions/actions interfering with each other

Dear community,

Stuck is what I am. Nothing new. Humbly requesting your help once more.

Short version :
Doesn’t matter how many variables I try to add, the actions I try to limit to one (random) instance always end up affecting all the instances of the same object.

The current ‘best’ version:


Current aim:

  • NPC wandering around.

Things I have:

  • One object, multiple instances.

What I tried (amongst others):

  • Used many types of variables, identifying instances, if they’re moving or not, giving them dynamic “IDs” I could fetch as condition, etc.

For example : tried this: Give a random ID to each instance, check, use that unique number to limit the impact of the sub-events, put in subevents the actions of movements. Doesn’t matter, the rest of the instances were impacted, no matter how limiting I tried to be.

  • Also tried to use Pick all, Pick random, Number of currently picked instances. Nothing worked for me, the way I did it.

Problem i keeping banging my head on:

  • Doesn’t matter how many variables I use, speed, instance “ID”, unless I put in condition : obj1, obj 2 and manually identify/separate them, some of the actions will impact the rest of the instances of the same object.

What i’d love:

  • Run a series of actions (Go to point A, then B after A) for each and all of the instances, without having the status of one affecting the others.

Side note: added some text for the variable Standby for each instance, see what happens. I believe that could be a cool extension to make, btw, a way to display variables in a few clicks instead of manually linking them to text obj. You know what would make me feel like a fool? If that existed and I didn’t know.

Can’t thank you enough for your help so far, apologies for still requesting it.


Forgot to mention, I also tried to “register” each custom (from random number) “ID” I’d give to each instance, under an array variable.

I thought: If I list these little instances, maybe It would be easier to restrain the conditions and actions below.

But I do believe it would end up the same way for me, I’d end up using : check if child exists, well duh it does, so all instances are in the same boat once more.

I also tried to do this : Make a random number > Register it as object ID variable > Then use conditions and actions adding 1 to this Object.ID, but It would work for all the instances, once more.

Just thought I’d mention the more ‘dynamic’ approaches I tried and forgot to add above.

Does it affect them so they all move to the same X position? You have to remember that the events are run about 60 times a second, so if you only have a couple of Allens on the screen, it will appear like they’re all moving at the same time, when the reality is they got moved but with a few tenths of seconds delays.

That “wait” action won’t slow it down either - it just adds a delay to when the action kicks off.

You may want to look at this recent post that moves enemies randomly with the occasional pause. It may help with what you’re after.


Also, an additional reminder: you cannot use “trigger once” on a “for each” special event. It will only trigger for the first instance.

You should instead just add the variable to your allen object itself and set it to 0, so they all start as 0 upon creation.

1 Like

Hello @MrMen @Silver-Streak.

As usual, many gigantic thanks for taking the time to help.

EDIT: My friend actually told me (we didn’t discuss anything before now, he just sent me this in the dead of the night) that he actually didn’t write this code but found it. So someone else gets the credit, he just gets a hug. Thought I’d rectify this.

Buddy of mine who also just started using GD but clearly knows better than I do (sad lol) actually helped me there by putting timers instead of trying to use variables based on movement progression and… it works. Probably took him 5min. I’m gutted haha.

I’ll definitely take a look at what @MagicBiscuit, seems like timers are also in great use there. Many thanks to you Magical Cookie person I don’t yet know for taking the time to share your knowledge and well crafted code with strangers in a tutorial, you sir are why GD is beautiful.

What my buddy sent me:

Clearly some people have a better mind for code than others lol (i’m in the other group, in case that hasn’t been obvious so far.)

Again, my deepest gratitude to all of you.

1 Like

Appreciate the additional info, Silver. I’m pretty sure you would have several heart attacks if you saw the rest of my ‘code’ haha.