Hiding a character during cutscene?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Hiding a character during cutscene?

Post by Deadlock989 »

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

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Hiding a character during cutscene?

Post by Klonan »

You can make an invisible car, and set the character to be the driver of that car

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Hiding a character during cutscene?

Post by Deadlock989 »

Klonan wrote:
Tue Oct 27, 2020 12:50 pm
You can make an invisible car, and set the character to be the driver of that car
Wow.

Vehicles can teleport cross surface. Could I use a vanilla car and move them to a limbo surface all in the same tick?
Image

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Hiding a character during cutscene?

Post by Klonan »

Deadlock989 wrote:
Tue Oct 27, 2020 12:54 pm
Vehicles can teleport cross surface. Could I use a vanilla car and move them to a limbo surface all in the same tick?
Looks like it should work

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Hiding a character during cutscene?

Post by Deadlock989 »

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

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Hiding a character during cutscene?

Post by eradicator »

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.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Hiding a character during cutscene?

Post by Deadlock989 »

eradicator wrote:
Tue Oct 27, 2020 2:04 pm
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.
No, I'm doing it so that the character isn't on the pad when the cutscene transitions there.
Image

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Hiding a character during cutscene?

Post by eradicator »

Deadlock989 wrote:
Tue Oct 27, 2020 2:06 pm
eradicator wrote:
Tue Oct 27, 2020 2:04 pm
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.
No, I'm doing it so that the character isn't on the pad when the cutscene transitions there.
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.
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.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Hiding a character during cutscene?

Post by Klonan »

Deadlock989 wrote:
Tue Oct 27, 2020 2:00 pm
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.
What reference do you mean?
The Lua reference is held intact when I test it
Attachments
factorio-run_2020-10-29_18-48-45.png
factorio-run_2020-10-29_18-48-45.png (1.94 MiB) Viewed 1098 times

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Hiding a character during cutscene?

Post by Deadlock989 »

Klonan wrote:
Thu Oct 29, 2020 5:50 pm
What reference do you mean?
The Lua reference is held intact when I test it
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.
Image

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Hiding a character during cutscene?

Post by Deadlock989 »

Yep, got it working with a barebones car made of one transparent pixel and happy thoughts. Thanks.
Image

Post Reply

Return to “Modding help”