For transparency, I wrote about this before but I couldn't quite grasp the help given to me. Hopefully this time I'll be a little bit more succinct.
Previously on 'FeldFour Doesn't Know He's Doing'...What I'm trying to do is implement a
seamless transition from cutscene to gameplay, whether its returning control to the player, or a battle. You can see this in a lot of games; the first example is a seamless transition from
cutscene to a battle from Lost Odyssey.
The second example is a seamless transition from
cutscene to gameplay in Red Dead Redemption 2.
In both of these examples,
the 'player' object in the cutscene is the same object that transitions cleanly into the battle/player control. It bears mentioning that if you've played either if these games before, the gif doesn't capture the totality of what's happening; these aren't merely just a couple of simple camera pans for a couple of seconds before the transition, they're full blown, minutes long cinematics that seamlessly transfer control to the player without missing a beat or a camera cut.
Theoretically, the PlayableDirector/Timeline component in Unity seems to be the cleanest, most efficient way to do this, however, in order for Timeline to work, it needs to be fed the object that its doing stuff with, in below, the empty Animator block. In my case this would normally be the Player Object, however in Ork, the player object is generated
after the scene starts.
Normally I know that the way to make cutscenes (that a lot of AAA games also do) would be have a game object that looks like the Player Object as a stand in and hide the actual Player Object and swap them once the cutscene ends, but obviously to make a seamless cutscene this wouldn't fly.
In the topic above I was given this advice in regards to the above;
https://i.imgur.com/Cmh5PIC.pngI have a question on two pieces of this advice specifically;
Conditional prefabs automatically replace a combatant's prefab based on defined conditions. E.g. you use a global bool variable InCutScene being set to true to control that.
Otherwise you'd just need a small script that sets the game object in the timeline/playable to ORK's player - you can get the player game object at all time like this:
GameObject player = ORK.Game.GetPlayer();
Can I get a play by play on how to do this? I think I understand it in the abstract, but I don't know what to like, actually do, step by step.
I know it's a lot. Thank you!
I thought of another way you could do this without using conditional prefabs or separate game objects for in-game and cutscene. Set up an animation setup in ORK that forwards movement speed parameter (to drive the animations instead of the controls), use that in a status effect to override animations and add the effect to the player during cutscenes.
Conditional prefabs are set up in the combatant's prefab settings. Should be pretty straight forward - you add a conditional prefab setup, select the prefab and define the conditions, e.g. a variable condition.
In your cutscene schematic, just set the variable to the value it needs to have to replace the prefab.
I'm not that well versed in playable/timeline scripting, so can't really go into details here. The idea is to have a component on your director game object that automatically sets the game object, animator, etc. for the player by using ORK's player.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
My conditional prefab setup. As a test I made it so that the player is supposed to turn into a shrimp when 'InCutscene' is set to '1'. The default state of 'InCutscene' the rest of the time is 0.
Elsewhere, I have a Schematic called SCH_Cutscene that I set up to call whenever there's a cutscene to play. This is supposed to set the aforementioned 'InCutscene' variable to '1'.
On the scene itself, I have my Timeline to play out the actual meat of the cutscene (more on this later), and an AutoMachine that is supposed to trip off the Schematic itself. Basically, the cutscene Schematic's sole job is to turn the InCutscene variable from '0' to '1', and the Timeline component instantaneously does its thing, staying out of everyone's way.
In this case (and many other cases) the Timeline and the Automachine pop off automatically. Of course the ideal is to be able to set it up as needed and not always automatically. That concludes the current definition of the problem I'm facing.
While this hasn't come into play yet because I didn't get this far, I'm going to put it out there in case you have input; the purpose of the 'Variable Changer' machine and the 'Cutscene Changer' object that activates at the end of the Timeline is supposed to change the Conditional Prefab back to the regular prefab when the cutscene ends and control returns to the player.
Thank you! I know it's a lot, but once I figure out this a lot of problems are solved at once for me.
I.e. you need to set it in the schematic on Object variable origin and use the combatant's object.
Or, you can use a Global variable and change it for all (that use it) at the same time. That's definitely the easiest solution :)
The Variable Changer component's Local variable origin also only refers to that game object's Object Variables (component).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
In other words;
When the InCutscene value = 0, she's her Normal Prefab.
When the InCutscene value = 1, she's her Shrimp Prefab.
At first I was using Local variables everywhere because the tutorial on Conditional Prefabs states "In conditoina prefabs, the combatant’s variables are Local variables."
However when I set it to a Local variable, it just doesn't work at all. So as you can see, I just set everything to Global. I also set a 'Wait' to be approximately as long as the Timeline cutscene to wait until the actual cutscene finishes until the InCutscene variable goes back to 0 (to go back to normal).
However when that happens, the opposite of what's supposed to happen happens; she's her default Prefab when the scene starts during the cutscene, but when the cutscene ends (as in, when the Schematic above runs its course and those 5 seconds are up) and the InCutscene is supposed to have been set back to 0, she's her conditional prefab, a shrimp instead.
In short, all I essentially want to do is to make a Conditional Prefab pop off when the InCutscene Int is 1 and return to her normal prefab when its 0 but the opposite seems to be happening. When I try to be slick and reverse the 0 and 1 it goes back to not working at all.
I feel like I'm just a dum-dum and this whole thing should be WAY easier than what it is and I'm just making it more complicated.
But I do feel like I'm almost there.
Also, your conditional prefab has Is Valid disabled, i.e. this prefab is used when the variable is not 1.
As for your schematic, you don't need the Variable Exists node (or set it in the Settings node).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I feel very frustrated, because this should be the easiest thing in the world to do, and I just can't get it to work, no matter what. From what I can tell, the 'Change Variables' that is supposed to set the InCutscene variable to '1' (and thus change the PC into a shrimp) never pops off.
I did what you advised and enabled Is Valid and removed the Variable Exists node and set the Variable in settings.
Otherwise, that should be an easy task - set a global variable, the combatant's conditional prefab checking that variable is used. Maybe post new pictures of your current setup (conditional prefab and schematic (including change variables nodes).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I ran tests with 'Bool Value' checked and unchecked, same result.
As you can see, the variable 'InCutscene' is set as true in the debug, but she's still not a shrimp (her conditional prefab) like she's supposed to be. I also set it to 'wait' so I can be sure the actual schematic popped off; it's running and the debug also confirms that as well.
I've tried every combination of checking and unchecking 'Is Valid' and 'Exists' to no result. Same with setting it from Global/Local. No difference. As you mentioned before, if I uncheck 'Is Valid' she turns into her conditional prefab after 'IsCutscene' is False. That has its own uses, but not what I want. But in any case I know that the schematic is running based on that behavior.
The only way I see this not working is the game object in the cutscene not being the player combatant's game object ... do you still use a setup where it's switched out for a scene object or something like that?
Otherwise, I'd need a test project - though since I'm out of office soon, that'll have to wait until I'm back (January 11).
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!