edited December 2022 in ORK Support
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.

image

The second example is a seamless transition from cutscene to gameplay in Red Dead Redemption 2.

image

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.

image

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.png

I 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!
Post edited by FeldFour on
  • Your original issue was that you where using root motion, which lead to movement animations not being played during cutscenes when just moving the game object. Otherwise you could just use the player without having to switch between different setups.

    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.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • 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.
    Alright, I get the high level concept of using a conditional prefab and switching an identical prefab in and out as needed. However I can't actually get it to work. Let me walk you through it;

    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.

    image

    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'.

    image
    image
    image

    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.

    image

    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.

    image
    image

    Thank you! I know it's a lot, but once I figure out this a lot of problems are solved at once for me.
  • edited December 2022
    Local variable origin is different depending on where it's used (that's why it's named Local). For your combatant's settings, local is the combatant's own object variables. In the schematic, it's the schematic's local variables.
    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).
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2022
    Unfortunately, still no go, and it's throwing errors. I'm not sure what I'm doing wrong. Let me explain; for testing, I have it set up so that the main character's Conditional Prefab is a giant shrimp; when cutscenes play she's a shrimp, and when the cutscene ends, she turns back into a human.

    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."

    image

    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).

    image

    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.

    image

    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.
    Post edited by FeldFour on
  • FeldFour said: 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."
    Well, yeah, but only for the conditional prefab conditions. That doesn't make the Local variable origin a combatant's variables everywhere in the framework.
    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).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2022
    Nope, still not working. No combination of things I am trying seems to work. All I want to do is the have the ability to change the Conditional Prefab of a combatant by changing an InCutscene variable from 0 to 1 and back to 0 when the cutscene is over.

    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.

    image
    Post edited by FeldFour on
  • Try adding debug output to your schematic to see if it's fired. If not, check the machine (or wherever else) that starts the schematic.

    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).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited December 2022
    This is what I got so far. Am I not 'setting the variable' correctly? How exactly do I do that?


    I ran tests with 'Bool Value' checked and unchecked, same result.

    image

    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.

    image

    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.

    image
    Post edited by FeldFour on
  • Did a quick test with that setup and it definitely works.
    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).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.