Page 1 of 1

Show stats of the current character talking

Posted: Tue Aug 31, 2021 10:54 am
by HydraHenker
Ok, so this is what I want to achieve:
I want to show some stats of all the characters that speak to the MC in the current scene.

This is how I did it:
I defined the Sprite and side images with LiveComposite and DynamicDisplayable

Code: Select all

    image Alice Normal = LiveComposite(
                                (692, 1080),
                                (0, 0), "Characters/Alice/[ali.state]_Alice_Normal.png",
                                (1150, 100), DynamicDisplayable(composite_char_attr_show_new, name="Alice"),
                                )
The side image

Code: Select all

    image side Alice Normal = LiveComposite(
                                (300, 300),
                                (0, 0), "Characters/Alice/Side/[ali.state]_Alice_Side_Normal.png",
                                (1150, 100), DynamicDisplayable(composite_char_attr_show_new, name="Alice"),
                                )
And an image that shows the face of the character plus 4 stats in like a flower thingy.

Code: Select all

    image Alice_Stats = LiveComposite(
                                (128, 995),
                                (0, 0), "gui/icons/50/Cloud2.png",
                                (40, 40), "gui/icons/50/Alice.png",
                                (20, 26), DynamicDisplayable(composite_char_attr_level, char="ali", attr="stat1", attrlvl="stat1_level") ,
                                (73, 26), DynamicDisplayable(composite_char_attr_level, char="ali", attr="stat2", attrlvl="stat2_level"),
                                (20, 69), DynamicDisplayable(composite_char_attr_level, char="ali", attr="stat3", attrlvl="stat3_level"),
                                (73, 69), DynamicDisplayable(composite_char_attr_level, char="ali", attr="stat4", attrlvl="stat4_level"),
                                )
This is the function that determines to show or not to show the flower:

Code: Select all


    def composite_char_attr_show_new(st,at,name):
        current_tag = renpy.get_say_image_tag()
            if name ==current_tag:
                show_stat_flower(name)

        return Null(), None

In summary:
I check the if renpy.get_say_image_tag() is equal to the character and if it is, I show the flower with stats
And this works... kind of...

The problem is:
I have scenes that are the same scene but you can visit them with one or two characters
So one character is there and there is a conditional for the other character to be or not be there.
And here is when the problem comes, the is something that seems to be reading ahead of the lines in renpy (maybe some cache?) that ignores all conditionals and triggers the  DynamicDisplayable with renpy.get_say_image_tag(). So now I have two stat flowers showing when there is only one character on the current scene.

Example:
Image


My question:
What's the correct way to do this?

Thanks,
Cheers!