Different animation of the character's portrait during lines and dialogue [SOLVED]

  • #1, by red363Monday, 06. December 2021, 23:58 2 years ago
    Greetings!
    I ran into the following problem and still can't solve it:

    I needed to create portraits of characters that appear during lines or dialogue. Moreover, for each character there are several portraits expressing different emotions during remarks.

    To do this, I made a "dialog" interface that starts when the character speaks (there was an instruction on the forum on how to do this). It works well.

    However, since I need the portrait of the characters to change during remarks and dialogs, I created buttons in the same interface, one for each character. And in each button, I created multiple animations for each emotion. I set the animation “default“ by default. The rest of the button animations I turn on manually before each replica (play animation), depending on which one I need at the moment. Next, I need that when one portrait animation is turned on, the other, which was turned on, for example, in the previous remark, is hidden. And I certainly don't want to do it manually. To do this, in each animation in the first frame, I created actions that would hide all animations except this one (hide animation).
    In theory, it seems logical. But in practice, for some reason it works every other time, i.e. somewhere the animation is displayed, somewhere not.
    I guess it has something to do with the engine and the sequence of actions.

    Please tell me what could be the error, and how it can be fixed.
    Thanks!

    Forum Fan

    101 Posts


  • #2, by afrlmeTuesday, 07. December 2021, 15:17 2 years ago
    I would probably recommend using a button per animation & assigning the animation as the default animation so that it shows as soon as the button is active. You would also want to create a value per character & then assign each value to the relevant animations belonging to each specific character & assign each animation a number, so what you would end up with is something along the lines of: 1 = default, 2 = happy, 3 = sad, 4 = angry, 5 = excited, 6 = bored, etc.

    Values are great when you need multiple states. Alternatively you could store the current animation inside of a Lua variable or something & then use Lua to tell it to stop playing said animation.
    portrait_anim = "example"


    stopAnimation(Animations[portrait_anim]) -- it's either Animations or ActiveAnimations, I forget which

    Imperator

    7278 Posts

  • #3, by red363Tuesday, 07. December 2021, 20:57 2 years ago
    I would probably recommend using a button per animation & assigning the animation as the default animation so that it shows as soon as the button is active. You would also want to create a value per character & then assign each value to the relevant animations belonging to each specific character & assign each animation a number, so what you would end up with is something along the lines of: 1 = default, 2 = happy, 3 = sad, 4 = angry, 5 = excited, 6 = bored, etc.

    Values are great when you need multiple states. Alternatively you could store the current animation inside of a Lua variable or something & then use Lua to tell it to stop playing said animation.
    portrait_anim = "example"


    stopAnimation(Animations[portrait_anim]) -- it's either Animations or ActiveAnimations, I forget which
    Thank you very much for the answer! 

    In fact, I did something like what you described at the beginning. I created a separate value in the interface. Made buttons for each animation (emotion). And tied them to different values  of this variable. each replica of the character, I set the value and thus the desired portrait appeared.

    The real problem started during the dialogue. By default, animating buttons did not appear during replicas directly from the dialog box. Because there is no way to set the value of a variable in front of each replica in the dialog itself. Those. in fact, these portraits need to be turned on manually. Only universal speech bubble turns on automatically (controlled by the script for the dialog box).

    In short, I don’t know how to make it work in the dialog.


    Forum Fan

    101 Posts

  • #4, by red363Wednesday, 08. December 2021, 01:04 2 years ago
    At the moment, I solved it as follows.
    Kept the above system. To make the portrait appear in the "dialogue" mode, all the same, I created a button with the default animation and assigned this animation to it by default. I made this button dependent on the variable that controls the display of the universal speech bubble. Thus, this portrait appears by default during the initial remarks, even in the "dialogue" mode.

    Further, when the dialogue develops, for example, in a replica in the “execute action”, there I can already control the portraits using a separately created variable for all these buttons. To prevent the default portrait from crawling out during each replica, in the first frame of the animation of each button with different emotions, I set to perform the action: hide the default animation. If you need to return during the replicas back to the default animation and hide all the other "call actions", and there we reset the values  of the variable responsible for other portraits to -1.

    It works. The only bold minus is that during the initial replicas in the dialogs, only the portrait with the default animation is displayed.

    Forum Fan

    101 Posts

  • #5, by afrlmeWednesday, 08. December 2021, 13:12 2 years ago
    Hmm... so it's sort of working, but not quite? Values would work fine. As for dialogs you do know there is a section that lets you add action parts to it?

    Anyway, in regards to the dialog system in general, I would highly highly recommend not using it as intended. Tick the alternative text for dialog part checkbox & leave both the answer to dialog part text input box & the alternative text for dialog part text input boxes empty, & then add action parts to the execute action section on the right hand side & with that section you will be able to manually use display texts, play/stop animations, manipulate values & conditions, etc. Overall it's just a much more flexible way of handling dialogs as you get a lot more control over what's happening.

    https://i.gyazo.com/ed2325ba220fcdeeff098fa755c4617e.png

    Imperator

    7278 Posts

  • #6, by red363Wednesday, 08. December 2021, 21:53 2 years ago
    Wow!
    I knew these possibilities, but did not know that it could be used that way.
     Thanks a lot Afrlme. The problems have now been resolved.

    Forum Fan

    101 Posts