Few scene change questions

Announcements, support questions, and discussion for the Dialogue System.
Brijac
Posts: 18
Joined: Sat Apr 25, 2020 5:40 pm

Few scene change questions

Post by Brijac »

Hi, I have couple of questions about the scene change with Scene Portal.

I have Lvl1 and Lvl2 and it works great when I change scenes with Scene Portal when Player triggers it but I would to put something like IntroLvl2 scene between Lvl1 and Lvl2. Player would trigger Scene Portal on Lvl1, IntroLvl2 would load with text story about Lvl2 and then there would be a button to Start Lvl2. The problem is that Scene Portal can't work on button (probably can with editing the script but I'm not really good with C#), it works only when Player triggers it so my question is how could I transfer my Player to a specific Spawnpoint (just like Scene Portal does it) on Lvl2 with a Button on IntroLvl2 scene?

I'm also using Standard Scene Transition Manager to FadeIn and FadeOut scenes but I only get FadeIn, FadeOut doesn't happen. These are my settings (copied from demoscene2):
https://i.gyazo.com/3d56ab0bf2cba1407a5 ... e8fae3.png
I tried making it like it is in documentation with FadeToBlack and FadeFromBlack settings but I can't find this Canvas (Animator) anywhere: https://www.pixelcrushers.com/dialogue_ ... anager.png
I also tried using SceneFaderCanvas (Animator) with FadeToBlack and FadeFromBlack but it is not working.

And last, I made a quest where the Player activates a quest in Scene1 but has to go to Scene2 to pick up some items or kill enemies and then return to Scene1 to finish it by talking to NPC. Activating Scene Portal from Scene1 to Scene2 is easy because I only need a quest to be in active state to make a Scene Portal SetActive but when the Player kills enemies or picks up items in Scene2 I don't know how to activate a Scene Portal to go back from Scene2 to Scene1. For example, there's a quest to kill three enemies in Scene2, Player goes through the portal to Scene2, kills 3/3 and that "3/3" somehow triggers the Scene Portal to Scene1 so that the Player can go back and finish the quest. Is it possible to trigger a Scene Portal when all three enemies are killed?
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Few scene change questions

Post by Tony Li »

Hi,
Brijac wrote: Thu Apr 30, 2020 8:40 pmHi, I have couple of questions about the scene change with Scene Portal.

I have Lvl1 and Lvl2 and it works great when I change scenes with Scene Portal when Player triggers it but I would to put something like IntroLvl2 scene between Lvl1 and Lvl2. Player would trigger Scene Portal on Lvl1, IntroLvl2 would load with text story about Lvl2 and then there would be a button to Start Lvl2. The problem is that Scene Portal can't work on button (probably can with editing the script but I'm not really good with C#), it works only when Player triggers it so my question is how could I transfer my Player to a specific Spawnpoint (just like Scene Portal does it) on Lvl2 with a Button on IntroLvl2 scene?
Add a SaveSystemMethods component to your UI Button. Configure the UI Button's OnClick() event to call SaveSystemMethods.LoadScene, and specify the scene name.
Brijac wrote: Thu Apr 30, 2020 8:40 pmI'm also using Standard Scene Transition Manager to FadeIn and FadeOut scenes but I only get FadeIn, FadeOut doesn't happen. These are my settings (copied from demoscene2):
https://i.gyazo.com/3d56ab0bf2cba1407a5 ... e8fae3.png
I tried making it like it is in documentation with FadeToBlack and FadeFromBlack settings but I can't find this Canvas (Animator) anywhere: https://www.pixelcrushers.com/dialogue_ ... anager.png
I also tried using SceneFaderCanvas (Animator) with FadeToBlack and FadeFromBlack but it is not working.
Make SceneFaderCanvas (or the other Canvas from your first screenshot), a child of the Dialogue Manager so it survives scene changes.
Brijac wrote: Thu Apr 30, 2020 8:40 pmAnd last, I made a quest where the Player activates a quest in Scene1 but has to go to Scene2 to pick up some items or kill enemies and then return to Scene1 to finish it by talking to NPC. Activating Scene Portal from Scene1 to Scene2 is easy because I only need a quest to be in active state to make a Scene Portal SetActive but when the Player kills enemies or picks up items in Scene2 I don't know how to activate a Scene Portal to go back from Scene2 to Scene1. For example, there's a quest to kill three enemies in Scene2, Player goes through the portal to Scene2, kills 3/3 and that "3/3" somehow triggers the Scene Portal to Scene1 so that the Player can go back and finish the quest. Is it possible to trigger a Scene Portal when all three enemies are killed?
Yes. In DemoScene2, examine an Enemy GameObject. Its Increment On Destroy component's OnIncrement() event calls the Dialogue System Trigger on the Enemies GameObject. This Dialogue System Trigger checks the kill count and sets the quest to success. You could do the same thing, except instead of setting the quest to success you can use Add Action > Set GameObjects Active to activate the scene portal.
Brijac
Posts: 18
Joined: Sat Apr 25, 2020 5:40 pm

Re: Few scene change questions

Post by Brijac »

Thanks for the reply.
Tony Li wrote: Thu Apr 30, 2020 8:58 pm Add a SaveSystemMethods component to your UI Button. Configure the UI Button's OnClick() event to call SaveSystemMethods.LoadScene, and specify the scene name.
This works, the scene changes on button but I can't specify the spawnpoint for the player or I don't see the option for that?
Tony Li wrote: Thu Apr 30, 2020 8:58 pmMake SceneFaderCanvas (or the other Canvas from your first screenshot), a child of the Dialogue Manager so it survives scene changes.
Now it works fine. Thanks.
Tony Li wrote: Thu Apr 30, 2020 8:58 pmYes. In DemoScene2, examine an Enemy GameObject. Its Increment On Destroy component's OnIncrement() event calls the Dialogue System Trigger on the Enemies GameObject. This Dialogue System Trigger checks the kill count and sets the quest to success. You could do the same thing, except instead of setting the quest to success you can use Add Action > Set GameObjects Active to activate the scene portal.
I've setup the Enemy objects with Increment On Destroy and Enemies GameObject like in your demoscene2 and Dialogue System Trigger on it, I've set the quest conditions to quest active and added an action for GameObject = true but I don't know how to set condition to count enemy kills so that the GameObject becomes true when all three enemies are killed "3/3"?
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Few scene change questions

Post by Tony Li »

Brijac wrote: Sat May 02, 2020 5:30 am
Tony Li wrote: Thu Apr 30, 2020 8:58 pmAdd a SaveSystemMethods component to your UI Button. Configure the UI Button's OnClick() event to call SaveSystemMethods.LoadScene, and specify the scene name.
This works, the scene changes on button but I can't specify the spawnpoint for the player or I don't see the option for that?
You can specify it in the same string with an "@" sign, such as "Castle@Foyer" to spawn the player at the Foyer spawnpoint in the Castle scene.
Brijac wrote: Sat May 02, 2020 5:30 amI've setup the Enemy objects with Increment On Destroy and Enemies GameObject like in your demoscene2 and Dialogue System Trigger on it, I've set the quest conditions to quest active and added an action for GameObject = true but I don't know how to set condition to count enemy kills so that the GameObject becomes true when all three enemies are killed "3/3"?
Examine the Dialogue System Trigger on the Enemies GameObject. The individual Enemy GameObject run the Enemies DialogueSystemTrigger.OnUse method. The Enemies Dialogue System System Trigger's Conditions section checks if the kill count variable meets the requirements (e.g., Variable["enemiesKilled"] >= 3). If so, it runs the Actions section, which sets the quest to success.
Brijac
Posts: 18
Joined: Sat Apr 25, 2020 5:40 pm

Re: Few scene change questions

Post by Brijac »

Tony Li wrote: Sat May 02, 2020 7:50 amYou can specify it in the same string with an "@" sign, such as "Castle@Foyer" to spawn the player at the Foyer spawnpoint in the Castle scene.
I just can't get this to work, I've set it up like this:
On introscene for Lvl2 I have panel like this: https://i.gyazo.com/89de29215e6be809704 ... 750bdf.png
On that panel is a button looking like this: https://i.gyazo.com/7fbfa6eaed4b701935b ... de12a0.png
On Lvl2 there is a gameobject called SpawnPoint626: https://gyazo.com/e7bc7aebb6c45c0d9e3b00873d89a06e

The Lvl2 scene loads, there is a Player but it is not on SpawnPoint626 position.
Tony Li wrote: Sat May 02, 2020 7:50 amExamine the Dialogue System Trigger on the Enemies GameObject. The individual Enemy GameObject run the Enemies DialogueSystemTrigger.OnUse method. The Enemies Dialogue System System Trigger's Conditions section checks if the kill count variable meets the requirements (e.g., Variable["enemiesKilled"] >= 3). If so, it runs the Actions section, which sets the quest to success.
Oh, the Lua Conditions, I thought you meant Quest Conditions.. I haven't even checked that because I never used that. Now it's working fine.
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Few scene change questions

Post by Tony Li »

Hi
Brijac wrote: Sat May 02, 2020 12:32 pm
Tony Li wrote: Sat May 02, 2020 7:50 amYou can specify it in the same string with an "@" sign, such as "Castle@Foyer" to spawn the player at the Foyer spawnpoint in the Castle scene.
I just can't get this to work, I've set it up like this:
On introscene for Lvl2 I have panel like this: https://i.gyazo.com/89de29215e6be809704 ... 750bdf.png
On that panel is a button looking like this: https://i.gyazo.com/7fbfa6eaed4b701935b ... de12a0.png
On Lvl2 there is a gameobject called SpawnPoint626: https://gyazo.com/e7bc7aebb6c45c0d9e3b00873d89a06e

The Lvl2 scene loads, there is a Player but it is not on SpawnPoint626 position.
The player GameObject must have a Position Saver component, and its Use Player Spawnpoint checkbox must be ticked. The Position Saver is what moves the player to the spawnpoint.
Brijac wrote: Sat May 02, 2020 12:32 pmOh, the Lua Conditions, I thought you meant Quest Conditions.. I haven't even checked that because I never used that. Now it's working fine.
Great!
Brijac
Posts: 18
Joined: Sat Apr 25, 2020 5:40 pm

Re: Few scene change questions

Post by Brijac »

Tony Li wrote: Sat May 02, 2020 1:54 pm The player GameObject must have a Position Saver component, and its Use Player Spawnpoint checkbox must be ticked. The Position Saver is what moves the player to the spawnpoint.
I forgot to put Position Saver on the Player even tho I know I need to put it.. thanks again.

Last question, is it possible to not trigger the Scene Portal by just colliding with it but instead when a Player collides with the Scene Portal a pop up appears like "Press E to enter"?
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Few scene change questions

Post by Tony Li »

Yes. Instead of using a Scene Portal, use a Dialogue System Trigger. In the trigger, select Add Action > Play Sequence. Use the LoadLevel() sequencer command, such as:

Code: Select all

LoadLevel("Castle", "Foyer")
Brijac
Posts: 18
Joined: Sat Apr 25, 2020 5:40 pm

Re: Few scene change questions

Post by Brijac »

Tony Li wrote: Sat May 02, 2020 11:54 pm Yes. Instead of using a Scene Portal, use a Dialogue System Trigger. In the trigger, select Add Action > Play Sequence. Use the LoadLevel() sequencer command, such as:

Code: Select all

LoadLevel("Castle", "Foyer")
Thank you so much!
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Few scene change questions

Post by Tony Li »

Glad to help! :-)
Post Reply