Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

GTA 4 cutscene native function


123iamking
 Share

Recommended Posts

I start working on GTA4 cutscene script, but I got problem with stop the cutscene.
The cutscene starts fine with : START_CUTSCENE_NOW (stringCutscenename);

but when the cutscene comes to finish or I press key to skip the cutscene, the loading screen never stops. If I try to force the cutscene stop with STOP_CUTSCENE(), the game will crash.

The native function: CLEAR_NAMED_CUTSCENE seems doing nothing.

Does anyone how to start and stop a cutscene properly?

 

PS: sorry, this post should be posted to the coding forum, I didn't notice the sub-forum.

Edited by 123iamking
Link to comment
Share on other sites

Have you tried using the DO_SCREEN_FADE_IN native to stop the loading screen?

I forgot to mention. I did try DO_SCREEN_FADE_OUT to stop the loading screen, but the loading screen keep coming back.

Link to comment
Share on other sites

DO_SCREEN_FADE_OUT is the opposite of what you want to do.

Silly me, I forgot :p Thank for reminding me, I keep thinking: "Hey! Loading screen, Get out!" :)

But I still wonder how to properly start and stop the cutscene because I don't know if I missed some native functions like CLEAR_NAMED_CUTSCENE would cause lost memory or something.

Edited by 123iamking
Link to comment
Share on other sites

yes, one should use CLEAR_NAMED_CUTSCENE, but it only does something if the argument matches the string passed to INIT_CUTSCENE/START_CUTSCENE_NOW.

SsZgxdL.png

Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding!

Link to comment
Share on other sites

yes, one should use CLEAR_NAMED_CUTSCENE, but it only does something if the argument matches the string passed to INIT_CUTSCENE/START_CUTSCENE_NOW.

Thank you :) , so the properly code should be something like this:

 

INIT_CUTSCENE( "cutsceneName" ); //Init cutsceneSTART_CUTSCENE_NOW( "cutsceneName" ) //start cutsceneWhile(!HAS_CUTSCENE_LOADED()) //Wait till cutscene is loaded{ wait(0); }while (true) //checking loop{   if(HAS_CUTSCENE_FINISHED() || AnyKeyIsPress())//Wait till finish or player press any key{CLEAR_NAMED_CUTSCENE( "cutsceneName" ) //clean the memory - I guessDO_SCREEN_FADE_IN( 500 ); //fix the never-stop loading screen}}

Of course the code above is not usable, but that's the ideal. Is the code right?

Edited by 123iamking
Link to comment
Share on other sites

your skipping method seems weird too, how about WAS_CUTSCENE_SKIPPED? it seems to read a flag that's written to by a control check in the cutscene manager...

SsZgxdL.png

Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding!

Link to comment
Share on other sites

your skipping method seems weird too, how about WAS_CUTSCENE_SKIPPED? it seems to read a flag that's written to by a control check in the cutscene manager...

Thank you for reminding me :) so I gonna update like this

 

INIT_CUTSCENE( "cutsceneName" ); //Init cutsceneSTART_CUTSCENE_NOW( "cutsceneName" ) //start cutsceneWhile(!HAS_CUTSCENE_LOADED()) //Wait till cutscene is loaded{ wait(0); }while (true) //checking loop{   if(HAS_CUTSCENE_FINISHED() || WAS_CUTSCENE_SKIPPED())//Wait till finish or skipped  {    CLEAR_NAMED_CUTSCENE( "cutsceneName" ) //clean the memory - I guess    DO_SCREEN_FADE_IN( 500 ); //fix the never-stop loading screen    break; //out of the loop  }}

Is that code correct?

plus, I extracted the way to show subtitle from the R*'s code

 

        bool CheckStreamingSubtitle()        {            int I;            for (I = 0; I <= (8 - 1); I++)            {                if (GTA.Native.Function.Call<bool>("IS_STREAMING_ADDITIONAL_TEXT", I))                {                    return true;                }            }            return false;        }        void LoadSubtitle(string uParam0, int uParam1)        {            bool bVar4;            bVar4 = true;            while (bVar4)            {                if (!GTA.Native.Function.Call<bool>("HAS_THIS_ADDITIONAL_TEXT_LOADED", uParam0, uParam1))                {                    if (!CheckStreamingSubtitle())                    {                        GTA.Native.Function.Call("REQUEST_ADDITIONAL_TEXT", uParam0, uParam1);                    }                    Wait(0);                }                else                {                    bVar4 = false;                }            }            return;        }void Cutsene()//Vlad's cutscene for examble{LoadSubtitle("VLAD1", 0);LoadSubtitle("V1AUD", 6);GTA.Native.Function.Call("START_CUTSCENE_NOW", "VLA1_A");            }
Edited by 123iamking
Link to comment
Share on other sites

maybe there is other code. The script now is so unstable, it got crash when I skipped the cutscene, and it's kind of slower than the cutscene started by SNT
Here is my code

        byte Start = 0;        string szCutscene = "VLA1_A";        public Movie()        {            this.KeyDown += new GTA.KeyEventHandler(MyMovies);            Tick += checkTick;                        Interval = 500;        }        void checkTick(object sender, EventArgs e)        {                        switch (Start)            {                case 0:                                        break;                case 1:                    if (GTA.Native.Function.Call<bool>("HAS_CUTSCENE_LOADED"))                        Start = 2;                    break;                case 2:                                        if (GTA.Native.Function.Call<bool>("HAS_CUTSCENE_FINISHED") || GTA.Native.Function.Call<bool>("WAS_CUTSCENE_SKIPPED"))                    {                        Start = 0;                        GTA.Native.Function.Call("CLEAR_NAMED_CUTSCENE", szCutscene);                        Wait(1000);                        GTA.Native.Function.Call("DO_SCREEN_FADE_IN", 500);                    }                    break;            }        }        void Cutscene()        {            GTA.Native.Function.Call("INIT_CUTSCENE", szCutscene);            //LoadSubtitle("VLAD1", 0);            //LoadSubtitle("V1AUD", 6);            GTA.Native.Function.Call("START_CUTSCENE_NOW", szCutscene);            Start = 1;        }        public void MyMovies(object sender, GTA.KeyEventArgs e)        {            if (e.Key == Keys.Y)            {                Cutscene();                            }                    }
Link to comment
Share on other sites

  • 1 month later...

I know this is a late response, but I just saw this thread.

 

Maybe it would be of any help, but this is how I do it in the simple trainer:

 

I have some logic to prevent cutscenes whilst on an actual mission (as it would crash the game) also some stuff to disable various radio functions and ensuring the player model used is Nico (crash otherwise).

 

but the actual starting of the cutscenes goes like this:

 

if ((GetAsyncKeyState(MenuKeyEnter) & 1) != 0)			{			Char c;			int model;			Vehicle car;			u32 playerIndex = ConvertIntToPlayerIndex(GetPlayerId());			GetPlayerChar(playerIndex, &c);			GetCharModel(c,&model);								if (!GetMissionFlag()==1)				{					if (model==1862763509)					{					cutscene=CutScene[CutNum].cutscene;					int cut=CutScene[CutNum].cutscenenumber;												if (IsCharInAnyCar©)						{						DisableFrontEndRadio();						RadioDis=true;						}											if (MobileRadio==1)						{						SetMobilePhoneRadioState(0);						SetMobileRadioEnabledDuringGameplay(0);						MobileRadio=0;						MobileRadioDis=true;						}						if (cut>0)						{						LoadAllObjectsNow();						}						if (cut==2)						{						RequestIpl("shipintro");						IPL=true;						}					StartCutsceneNow(cutscene);					m_State=StateCS;					DMenu=false;					}					else					{					PrintStringWithLiteralStringNow("STRING","You need to change the Model to Niko!",5000,1);					}				}				else				{				PrintStringWithLiteralStringNow("STRING","Mission in Progess, cannot play Cut Scene Now",5000,1);				}			}		}
where cutscene is from a array containing the actual cutscene names (such as rom1_b for cousin bellic).

 

since I am using the customthread (instead of customfiber) I cannot use wait, so I change states

 

 

the state is like this:

 

 

	case StateCS:		{			if (HasCutsceneFinished()) 			{ 			ClearNamedCutscene(cutscene);			Char c;			Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());			GetPlayerChar(playerIndex, &c);			SetCharHeading(c,180.0f);			SetCamBehindPed©;			SetPlayerControl(playerIndex,1);			DoScreenFadeIn(500);			m_State=StateDefault;				if (IPL==true)				{				RemoveIpl("shipintro");				IPL=false;				}				if (MobileRadioDis==true)				{				SetMobilePhoneRadioState(1);				SetMobileRadioEnabledDuringGameplay(1);				MobileRadio=1;				MobileRadioDis=false;				}				if (RadioDis==true)				{				EnableFrontEndRadio();				RadioDis=false;				}			DMenu=true;			}		}		break;
No need to code anything for skipping, as it is handled by the game's functions :) Edited by sjaak327
  • Like 3
Link to comment
Share on other sites

  • 2 months later...
					cutscene=CutScene[CutNum].cutscene;					int cut=CutScene[CutNum].cutscenenumber;						if (cut>0)						{						LoadAllObjectsNow();						}						if (cut==2)						{						RequestIpl("shipintro");						IPL=true;						}	
where cutscene is from a array containing the actual cutscene names (such as rom1_b for cousin bellic).

 

 

 

Thank you, so to load a cutscene properly, we have to "LoadAllObjectsNow" first, and If the cutscene is "shipintro", we have to "RequestIpl".

But can you explain me more about LoadAllObjectsNow() and RequestIpl() actually do, like: LoadAllObjectsNow() really does load all objects of the game? and what IPL and what kinds of cutscene would need Request_IPL (in case I do cutscene in EFLC) ?

Edited by 123iamking
Link to comment
Share on other sites

As I try to put the Load_All_Objects_Now to the script, it still doesn't fix the problem, (I haven't add the RequestIpl("shipintro"); yet because I only try to run the cutscene VLA1_A for now), here my entire script, please help me point out where it go wrong

using System;using System.Windows.Forms;using GTA;using System.Collections.Generic;using System.Drawing;namespace GtaCutscene{    public class Movie : Script    {        byte Start = 0;        string szCutscene = "VLA1_A";        public Movie()        {            this.KeyDown += new GTA.KeyEventHandler(MyMovies);            Tick += checkTick;                        Interval = 500;        }        bool CheckStreamingSubtitle()        {                        for (int I = 0; I <= (8 - 1); I++)            {                if (GTA.Native.Function.Call<bool>("IS_STREAMING_ADDITIONAL_TEXT", I))                {                    return true;                }            }            return false;        }        void LoadSubtitle(string uParam0, int uParam1)        {            bool bVar4 = true;            while (bVar4)            {                if (!GTA.Native.Function.Call<bool>("HAS_THIS_ADDITIONAL_TEXT_LOADED", uParam0, uParam1))                {                    if (!CheckStreamingSubtitle())                    {                        GTA.Native.Function.Call("REQUEST_ADDITIONAL_TEXT", uParam0, uParam1);                    }                    Wait(0);                }                else                {                    bVar4 = false;                }            }            return;        }                void checkTick(object sender, EventArgs e)        {                        switch (Start)            {                case 0:                                        break;                case 1:                    if (GTA.Native.Function.Call<bool>("HAS_CUTSCENE_LOADED"))                    {                        GTA.Native.Function.Call("LOAD_ALL_OBJECTS_NOW");                                                Start = 2;                    }                    break;                case 2:                                        if (GTA.Native.Function.Call<bool>("HAS_CUTSCENE_FINISHED") || GTA.Native.Function.Call<bool>("WAS_CUTSCENE_SKIPPED"))                    {                        Start = 0;                        GTA.Native.Function.Call("CLEAR_NAMED_CUTSCENE", szCutscene);                        Player.Character.Heading = 180.0f;                        GTA.Native.Function.Call("SET_CAM_BEHIND_PED", Player.Character);                        GTA.Native.Function.Call("SET_PLAYER_CONTROL", Player.Index,1);                        Wait(1000);                        GTA.Native.Function.Call("DO_SCREEN_FADE_IN", 500);                    }                    break;            }        }        void Cutscene()        {            if (GTA.Native.Function.Call<bool>("GET_MISSION_FLAG"))                return;            if(GTA.Native.Function.Call<bool>("IS_CHAR_IN_ANY_CAR",Player.Character))                return;            GTA.Native.Function.Call("INIT_CUTSCENE", szCutscene);            //LoadSubtitle("VLAD1", 0);            //LoadSubtitle("V1AUD", 6);            GTA.Native.Function.Call("START_CUTSCENE_NOW", szCutscene);            Start = 1;        }        public void MyMovies(object sender, GTA.KeyEventArgs e)        {            if (e.Key == Keys.Y)            {                Cutscene();                            }                    }    }}
Edited by 123iamking
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.