Page 1 of 1

[SOLVED]NPC Shop UI

Posted: Mon Oct 12, 2020 10:21 am
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?

Re: NPC Shop UI

Posted: Mon Oct 12, 2020 11:16 am
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.

Re: NPC Shop UI

Posted: Mon Oct 12, 2020 12:33 pm
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?

Re: NPC Shop UI

Posted: Mon Oct 12, 2020 1:21 pm
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)

Re: NPC Shop UI

Posted: Mon Oct 12, 2020 2:34 pm
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)

Re: NPC Shop UI

Posted: Mon Oct 12, 2020 6:49 pm
by mschoenhals
Thanks Tony! Works great.

Re: [SOLVED]NPC Shop UI

Posted: Mon Oct 12, 2020 8:27 pm
by Tony Li
Happy to help!