[Dev Log] Designing User Input for Hidden Choices
In the previous article, I presented a problem involving quests. You are shown a list of quests that you can pick and choose to complete freely. When a quest has been completed, it should be removed from the list.

We saw that using conditional branches to handle every possible combination of available quests was not a feasible solution.

The solution I came up with was to find a way for game developers to designate whether a choice should be hidden or not, and then just build their choices as usual.

I know what I want to achieve, so the next step is to decide how users will use the plugin. This may or may not be your next step, but I typically start by figuring out

1. What I want (eg: to hide choices)

2. How I want to use it (eg: in a non-cumbersome way)

And then worry about the details. If there's no way for me to use it in a feasible way then I'd have to think about whether the idea is worth pursuing. This is not always the case, as I may leave it up to users to figure out how to use it.

Designing User Input

I will be providing two ways to disable a choice. This is to cater to different developers with different levels of proficiency and preferences.

Plugin Command

The first way is to use a plugin command. Simply write something like

hide_choice 2

And it will hide choice 2. If you consider the first choice in a list of choices to be choice 1, then choice 2 will be the one after it.

It will be up to you to set up conditional branches appropriately to control when the choices will be disabled.

Script Call

The second way to do it would be to use a script call. Here, you will use a formula to determine whether a choice should be disabled or not.

Here is an illustration that summarizes how both options work

Applying this to our Example

If you haven't read the previous article, we have an NPC that offers 3 quests, as shown below

The first two quests are available by default, but the third quest is only available when certain unlock conditions are met. This picture assumes that the unlock condition has been met. Once a quest is completed, it will be removed from the list.

Logically, we can summarize our requirements as follows:

  • If apples have been collected, hide the choice
  • If potatoes have been harvested, hide the choice
  • If legendary pear is not available, or has been completed, hide the choice.

Otherwise, the choice will be shown.

Following the input format that I've designed, assuming we're going with a purely plugin-command approach, this is how it will look:

Looks pretty intuitive right?

I'm pretty satisfied with the way the input will be specified, so we now we can move on to the next step in the process: figuring out how to implement the hiding logic in the codebase.

Was this helpful?

If you enjoyed this article, share it with your friends, on Twitter or Facebook, or anything else that you might use.

Any feedback, questions, or suggestions are welcome.