What is the best way to code two sprites having a chat?

0 favourites
  • 3 posts
From the Asset Store
Chat with smart animals using the OpenAi Chat GPT 3 API
  • I have two little people sprites. Those sprites can walk around, and whatever and once in awhile they will randomly have the urge to chat with another sprite. I am curious about everyones opinion on the best way to go about this would be?

    The way I thought of doing it was using Wait Signals. So when the event starts the first sprite says whatever, then sends a signal for the second sprite to say whatever, back and forth back and forth until it ends. That will work just fine and dandy, but I want it to be more interactive. If sprite #1 says something like "Hugs", and sprite #2 is in a bad mood maybe it responds in a negative way like "I don't want hugs right now." I do have a mood variable that ranges from 1-100, but how in the process of the conversation logic can the sprite check its mood variable, and respond correctly to what the other sprite has said?

    Anyone have any ideas, or maybe a point in the right direction on how i can implement something like that?

  • Here is a thought. Would it just be different "Signals" Being sent. So if Sprite #1 says "Hugs" , Hugs is the signal "HugsSignal" which then goes to a Family event that is waiting for that specific signal, and can do a check like IF Variable Mood > 50, send positive response like "I Love Hugs!", IF Variable Mood < 50, send negative response like "I don't like hugs".?

    Would this be way to much work and there is a much simpler way to do it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That seems like a good place to start. You have to track the entire possible conversation tree (like an AI options tree), and send signals (or flip flags) like you are thinking.

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