How do I Get NPCs to chitchat back and forth?

0 favourites
  • 8 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Without seeing your events and/or capx we could only guess..

  • How do I upload a capx file?

  • 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?

  • 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?

  • I'd do something like this:

    ChitChat,capx

  • Wow, thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)