multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.35k stars 416 forks source link

Adds the ability to load and play cutscene #3276

Open gta191977649 opened 7 months ago

gta191977649 commented 7 months ago

Is your feature request related to a problem? Please describe.

The original game engine has a ability to load & play cutscene from anim\cuts.img archive, implementing by related opcodes

Why not we also implementing them in MTA SA? also we can add the ability to loads custom cutscene from file since the R* harded coded them in a table, however this table just a lookup table for reference the audio stream related to cutscene.

Describe the solution you'd like

Describe the solution you'd like

The proposed solution involves implementing a comprehensive Lua API in MTA:SA that closely mirrors the cutscene functionality of the original game engine. This API would provide scripters with the ability to load, control, and interact with cutscenes, enhancing the storytelling and immersive experience within custom game modes. Key functions to be implemented include:

  1. loadCutscene(filename): Loads a cutscene from a specified file. This function expands the capability to include custom cutscenes, not just those hardcoded in the game. The filename parameter refers to the custom file that contains the cutscene data.

  2. startCutscene(): Begins the playback of the loaded cutscene. This function is crucial for initiating the cutscene once it is loaded into the game.

  3. setCutsceneOffset(x, y, z): Sets the position for the cutscene. This function allows for the adjustment of the cutscene's starting point in the game world, giving scripters the flexibility to place cutscenes in different locations.

  4. clearCutscene(): Terminates the current cutscene. This function is necessary for scenarios where the cutscene needs to be stopped before it concludes naturally.

  5. hasCutsceneFinished(): Checks if the cutscene has finished playing. Returns true if the cutscene is complete, enabling scripters to trigger subsequent events or actions.

  6. wasCutsceneSkipped(): Determines if the cutscene was skipped by the player. This is important for gameplay flow, allowing alternative pathways or reactions based on player choices.

  7. hasCutsceneLoaded(): Verifies if the cutscene has finished loading. This ensures that the gameplay proceeds smoothly without interruptions due to loading delays.

  8. getCutsceneOffset(): Retrieves the current offset of the loaded cutscene. Useful for debugging or for scripted events that need to synchronize with specific cutscene moments.

  9. getCutsceneTime(): Returns the elapsed time since the cutscene started. This can be used for timing other in-game events in relation to the cutscene's progression.

In addition to these functions, the API should include comprehensive documentation and examples. This will help scripters to understand and effectively use the new cutscene capabilities in their custom game modes.

The implementation of this feature would significantly enhance the MTA:SA experience by enabling more dynamic and engaging storytelling elements within the game.

Describe alternatives you've considered

No response

Additional context

No response

Security Policy

sbx320 commented 6 months ago

This is fairly easy to implement in Lua directly (in fact I did so a long time ago). Also we'd need to implement some form of tooling to create GTA cutscenes, which could just be loaded from JSON.

gta191977649 commented 6 months ago

This is fairly easy to implement in Lua directly (in fact I did so a long time ago). Also we'd need to implement some form of tooling to create GTA cutscenes, which could just be loaded from JSON.

Any examples for that? As far i know cutscene animations stores in ifp as well, they can be load as normal animations, but the bone will resulting incorrect if just apply it directly on normal in-game characters. Furthermore seems some animations can also attach to objects, but i don't i think mta's animations is able to do that as well.

ALBANDER2022 commented 3 months ago

For MTA Devs , see this issue and solve it quickly please :

https://github.com/multitheftauto/mtasa-blue/issues/2564

TracerDS commented 3 months ago

For MTA Devs , see this issue and solve it quickly please :

https://github.com/multitheftauto/mtasa-blue/issues/2564

Dont crosspost, please