Page 1 of 2

Switching Scenes Using Sequence

Posted: Tue Jan 24, 2017 6:34 am
by harumin
Is there a possibility for a dialogue choice to move to another scene?

Re: Switching Scenes Using Sequence

Posted: Tue Jan 24, 2017 10:08 am
by Tony Li
Yes:

1. Add a Level Manager component to your Dialogue Manager.

2. Use the LoadLevel() sequencer command. For example:
  • Dialogue Text: "Let's take this outside."
  • Sequence: LoadLevel(City)
If the player has a Persistent Position Data component and you want it to spawn at the location of a specific GameObject in the new scene, you can specify that GameObject in the LoadLevel() command. For example:
  • Dialogue Text: "Let's take this outside."
  • Sequence: LoadLevel(City, Pub Door Spawnpoint)

Re: Switching Scenes Using Sequence

Posted: Wed Jan 25, 2017 3:34 am
by harumin
Thanks Tony :)

Re: Switching Scenes Using Sequence

Posted: Wed Jan 25, 2017 8:36 am
by Tony Li
Happy to help! If you get stuck on any of it, just let me know.

Re: Switching Scenes Using Sequence

Posted: Thu Feb 02, 2017 8:49 am
by harumin
Alright, I implemented S-Inventory to the game and I made a vendor. My game doesn't have controls because It's a visual novel and I couldn't trigger the vendor UI. I had the Usable script component on the vendor object and the triggers and I can't seem to open the UI. I also have the interact button set up on the Player

Re: Switching Scenes Using Sequence

Posted: Thu Feb 02, 2017 9:37 am
by Tony Li
Hi,

How would you like the player to open the vendor UI? By selecting a response in a conversation? By clicking on a UI button?

If it's a UI button, I suggest this:

1. Set the SInventory Vendor Trigger's Trigger dropdown to OnUse.

2. Inspect the UI button. In the OnClick() event, click "+" to add a new event handler slot. Assign the vendor GameObject to the slot, and from the dropdown select SInventoryVendorTrigger.OnUse(Transform). Assign the player to the Transform field.

Re: Switching Scenes Using Sequence

Posted: Thu Feb 02, 2017 9:00 pm
by harumin
Thanks for the reply and sorry for being vague. I would like to open the vendor's UI by the player's dialogue response

Re: Switching Scenes Using Sequence

Posted: Thu Feb 02, 2017 9:46 pm
by Tony Li
Hi,

No worries! Use this sequence:

Code: Select all

SendMessage(OnUse,,vendor)
where vendor is the name of your vendor GameObject.

For example, to test this in the example scene, I moved Sergeant Graves (a vendor) very close to the Dead Guard. Then I set the Sequence field of one of the Dead Guard's conversation entries to:

Code: Select all

SendMessage(OnUse,,Sergeant Graves)
I moved Sergeant Graves close to the Dead Guard because he's configured to automatically close the vendor panel if the player is too far. If you're making a visual novel, you can probably just set all the vendors and the player to location (0,0,0).

Re: Switching Scenes Using Sequence

Posted: Fri Feb 03, 2017 7:47 am
by harumin
Thanks Tony, another question how do I properly create a condition using S-Inventory on dialogue nodes? For example, if the player bought a center Item, it will close the vendor window or will be taken to another conversation. How do I do it?

Re: Switching Scenes Using Sequence

Posted: Fri Feb 03, 2017 9:47 am
by Tony Li
This requires a little bit of scripting.

S-Inventory has a script named InventoryEvents with a number of C# events (such as "OnPlayerBoughtItem") that your script can subscribe to. If your script subscribes to OnPlayerBoughtItem, it can check if the player bought the required item. If so, it can close the vendor window and start another conversation. Or it can set a variable and then send a sequencer message; with this approach, you could stay in the same conversation and make it wait until your script sends the sequencer message.

I can help if you get stuck. Let me know if you need an example.