Forum rules - please read before posting.

Change Conversation Menu on Click

Hello !

Sorry, the title doesn't explain my problem very well.

I have a conversation, and I would like to change the color of the button I clicked on depending on a variable, and play an Animation before skipping to the next action.

For example, I have a conversation with two options :

-Hello !

-Good Bye !

When I click on "Hello !", the corresponding button turns Green, and a little animation (button translating to the top for example) plays before the conversation menu disappears and the next action is run.

Same with Good Bye but the button turns red.. I will have a variable to determine the color.

I took a look at the MenuDialogList class, and I think a can make a change in the ProccessClick function, but I would like to know if there is another way to do it, without modifying an existing script.

Thank you in advance ! :)

Comments

  • To avoid serious headache, always rely on Unity UI as the Source for any menu you want to animate.  That way, you can rely on Unity's own Animator system and do it all with components.

    Unity's Button component has the option to rely on animation-based transitions, so you can animate what you want to happen exactly when a button is clicked.

    Integrating Unity UI with AC is covered in the Manual, but a tutorial can also be found here.

    More tricky is the delay you want between clicking the option and running the dialogue, because once a MenuDialogList is clicked on, the Conversation is ended and so any Menu set to appear During Conversation will close.

    What you could try is instead setting the Appear type to Manual, and then manually turning the menu on at the same time as you begin the actual Conversation.

    Though the result of clicking an option will still occur instantly, you could then delay it manually with Engine: Wait, and also turn the menu off after a short time.

    These could either be done with Actions, or with the OnStartConversation / OnClickConversation events if you wanted to automate it - see the Manual's "Interaction scripting" chapter.
  • Hello, thank you for the answer !

    I already have the source to UnityUI, i did a custom Conversation Menu.

    So I can have an object to handle conversation endings, in which I have an update which checks if there is an active conversation, if so, I turn On my Conversation Menu.

    On click I play an animation and turn off the menu.

    I will try this way, I didn't think about it, I tried to set the Appear type to manual but I couldn't handle it only with Actions.

    Thanks !

  • You could feasibly do it with an Update() check, but the neater approach is to use the events I mentioned above, since you can use them to only run code at the time you need it to.

    A tutorial on custom events can be found here.
  • Thank you, but when I want to use events, PlayerMenus.GetMenuWithName("Conversation").TurnOn() don't work

    http://pasteall.org/857420/csharp
  • Doesn't work in what way?  Does it give an error or just do nothing?  Please be more detailed.

    What is your Menu's appear type?  It must be set to Manual to be able to turn it on through code - otherwise, you'll have to unlock it.
  • edited March 2018
    http://pasteall.org/858841/csharp

    Here the Menu "Conversation" Turns On.

    But when I use events 

    http://pasteall.org/857420/csharp

    The Menu "Conversation" don't turn on, but I pass in the function when a conversation starts

    (When I want to print the name of a menu, it doesn't work, the name property is empty

    Edit : My bad, it's the title property)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.