Forum rules - please read before posting.

YES/NO Choice system

Hi guys

I'm trying to implement a choice system for some of the puzzles in my game eg when a player goes to flick a switch "Are you sure you want to flick this switch?" "YES" "NO"

My current idea is that the player interacts with an object by clicking its hotspot "use" interaction eg clicking on a switch. At this point Some dialogue would play "This is the switch for blah blah, It's set to off , Are you sure you want to flick it?"

--here the hotspot for that object is disabled--

Then the player would be provided two buttons to click

"Yes"
If the player hits this the choices disappear, an animation might play and then they are returned to the previous view. The hotspot for the switch is still disabled, the choices are disabled, they are done here all they can do now is leave that view

"No"
if the player hits this it would return them to the previous screen
--This decision would re-enable the hotspot for the object allowing them to go through this loop again--

The default way to do something like this seems to be through a menu. So far I've created a menu with dialogue and two buttons "YES" "NO"

My issue is that the buttons will run an action list when clicked. This is fine for a single use but I can't seem to find a way to set the action list the button will use meaning it will always run the same action list.

As far as I know this means that if I were to have multiple spots in the game where I provide this YES/NO option I would need a separate Menu each time

I had also considered using Unity UI to create text with "YES" and "NO" shown on screen and set visibility and attach hotspots around them for each interaction as a way of "faking" this.

This method would mean creating "USE" hotspot interactions for every YES/NO decision

I guess my main question is if it's tidier/less overhead for the system to create multiple menus or multiple hotspots with use interactions

or if there is a cleaner way to implement this eg is there a way to set the actionlist a button will run when clicked that I'm entirely missing?

Thanks

Comments

  • edited September 2021

    This is fine for a single use but I can't seem to find a way to set the action list the button will use meaning it will always run the same action list.

    If you were to stick to this approach, the way to do this would be to have your Button ActionLists each run an ActionList: Run Action that then runs the "correct" ActionList for that situation.

    If you define a GameObject parameter, you could then use that to override this Action's ActionList to run field. It should then just be a case of calling a pair of ActionList: Set parameter Actions as part of the Hotspot Interaction to set these two GameObject parameters to the ActionLists you intend to run when the buttons are clicked.

    A tutorial on ActionList parameters can be found here.

    But from your description, it sounds like you can just rely on the Conversation system. No need for a dedicated menu / buttons.

    At its core, a Conversation is essentially just a list of choices presented to the Player - they don't necessarily have to relate to a dialogue with an NPC. A Conversation with the choices "Yes" and "No" could be created for each Hotspot, with the results handled directly within the Hotspot Interaction.

    This technique is used by the "Combat example" package over on the Downloads page if you interact with the key on the wall. A tutorial on creating Conversations can be found here.

    If you have "regular" Conversations elsewhere, and wish to display these choices in a different style, you can create a separate Conversation menu for these moments and then lock/unlock your two Conversation menus before running a Conversation to ensure the correct one is displayed. When a Menu is locked, it will not turn on even if its Appear type condition is currently met. This can be done either through scripting, or with the Menu: Change state Action.

  • Thank you Chris

    The links to Actionlist Parameters were a good read and really useful to know.

    I hadn't considered the core functionality being a conversation but now that seems so obvious. As mentioned in your comment I've created a custom Conversations menu as to have it appear a bit different from standard conversations. All working perfectly. Thanks again

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.