[SOLVED]NPC Shop UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
mschoenhals
Posts: 118
Joined: Thu Dec 19, 2019 7:38 am

[SOLVED]NPC Shop UI

Post by mschoenhals »

Hi,
I'd like to have the player approach a shop keeper NPC who will then ask if the player would like to see some items to buy. If the player says yes, then the shop UI will pop open (and close the conversation). Is that possible with the Dialogue System?
Last edited by mschoenhals on Mon Oct 12, 2020 6:50 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 21080
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC Shop UI

Post by Tony Li »

Hi,

Yes; that's a very common thing to do.

If you're using another asset such as Opsive's Ultimate Inventory System to handle the shop, then you can typically use the integration's sequencer commands to open the shop UI. Example:
  • Dialogue Text: "What do you have for sale?" [END]
  • Sequence: OpenShop(listener)
If you're using your own shop system, you can write a custom sequencer command or use the SendMessage() sequencer command to call a method on the shop keeper.
mschoenhals
Posts: 118
Joined: Thu Dec 19, 2019 7:38 am

Re: NPC Shop UI

Post by mschoenhals »

I have my own shop system. Right now I'm just using a simple trigger to activate the shop UI:

Code: Select all

shopCanvas.SetActive(true);
How do I implement that into the conversation then?
User avatar
Tony Li
Posts: 21080
Joined: Thu Jul 18, 2013 1:27 pm

Re: NPC Shop UI

Post by Tony Li »

Hi,

If we assume your shop canvas GameObject is named "Shop Canvas", use this sequencer command:

Code: Select all

SetActive(Shop Canvas)
timbecile
Posts: 110
Joined: Mon Mar 12, 2018 11:00 pm

Re: NPC Shop UI

Post by timbecile »

I use the Lua integration to trigger a shop open script (that way I can do all the different maintenance that I need to do) but it's similar to everyone else's I think:

"We'd like to Shop"

Code: Select all

OpenShop(shopID)
mschoenhals
Posts: 118
Joined: Thu Dec 19, 2019 7:38 am

Re: NPC Shop UI

Post by mschoenhals »

Thanks Tony! Works great.
User avatar
Tony Li
Posts: 21080
Joined: Thu Jul 18, 2013 1:27 pm

Re: [SOLVED]NPC Shop UI

Post by Tony Li »

Happy to help!
Post Reply