Page 1 of 1

Activating Different Door Clones

PostPosted: Wed Jun 01, 2016 3:57 am
by DrakeStoel
I've been working on a door script, and it works fine... Right up until I clone it.

It's a very specific type of door progression. First, when the player has a key (taken care of with an integer), it opens on when the player touches it. This collision event triggers an opening animation, and when that animation finishes, the door destroys itself.

I have all that working fine. The problem is that when I walk into the door with my player, ALL of the clones carry out these actions. I guess my question is how can I make the individual clones carry out those actions without making a bunch of different door actors?

Thanks in advance!

Re: Activating Different Door Clones

PostPosted: Thu Jun 02, 2016 11:11 am
by lcl
Hello!

Your problem is that your code is not clone specific. If you call ChangeAnimation or DestroyActor with an actor name, those functions will perform the actions on all clones of that actor.

Depending on how you've built your set up, you should instead use "Event Actor" or "Collide Actor".

If the collision event between the door and the player is the player actor's event, then you should call the ChangeAnimation function with "Collide Actor", which means the actor that the current actor (player) is colliding with in this specific event (the correct door clone). But if the collision event is an event of the door actor, then you should call the ChangeAnimation with "Event Actor", which means the current actor.

And for the DestroyActor in the animation finish event you should also use "Event Actor", so it will only destroy the actor whose animation has finished, not all door actors. :D

I hope this clears it up! But I'll be happy to explain it in more detail if that is needed, don't be afraid to ask! :)

Re: Activating Different Door Clones

PostPosted: Thu Jun 02, 2016 10:52 pm
by DrakeStoel
Bah dah dah daaaaaah! (Attempted Legend of Zelda sound effects)

That worked poifectly! Many thanks! :mrgreen:

Re: Activating Different Door Clones

PostPosted: Fri Jun 03, 2016 11:59 am
by lcl
DrakeStoel wrote:Bah dah dah daaaaaah! (Attempted Legend of Zelda sound effects)

That worked poifectly! Many thanks! :mrgreen:

Haha :lol: You're welcome! :D