Script going apeshit

When two of the same doors is on the scene, the script dosen’t want to activate. The script works fine with 1 door on the scene, i think that the cause can be that the game can’t tell the difference bwtween the objects, it gets confused and stops working.

Can someone help?

I thought of making door clones, and copy and paste the script. But it’s not performance friendly.

I had another idea, but it didn’t work because of a event limitation.
Door distance to Player is below 40 pixels.
I wanted to change it into Door>=(Number) distance to Player is below 40 pixels. Or did i miss something, i’m tired give me a break :open_mouth: xD.

EDIT: Video showing the problem itself: youtube.com/watch?v=XaTS0rP6EMQ

Use object variable or when door is in collision with the player

Collision with player gets the same result with annoying it dosent work if 1pixel is off.

And i don’t know how to make the variable tell the difference <.<

Bump - Anyone?

Hum “for each” event ? Show what you are trying to do

The most obvious way to solve such problem with multiple instances is the “for each” event as Kink suggested as it go through every single instances one by one and trigger the events for each individually.

But you can also consider the object linking extension and try something like:
if the player distance from any door is <= something then link the door to the player then take in to account any door linked to the player and interact with it…
It might just work as you looking for the closest door and link it to the player so it might just pick the right instance for you but if it not, the “for each” event should definitely solve the problem.

In theory you might be able to use object variables similar to object linking extension if you prefer that way… Let say, for each instance you could create an object variable and set the default value to 0 and after look for the closest door to the player and set it variable to 1 then look for any door that has the variable with the value of 1 and it might just pick the door you want…

Obviously, after using a door you need to drop the link and set the variable back to 0 so at the next door you don’t pick multiple doors or a wrong one…

But again it may or may not work, it is something that need to experiment with.
Some of the events do pick the proper instances while others don’t but why and when is something that I never been able to figure out for certain. “for each” event always solve this kind of problems with instances but it can be resource hungry depends on how many instances need to go through and what conditions need to be checked for each instance and what actions executed, so need to be careful with it.

God damn it, i can’t get it to work. The only thing i know that works, is taxing on the performance ;( Plzz devs, make this easier for us.