123iamking Posted February 22, 2015 Share Posted February 22, 2015 (edited) 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 February 22, 2015 by 123iamking Link to comment Share on other sites More sharing options...
Jitnaught Posted February 22, 2015 Share Posted February 22, 2015 Have you tried using the DO_SCREEN_FADE_IN native to stop the loading screen? Link to comment Share on other sites More sharing options...
123iamking Posted February 22, 2015 Author Share Posted February 22, 2015 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 More sharing options...
Jitnaught Posted February 22, 2015 Share Posted February 22, 2015 DO_SCREEN_FADE_OUT is the opposite of what you want to do. Link to comment Share on other sites More sharing options...
123iamking Posted February 22, 2015 Author Share Posted February 22, 2015 (edited) DO_SCREEN_FADE_OUT is the opposite of what you want to do. Silly me, I forgot 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 February 22, 2015 by 123iamking Link to comment Share on other sites More sharing options...
NTAuthority Posted February 22, 2015 Share Posted February 22, 2015 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. 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 More sharing options...
123iamking Posted February 22, 2015 Author Share Posted February 22, 2015 (edited) 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 February 22, 2015 by 123iamking Link to comment Share on other sites More sharing options...
NTAuthority Posted February 22, 2015 Share Posted February 22, 2015 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... 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 More sharing options...
123iamking Posted February 23, 2015 Author Share Posted February 23, 2015 (edited) 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 February 23, 2015 by 123iamking Link to comment Share on other sites More sharing options...
123iamking Posted February 23, 2015 Author Share Posted February 23, 2015 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 SNTHere 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 More sharing options...
sjaak327 Posted April 8, 2015 Share Posted April 8, 2015 (edited) 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 April 8, 2015 by sjaak327 leftas, Skorpro and 123iamking 3 Link to comment Share on other sites More sharing options...
123iamking Posted June 12, 2015 Author Share Posted June 12, 2015 (edited) 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 June 12, 2015 by 123iamking Link to comment Share on other sites More sharing options...
123iamking Posted June 12, 2015 Author Share Posted June 12, 2015 (edited) 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 June 12, 2015 by 123iamking Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now