Forum rules - please read before posting.

Draggable Dialogue

edited September 2014 in Technical Q&A

I'm just getting started with AC and loving it so far, but I need help creating a new mechanic. I'm working in a 3D environment, but using 2D sprites for characters, including the player.

I'm trying to setup a system where the player can see an NPC's emotions or inner-thoughts (floating next to them) when you click on them. Think of these emotions or inner-thoughts (single words for now) like stats hovering above or around an NPCs head. Not only does clicking the NPC generate these floating thoughts, but it also initiates a conversation at the same time. Once the conversation is initialised the player is presented with a few standard dialogue options, and I'd like to be able to drag these floating "emotion words" onto the dialogue options that in turn generates a unique response.

For example, the player is in a prison cell and an NPC guard is outside the door. The player wants to escape the prison cell. When you click on the NPC guard two words float next to him, "Daughter" and  "Money". At the same time a conversation is started, the player is now presented with one dialogue option "Tell me the keycode for the prison door". If the player clicks on the dialogue option, as you would in an adventure game, you don't get the required information. The guard says something like "I'm not telling you!". Or something.

To make things interesting I'd like the player to be able to drag the words, in this case "Daughter" and/or "Money" onto the dialogue option. Doing so starts results in a conversation about how his daughter would be disappointed if he didn't help the player, and he gives up the code. Essentially getting the information the player needs.

Basically, I need to use these draggable NPC floating words as a sort of inventory item or crafting mechanic. The player goes through a trial and error scenario by pairing up these NPC float words with the dialogue options available in order to unlock as much information as possible. In story terms using their own thoughts/emotions against them. The player keeps doing this until all options are exhausted and all the information is revealed. The player can then move on.

Hopefully I'm not being too confusing, it's a tough concept to explain :) Please ask me any questions if things are unclear.

Any help on this would be amazing. Thanks in advance.


  • edited September 2014
    You may be able to get somewhere by using what you suggested: Inventory items.

    Inventory items can be listed by name, rather than icon, and can also be categorised.  By using custom menus, you can therefore list different types of items in different parts of the screen.

    Try creating Inventory items for each emotion and dialogue option, and categorise them as either Emotion of DialogueOption.  (You'll have to create a third category for regular Inventory items, and filter to them in existing Inventory box menus).  You'll then be able to define "combine" interactions between them.

    Next, create a custom menu that displays Emotion items above (wherever the floating is supposed to be), and one that displays DialogueOptions like a regular Conversation list.  You'd have to display these menus manually, rather than using a normal Conversation, but you should be able to get the mechanics of it working.  It may be a bit of a hack, this is rather a unique mechanic.
  • Thanks Chris,

    I'll give it a try and hopefully I can make something work. I may be back on here asking for more help :)

  • edited September 2014
    Hey Chris, following your direction I got the core mechanic working and am now polishing it up.

    I have a few more problems which I can't seem to solve:

    • How can I make it so that when I click off my custom menus (anywhere on screen) it closes all menus and returns to normal gameplay? I've selected 'Click Off Menu' in the Cancel interactions with: area in the settings, but it's not working. I've also tried creating a custom ActionList searching for a ClickMarker object that then triggers the menus to close, but as it only runs once it's not picking up if the user waits a couple seconds before clicking anywhere else on the screen.
    • How can I attach my custom menus to an NPC or other GameObject? As you suggested I've made custom menus for the emotion and dialogue options, but I'd like it to stick to an NPC so if he/she moves, or I pan around the screen with the cursor, the menu stays attached. I noticed a comment in the MenuLink script about using it for 3D scene-specific menus, but couldn't find any reference to it in the manual or here on the forum. Could this be used as a solution?

    Btw, thanks for all your help so far, AC really is fantastic and the more I use it the more inspired I become. Keep up the good work!

  • Thank you.  Cancel interactions with is a very specific setting, and wouldn't be of use here.  It might be a bit laborious, but it's been found that the best way is generally to create an "invisible" button/menu that marks the "click off" area which, when clicked on, closes the menus in question.

    The MenuLink script is covered on page 90 of the manual, but there's a detailed tutorial about it here.  This may be something that'll be a lot easier once Unity's UI is official, as AC will be getting official support for it (no ETA, however).
  • edited September 2014
    The "invisible" menu/button worked perfectly! Cheers for that.

    Talking of 3D menus... I'm using 2D characters in a 3D world, is there a way to make the sprite face the GameCamera at all times? I realise this may be more of a general Unity question, and probably requires a line or two of code, but I wanted to check with you first seeing as the camera system in AC is unique. To be clear I'm looking to move the camera in 3D space but have the 2D sprite face the "lens" at all times, kind of like how Doom used to fake it's 3D.

  • If a Characters animation engine is set to Sprites Unity, it should automatically face the camera.  Have you set up your Characters correctly?  Check this tutorial just in case.
  • I've built all the characters based off that tutorial, but I've got odd things happening with my animations...

    If I keep it to only Up, Down, Left, Right for both Walk and Idle animations, then the Sprite faces the camera at all times. If I include diagonal movement then the sprite turns and moves.

    Going back to the "invisible" menu work-around, is there a way to have other menus on top of the invisible one? Something like pushing it back a layer or two. I tried following what you said in this thread:

    Didn't work for me. Any tips?

  • I can't see how adding the diagonal animations would affect the rotation - could it be that the animation clips contain rotation data by accident?

    The order that Menus are listed in the Menu Manager should affect this - try placing your "active" Menu beneath the invisible one.  That said, the 1.39 update will likely allow you to let certain Menus ignore the mouse cursor completely.
  • Another sprite/camera question for you...

    I have a scene with lots of camera switching, so when I cut to a new camera the sprite takes a split second to turn and face it, which is really off putting. Is there a way to make transition smoother? or maybe to force the sprite to change direction before changing to a new camera (in the hope of avoiding seeing it turn)?
  • Not currently, but I see your problem.  It's basically down to the various Update functions and their timing.

    I'll look into eliminating this with 1.40.
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.