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

[RELEASE] Scripted Speech


iriedreadlock23
 Share

Recommended Posts

iriedreadlock23

Here's source code for anyone who'd like to script conversations between ingame characters. Use SCOCL to compile. It should work with GTA IV, TBOGT and TLAD. I have tested in TBOGT. Feel free to modify as You wish to suit Your needs. This is not meant to replace original ingame scripted conversations, but instead to use as a alternative tool to learn game programming. It allows You combine unlimited voices in conversation. Make Your own script logic to trigger scripted speech at any time.

 

Speech lines in this example used:

 

Voice: JACOB

Source: GTA IV

 

* LJ1_CA

* LJ1_ZA

 

common.h (add lines)

 

 

typedef struct _ACTOR{Ped handle;char* name;char* voice;} ACTOR, *PACTOR;typedef struct _SPEECH{int startTime;int actor;char* line;} SPEECH, *PSPEECH; boolean speechWork(int startTime,Ped actorPed,char* Voice,char * Line){uint SpeechTimer;SpeechTimer=  TIMERA();if(startTime>-1 && startTime < SpeechTimer ){ if(DOES_CHAR_EXIST(actorPed)) { 	SAY_AMBIENT_SPEECH_WITH_VOICE(actorPed, Line,Voice,1,1,1);   	 	speechCurrent=speechCurrent+1; 	PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", Line, 1500, 1); 	return TRUE;	 } else { 	PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", "Speaker nah exist", 1000, 1); 	return FALSE; }  	}else{ return FALSE;}}

 

 

globals.h (add lines)

 

 

// GLOBAL SPEECH SECTIONint G_SPEECH_CURRENT = 0;int G_SPEECH_COUNT = 0;int G_SPEECH_ACTORS = 0;boolean G_SPEECH_ACTIVE = FALSE;ACTOR G_ACTORS[5];SPEECH G_SPEECHES[455];

 

 

yourscript.sco

 

 

// PUT ANYWHERE IN NEW SCRIPTvoid addSpeaker(int actorIndex,Ped speakerPed,char *speakerVoice,char *speakerName){if(actorIndex<5){ G_ACTORS[actorIndex].handle=speakerPed; G_ACTORS[actorIndex].voice=speakerVoice; G_ACTORS[actorIndex].name=speakerName;}}void cleanSpeech(int lenght){int f;while(f<lenght){ G_SPEECHES[f].actor=-1; G_SPEECHES[f].line=""; G_SPEECHES[f].startTime=-1; f=f+1;}G_SPEECH_CURRENT=0;G_SPEECH_COUNT=0;SETTIMERA(0);}void addSpeechLine(int actorIndex, char *speakerLine,int sayAtTime){if(G_SPEECH_COUNT<255){ G_SPEECHES[G_SPEECH_COUNT].actor=actorIndex; G_SPEECHES[G_SPEECH_COUNT].line=speakerLine; G_SPEECHES[G_SPEECH_COUNT].startTime=sayAtTime; G_SPEECH_COUNT = G_SPEECH_COUNT+1;}}void replaceSpeechLine(int lineIndex, int ActorID,char *speakerLine,int sayAtTime){if(ActorID<5 && lineIndex<255){ G_SPEECHES[lineIndex].actor=ActorID; G_SPEECHES[lineIndex].line=speakerLine; G_SPEECHES[lineIndex].startTime=sayAtTime;}}void initGlobals(void){G_SPEECH_ACTORS = 0;G_SPEECH_COUNT = 0;G_SPEECH_CURRENT = 0;G_SPEECH_ACTIVE = FALSE;}void startSpeech(void){SETTIMERA(0);G_SPEECH_ACTIVE = TRUE;}void mainLoop(void){while(TRUE){if(G_SPEECH_ACTIVE){ if(G_SPEECH_CURRENT<G_SPEECH_COUNT) { 	if(G_SPEECHES[G_SPEECH_CURRENT].actor>-1) 	{   Ped pdx;   pdx = G_ACTORS[G_SPEECHES[G_SPEECH_CURRENT].actor].handle;   if(DOES_CHAR_EXIST(pdx))   {   	int sInd;   	sInd = G_SPEECH_CURRENT;     if(speechWork(G_SPEECHES[sInd].startTime,pdx,G_ACTORS[G_SPEECHES[sInd].actor].voice,G_SPEECHES[sInd].line))     {         PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING",G_SPEECHES[sInd].line,1000, 1);     G_SPEECH_CURRENT = G_SPEECH_CURRENT + 1;   	}   	else   	{     //   	}   }   else   {   	PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","SPEAKER DONT EXIST. STOPPING.",1000, 1);   	G_SPEECH_ACTIVE=FALSE;   } 	} } else { 	PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","SPEECH ENDED",1000, 1); 	G_SPEECH_ACTIVE=FALSE; }}}}void main(void){initGlobals();Ped anyPed; // assign some Ped// SET SPEAKER TO SLOTaddSpeaker(0,GetPlayerPed(),"JACOB"); // speaker 0addSpeaker(1,anyPed,"REAL_BADMAN"); // speaker 1// ADD SPEECH AND SET TIMEaddSpeechLine(0,"GENERIC_HI",5000);addSpeechLine(1,"GENERIC_f*ck_OFF",7900);addSpeechLine(0,"LJ1_CA",10000);addSpeechLine(0,"LJ1_ZA",14000);addSpeechLine(1,"CAR_SLOW",17000);startSpeech();mainLoop();}

 

Edited by iriedreadlock23
Link to comment
Share on other sites

PacketOverload_x64bit

So awesome! I didnt think this was possible as of six months ago!

Link to comment
Share on other sites

  • 11 months later...
iriedreadlock23

Did you know that you can use more than 30000 speeches from 3 GTA IV games? We still don't see many mods utilizing scripted speeches which were used in missions, because it is not quite easy to understand which line to use with in game voices (JACOB etc). This code will help you to decode the "hidden" voices/speeches, and find out who says which of these lines, and then you can use this in your code. Grab <<SPEECH HELPER>> script and start decoding your own GTA IV/TBOGT/TLAD speeches.

 

INCLUDED

 

11500+ speech lines extracted from TBOGT

Play them all out of the box!

Edit script to meet your demands (save to file etc)

>>>> download here

 

FINDING MORE DATA

 

Format of these speeches is like "E2Tm2_TA", where data before the underscore ("_") tells us which script holds the information about voices & GXT entries, so we can make each of these lines into human friendly format later. Open GXT/SCO files and search for any string that looks like scripted speech. Add to your bank file, and let the show begin!

Link to comment
Share on other sites

Did you know that you can use more than 30000 speeches from 3 GTA IV games? We still don't see many mods utilizing scripted speeches which were used in missions, because it is not quite easy to understand which line to use with in game voices (JACOB etc). This code will help you to decode the "hidden" voices/speeches, and find out who says which of these lines, and then you can use this in your code. Grab <<SPEECH HELPER>> script and start decoding your own GTA IV/TBOGT/TLAD speeches.

 

INCLUDED

 

11500+ speech lines extracted from TBOGT

Play them all out of the box!

Edit script to meet your demands (save to file etc)

>>>> download here

 

FINDING MORE DATA

 

Format of these speeches is like "E2Tm2_TA", where data before the underscore ("_") tells us which script holds the information about voices & GXT entries, so we can make each of these lines into human friendly format later. Open GXT/SCO files and search for any string that looks like scripted speech. Add to your bank file, and let the show begin!

I have run your script, I ran TBoGT and press Insert, it started searching, but no speech were spoken, even I have waited till 1000 and the game started to lag. Is there anything wrong?!?

Link to comment
Share on other sites

iriedreadlock23

Try to change BANK_ITEM offset. Default is 0. Try to start from 1000. Note that there are 11,500 lines to check. To find everything you will have to loop through all of them with the voices you have defined. To stop searching, press DELETE on your keyboard.

 

Try some more voices (Less you try at once, less lag you get)

 

addActorCheck("ARMANDO")

addActorCheck("HENRIQUE")

Link to comment
Share on other sites

In the mission Hostile Negotiation, in the battle, Niko often shouts "Test me! Test me!", "I'm living here with Roman", ect,...

Is there anyway I can trigger those speeches? Those speeches 're so cool you know :))

Link to comment
Share on other sites

iriedreadlock23

It is possible, but you will have to get the names of those speech lines, which are inside of SCO and GXT, linked with Hostile Negotiation. Note that I couldn't manage to play main character's scripted speech, yet. We'll have to figure that one out.

Link to comment
Share on other sites

In the mission Hostile Negotiation, in the battle, Niko often shouts "Test me! Test me!", "I'm living here with Roman", ect,...

Is there anyway I can trigger those speeches? Those speeches 're so cool you know :))

when u guy figure out how to this, plz post the code.

One more question, Does anyone know how to make random speeches like in SNT? I still don't understand how SNT can detect how many speeches one ped has.

Link to comment
Share on other sites

iriedreadlock23

Simple Native Trainer has a predefined structure to hold all of available voices/speeches in the game. You can ask someone to give you a c header file, or open RPF audio archives with OpenIV, and you can tell what each ped has in its vocabulary. As for Random speech, the game will check if ped has more than 1 variation of the requested speech. Depending on the number of available speech variations, it will play them one by one to the last, and back to 1st. By using certain flag with Native functions related to speech, you can prevent the same speech from being used again.

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.