Re: viewtopic.php?f=30&t=97943
I would like to formally request that on_cutscene_cancelled() be called when a cutscene ends on its own, OR we get a separate event (e.g. on_cutscene_ended) for when a cutscene ends without being cancelled.
Thanks
Requesting an event for when a cutscene ends
Re: Requesting an event for when a cutscene ends
Whats wrong with just using on_cutscene_waypoint_reached and knowing which one is the final one?
Re: Requesting an event for when a cutscene ends
There's nothing wrong with that per se, you're right I could just keep track of how many waypoints there are and store that in a global like I'm doing for the waypoint target and other various data.
My specific use case is that since I already store lots of things in global, I want to nil them all when the cutscene ends. Previously that happened immediately after I call player.exit_cutscene(), but now I've changed it so that when a player wants to exit the cutscene, I create a new cutscene to transition them nicely back to their character instead of immediately cutting. However, that means the cutscene ends "naturally" and I don't have a chance to nil my globals because I don't know when it actually ends. If I use on_cutscene_waypoint_reached I would then have to store more globals because the cutscene waypoint being reached would be 1, and most of my cutscenes typically have 2 or sometimes 3 waypoints that can be reached.
It's not really that big of a deal, like a lot of things I've found while playing with the cutscene controller, of course there are ways to work around it. I just thought it would be nice.
I assume that's how you do it for the crash-site cutscene; player.exit_cutscene() when the correct on_cutscene_waypoint_reached is called?
My specific use case is that since I already store lots of things in global, I want to nil them all when the cutscene ends. Previously that happened immediately after I call player.exit_cutscene(), but now I've changed it so that when a player wants to exit the cutscene, I create a new cutscene to transition them nicely back to their character instead of immediately cutting. However, that means the cutscene ends "naturally" and I don't have a chance to nil my globals because I don't know when it actually ends. If I use on_cutscene_waypoint_reached I would then have to store more globals because the cutscene waypoint being reached would be 1, and most of my cutscenes typically have 2 or sometimes 3 waypoints that can be reached.
It's not really that big of a deal, like a lot of things I've found while playing with the cutscene controller, of course there are ways to work around it. I just thought it would be nice.
I assume that's how you do it for the crash-site cutscene; player.exit_cutscene() when the correct on_cutscene_waypoint_reached is called?
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Requesting an event for when a cutscene ends
That doesn't work when waiting for a cutscene that was started by another mod.
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.
- ickputzdirwech
- Filter Inserter
- Posts: 794
- Joined: Sun May 07, 2017 10:16 am
- Contact:
Re: Requesting an event for when a cutscene ends
I would like to request an event called on_player_controller_changed or something similar.
As I understand it this could solve the issue presented here as well (that's why I am posting here).
My use case is that I want to know when another mod changes the controller. There already is on_player_toggled_map_editor but obviously mods use other controllers as well.
As I understand it this could solve the issue presented here as well (that's why I am posting here).
My use case is that I want to know when another mod changes the controller. There already is on_player_toggled_map_editor but obviously mods use other controllers as well.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write
Re: Requesting an event for when a cutscene ends
Agreed, such an event could be useful. In my character-selector mod I wouldn't have to rely on other mods informing me that they are about to change to the controller type.ickputzdirwech wrote: ↑Tue Mar 29, 2022 3:00 pm I would like to request an event called on_player_controller_changed or something similar.
…
My use case is that I want to know when another mod changes the controller. There already is on_player_toggled_map_editor but obviously mods use other controllers as well.
The only potential problem I can see is that changes from or to god mode would be triggered a lot. You don't have to use player.set_controller directly for that, it's sufficient to set/unset player.character. So changing characters the convenient way using
Code: Select all
player.character = nil
player.create_character("new_character")
Code: Select all
new_char = player.surface.create_entity{name = "new_character", position = player.position, force = player.force}
player.character = new_char
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!