Hiding a character during cutscene?
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Hiding a character during cutscene?
I'm making a short teleportation cutscene. The outline of the sequence is:
1. Teleporter pad animates (several cutscene waypoints)
2. Character disappears
3. Transition to destination pad
4. Character appears
Because it's a cutscene (the best way to get timed events) the player is already detached from this character. But I can't find any satisfactory way of hiding a character from view except by moving them somewhere off-screen. My first choice was to teleport the character to a "limbo surface" (a single chunk of solid ground) and then retrieve them. But you can't teleport characters across surfaces, only players and vehicles (if the player is inhabiting a character it teleports with them but this is a cutscene and the player is detached). My next attempt was to make the character non-destructible and teleport them to the edge of the map, a million tiles away. This apparently works but just feels wrong on several levels.
Is it possible to create an empty character animation and set them to that? Can you define custom CharacterArmorAnimations and can you set them in runtime? Having trouble finding out.
What about destroying the character and then recreating it exactly?
Someone must have done this, surely. I've looked at a couple of teleporter mods but they don't go to these lengths (we only got this kind of cutscene sophistication relatively recently).
1. Teleporter pad animates (several cutscene waypoints)
2. Character disappears
3. Transition to destination pad
4. Character appears
Because it's a cutscene (the best way to get timed events) the player is already detached from this character. But I can't find any satisfactory way of hiding a character from view except by moving them somewhere off-screen. My first choice was to teleport the character to a "limbo surface" (a single chunk of solid ground) and then retrieve them. But you can't teleport characters across surfaces, only players and vehicles (if the player is inhabiting a character it teleports with them but this is a cutscene and the player is detached). My next attempt was to make the character non-destructible and teleport them to the edge of the map, a million tiles away. This apparently works but just feels wrong on several levels.
Is it possible to create an empty character animation and set them to that? Can you define custom CharacterArmorAnimations and can you set them in runtime? Having trouble finding out.
What about destroying the character and then recreating it exactly?
Someone must have done this, surely. I've looked at a couple of teleporter mods but they don't go to these lengths (we only got this kind of cutscene sophistication relatively recently).
Re: Hiding a character during cutscene?
You can make an invisible car, and set the character to be the driver of that car
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Hiding a character during cutscene?
Wow.
Vehicles can teleport cross surface. Could I use a vanilla car and move them to a limbo surface all in the same tick?
Re: Hiding a character during cutscene?
Looks like it should workDeadlock989 wrote: ↑Tue Oct 27, 2020 12:54 pmVehicles can teleport cross surface. Could I use a vanilla car and move them to a limbo surface all in the same tick?
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Hiding a character during cutscene?
It sort of works but there are issues.
1. When putting the character in the car, the car makes its engine noises which play the next tick, even though the car is now on the limbo surface. I could set up a vehicle without sounds but then I may as well make an invisible one.
2. The character reference seems to be destroyed when it enters the vehicle and it becomes disassociated from the cutscene's player. When you eject the driver at the other end with set_driver(nil), I can't see any way to get the resulting character and re-associate it (short of scanning for characters in a radius but I have this set up so multiple players can use the pad at the same time). You end up in a weird state a bit like a god controller except you can't access any GUI, even your own inventory.
3. There's some random puff of smoke coming from somewhere when you eject the driver, not sure if it's the vehicle or what.
Going to bash my head on it a bit more later.
1. When putting the character in the car, the car makes its engine noises which play the next tick, even though the car is now on the limbo surface. I could set up a vehicle without sounds but then I may as well make an invisible one.
2. The character reference seems to be destroyed when it enters the vehicle and it becomes disassociated from the cutscene's player. When you eject the driver at the other end with set_driver(nil), I can't see any way to get the resulting character and re-associate it (short of scanning for characters in a radius but I have this set up so multiple players can use the pad at the same time). You end up in a weird state a bit like a god controller except you can't access any GUI, even your own inventory.
3. There's some random puff of smoke coming from somewhere when you eject the driver, not sure if it's the vehicle or what.
Going to bash my head on it a bit more later.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Hiding a character during cutscene?
You don't need to detach the character - at least not if you're doing it to prevent the cutscene from "returning" to the start at the end. My (unpublished) teleporter mod teleports the player to the target, starts the cutscene and then teleports it back to start the animation all in the same tick. Thus at the end of the cutscene the camera "returns" to the final destination instead of the point of origin.
Last edited by eradicator on Tue Oct 27, 2020 2:08 pm, edited 1 time in total.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Hiding a character during cutscene?
No, I'm doing it so that the character isn't on the pad when the cutscene transitions there.eradicator wrote: ↑Tue Oct 27, 2020 2:04 pmYou don't need to detach the character - at least not if you're doing it to prevent the cutscene from "returning" to the start at the end.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Hiding a character during cutscene?
In that case teleporting to the edge of the world sounds more reasonable then inventing an invisible car. I just teleport them half way through the cutscene so the player never sees themselfs dis/reappear.Deadlock989 wrote: ↑Tue Oct 27, 2020 2:06 pmNo, I'm doing it so that the character isn't on the pad when the cutscene transitions there.eradicator wrote: ↑Tue Oct 27, 2020 2:04 pmYou don't need to detach the character - at least not if you're doing it to prevent the cutscene from "returning" to the start at the end.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Hiding a character during cutscene?
What reference do you mean?Deadlock989 wrote: ↑Tue Oct 27, 2020 2:00 pm2. The character reference seems to be destroyed when it enters the vehicle and it becomes disassociated from the cutscene's player. When you eject the driver at the other end with set_driver(nil), I can't see any way to get the resulting character and re-associate it (short of scanning for characters in a radius but I have this set up so multiple players can use the pad at the same time). You end up in a weird state a bit like a god controller except you can't access any GUI, even your own inventory.
The Lua reference is held intact when I test it
- Attachments
-
- factorio-run_2020-10-29_18-48-45.png (1.94 MiB) Viewed 1131 times
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Hiding a character during cutscene?
It might be because I wasn't doing character.driving = false but instead I was doing car.set_driver(nil). That does eject the passenger but my cached reference to the character was lost. Or maybe it was something else.
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Hiding a character during cutscene?
Yep, got it working with a barebones car made of one transparent pixel and happy thoughts. Thanks.