How do I Get NPCs to chitchat back and forth?

Just started using Construct 2? Post your questions here

Post » Sun Jan 03, 2016 3:44 pm

Okay. I'd like to have some background characters chitchat back and forth. This isn't the only animation that they do, so I'd like to create a function that:
1)Stops their Platform Behavior, so that they stand still
2)Switches their default "Walk" animation to the "Stand Still" animation
3)Character A plays "Talk" animation for 4 seconds while Character B plays animation "Listen" for 4 seconds
4)Then switch to Character A plays "Listen" animation for 4 seconds while Character B plays "Talk" animation.
5)Repeat.

All my NPCs are in a Family called "Extras", so I'll be coding this function for the whole Family.

I've created the following Instance Variables for the Family:
Chatting (true/false)
ChitChat (1-Listen, 2-Talk)
FacingDirection (1-Not Mirrored, 2-Mirrored)

The Problem is that on Layer Start, the NPCs that have Chatting(true) continue their walking animation, do not play the chatting animation, and are never mirrored when I set them to be. I did, however, manage to get them to hold their position instead of moving around the screen like those who have Chatting(false).

Can anyone help? Possibly using a Timer behavior in there somewhere? Please remember that I'm brand-new to coding and Construct 2!
B
7
Posts: 51
Reputation: 379

Post » Sun Jan 03, 2016 4:17 pm

Without seeing your events and/or capx we could only guess..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jan 04, 2016 3:35 am

How do I upload a capx file?
B
7
Posts: 51
Reputation: 379

Post » Mon Jan 04, 2016 3:43 am

B
7
Posts: 51
Reputation: 379

Post » Mon Jan 04, 2016 1:02 pm

First thing I see is you aren't referencing any instance of the extras family in the event that calls the function..
Secondly I don't understand wha\t the timers are supposed to do here..
Timer listening is called to start when listening, but on timer end you set the animation to listening?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jan 04, 2016 2:20 pm

Let me stress that I have no clue what I'm doing.
I put the timers there thinking that it would play "Listening" animation for 4 seconds, and then play the animation "Talking" for 4 seconds, and back and forth. Then I added a timer for these behaviors in reverse so I could "stagger" the conversation and control which NPC begins talking first. It was a shot in the dark. I don't know how timers work, apparently.

So, how would you set your events sheet up if you wanted to tackle this?
B
7
Posts: 51
Reputation: 379

Post » Mon Jan 04, 2016 4:33 pm

I'd do something like this:

ChitChat,capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jan 04, 2016 7:26 pm

Wow, thanks!
B
7
Posts: 51
Reputation: 379


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests