Activating Different Door Clones

You must understand the Game Editor concepts, before post here.

Activating Different Door Clones

Postby DrakeStoel » Wed Jun 01, 2016 3:57 am

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!
DrakeStoel
 
Posts: 43
Joined: Wed Oct 03, 2012 8:53 am
Score: 2 Give a positive score

Re: Activating Different Door Clones

Postby lcl » Thu Jun 02, 2016 11:11 am

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! :)
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Activating Different Door Clones

Postby DrakeStoel » Thu Jun 02, 2016 10:52 pm

Bah dah dah daaaaaah! (Attempted Legend of Zelda sound effects)

That worked poifectly! Many thanks! :mrgreen:
DrakeStoel
 
Posts: 43
Joined: Wed Oct 03, 2012 8:53 am
Score: 2 Give a positive score

Re: Activating Different Door Clones

Postby lcl » Fri Jun 03, 2016 11:59 am

DrakeStoel wrote:Bah dah dah daaaaaah! (Attempted Legend of Zelda sound effects)

That worked poifectly! Many thanks! :mrgreen:

Haha :lol: You're welcome! :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron