Switching Scenes Using Sequence
Switching Scenes Using Sequence
Is there a possibility for a dialogue choice to move to another scene?
Re: Switching Scenes Using Sequence
Yes:
1. Add a Level Manager component to your Dialogue Manager.
2. Use the LoadLevel() sequencer command. For example:
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)
- Dialogue Text: "Let's take this outside."
- Sequence: LoadLevel(City, Pub Door Spawnpoint)
Re: Switching Scenes Using Sequence
Thanks Tony
Re: Switching Scenes Using Sequence
Happy to help! If you get stuck on any of it, just let me know.
Re: Switching Scenes Using Sequence
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
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.
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
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
Hi,
No worries! Use this sequence:
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:
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).
No worries! Use this sequence:
Code: Select all
SendMessage(OnUse,,vendor)
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)
Re: Switching Scenes Using Sequence
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
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.
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.