Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I know I have some talking code in WTDL and other VNs. I actually have that as a mostly separate system, using a dynamic displayable for the mouth/face/whatever-controls-talking layer that listens for a is_talking variable. Then in the callback have

def name_callback(event, interact=True, name=None, no_talk=False, **kwargs):
        global speaking_char, is_talking
        if event in ["begin","show"]:
            if name != "":
                speaking_char = name # Update speaking_char to bring sprite forward
                if not no_talk and preferences.text_cps != 0:
                    is_talking = name
        elif event in ["slow_done"]:
            is_talking = False

Then another function for the dynamic displayable to use

def mouth_talker(st, at, name, mouth_name, mouthtalk_name):
        global is_talking
        if is_talking is not False and name in is_talking:
            return (mouthtalk_name, .1)
        return (mouth_name, .1)

Little function to make the actual layer definition easier.

def mouth_direct(closed_mouth, open_mouth, name):
        return DynamicDisplayable(mouth_talker, name, closed_mouth, open_mouth)

Then in the actual sprite it's something like

layeredimage mychar:
    always 'mychar_body'
    group mouth:
        attribute neutral mouth_direct('mychar_mouth_neutral', 'mychar_mouthtalk_neutral', 'mychar')
        # etc. etc.

And that should do it. Obviously still need to define your Character with the callback but this setup works alongside the autohighlight, so just use it how you would normally.