Quickest way to set up basic NES/SNES-style RPG dialogue?

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quickest way to set up basic NES/SNES-style RPG dialogue?

Post by Tony Li »

Hi,

That's a good question! Side-scrollers are relatively easy: Use a Proximity Selector, and add a trigger collider to the player that's slightly offset in front of the player. This will it will detect things in front of the player but not behind. When you flip the player's GameObject to turn, the trigger will flip with it, so it will properly detect only in the front regardless of which direction the player is facing.

4-direction / 8-direction top down is a little more complicated.

If you're using a framework such as More Mountains' TopDown Engine, it's probably easiest to use the framework's interaction system. This also makes all of your interaction feel consistent to the player, instead of having different interaction systems for different types of interaction.

If you're doing it from scratch, one solution is to use a Proximity Selector with 3 trigger colliders: beside the player (like the side-scroller setup), above, and below. In your movement code:
  • If the player is moving left/right, enable the side trigger and disable the above & below triggers. Assuming you flip the player GameObject to turn left/right, this one side trigger will handle both left & right directions.
  • If the player is moving up, enable the above trigger and disable the other two.
  • If the player is moving down, enable the below trigger and disable the other two.
If that's the approach you want to take, I recommend implementing it and testing it first. Then tackle this extra twist: If the player is moving diagonally -- for example, up and right -- then you could either rely on the above trigger, or you could add 2 more diagonally-positioned triggers (above and offset to the side, below and offset to the side). If the player is moving diagonally, enable one of these triggers instead of the above/below/side triggers.

Then there's one last fine-tuning thing. When you change directions, also tell the Proximity Selector to deselect whatever had been selected in the previous direction (if anything). Here's some code to do this, which you can adapt to fit your script:

Code: Select all

// When changing directions, before changing triggers deselect the current selection:
var proximitySelector = GetComponent<ProximitySelector>();
proximitySelector.RemoveUsableFromDetectedList(proximitySelector.CurrentUsable);
karakori
Posts: 11
Joined: Sat Jul 25, 2020 3:36 pm

Re: Quickest way to set up basic NES/SNES-style RPG dialogue?

Post by karakori »

I hadn't considered the TopDown Engine asset. While I'm trying to learn as much as possible on my own, it is also nice to be able to use an asset plugin (like DS) to get things up and running so I can get down to the meat of designing the game experience.

Thanks for the tip on the trigger colliders - will definitely use that solution if I end up going from scratch.

As always, thank you for your thoughtful, detailed advice.
karakori
Posts: 11
Joined: Sat Jul 25, 2020 3:36 pm

Re: Quickest way to set up basic NES/SNES-style RPG dialogue?

Post by karakori »

Another question for you Tony.

I'm having an issue where I can skip through dialogue.

I'm using the typewriter effect, a continue button and the standard UI continue button fast forward script. The continue button triggers when I press spacebar and it cancels the typewriter effect and displays the whole sentence if I press spacebar as well. These are all desired outcomes.

The only thing not working properly is when I go through a conversation normally everything works fine but if I press spacebar rapidly I can cycle through the whole thing before the dialogue window fully opens.

Here's a gif showing normal behavior first, then too fast: There should be 2 lines of dialogue but I can skip through it so it displays none.

Image

I"m sure it's a simple fix, but not sure where I should be looking to fix the issue.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quickest way to set up basic NES/SNES-style RPG dialogue?

Post by Tony Li »

Hi,

Try these settings:

1. Inspect your dialogue UI's subtitle panel(s). On each:
  • Tick the 'Delay Typewriter Until Open' checkbox.
  • UNtick the 'Has Focus' checkbox.
  • Configure the OnOpen() event to set the continue button's Interactable property to false:
    delayTypewriterUntilOpen.png
    delayTypewriterUntilOpen.png (125.12 KiB) Viewed 1000 times
2. Inspect the Subtitle Text element.
  • Configure the typewriter effect's OnBegin() event to set the continue button's Interactable property to true:
    buttonInteractable.png
    buttonInteractable.png (99.65 KiB) Viewed 1000 times
This will disable the continue button while the subtitle panel is appearing. It will enable the continue button only when text actually starts typing.
karakori
Posts: 11
Joined: Sat Jul 25, 2020 3:36 pm

Re: Quickest way to set up basic NES/SNES-style RPG dialogue?

Post by karakori »

Bingo! Thanks a million.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Quickest way to set up basic NES/SNES-style RPG dialogue?

Post by Tony Li »

Any time!
Post Reply