IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Post mod/code requests in the Mod Requests topic

Post mod releases in the Mod Showroom

Read the Modding Rules BEFORE posting!

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Playing sounds and in-game time

 
Braveheartuk  
Posted: Saturday, Aug 4 2012, 20:06
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 2, 2012

XXXXX



Hello

How would I go about playing sounds from speech.rpf?

Also how can I check if the in-game time is say later than 2100 hours? I've tried "World.CurrentDayTime > TimeSpan.FromHours(21.00)" but that doesn't seem to work.

Thanks
PM
  Top
 

 
DonSalami  
Posted: Tuesday, Aug 7 2012, 10:21
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Mar 29, 2012

gr.gif

XXXXX



Hi there,

Playing a sound from speech.rpf is rather simple, if you know how to, but it took me some hours till I found out, too biggrin.gif

Here is how to (I guess you write in C#):

Player.Character.Voice = "NIKO";
GTA.Native.Function.Call("SAY_AMBIENT_SPEECH", Player.Character, "GENERIC_BUY", 1, 1, 1);

1) At first, you have to define your Players voice. Do the same for any ped you like. List of possible voices --> http://www.gtaforums.com/index.php?showtopic=426464

2) Use GTA.Native.Function.Call("SAY_AMBIENT_SPEECH", the ped/player you want to say the sound, "The_string_name_of_the_sound", Parameters);
Find some info about the possible parameters and what they do here --> http://www.gtamodding.com/index.php?title=SAY_AMBIENT_SPEECH

I would recommend you to use SparkIV, go to audio/sfx/speech.rpf/SPEECH . There you find all possible voices and by clicking on them, you can see the possible sounds to play.
Attention: The name of the voice in SparkIV doesn't resemble the name you have to use in the script. "NIKO_NORMAL_1" for example ist just "NIKO". For "NIKO_ANGRY_1" and "NIKO_ANGRY_2", write "NIKO_ANGRY". Same goes for the sounds, "GENERIC_BUY_1" and "GENERIC_BUY_2" just go as "GENERIC_BUY". The game will pick on of the sounds and play it, so Niko won't always say the same sentence.

Just play arround and you will find out!


To check the ingame time, just define a variable to check the current time. If you want the time to be checked every second for example, use a tick-event.

void timecheck_Tick(object sender, EventArgs e)

{
hours = World.CurrentDate.TimeOfDay.Hours;
}

if (hours >= 21)
{
do_something;
}

Hope that helped!

This post has been edited by DonSalami on Tuesday, Aug 7 2012, 10:28
PM
  Top
 

 
jpm1  
Posted: Tuesday, Aug 7 2012, 10:58
Quote Post


Vice city citizen
Group Icon
Group: Members
Joined: Sep 26, 2005

fr.gif

XXXXX



don't understand well but sounds are playable with open iv . they are in sfx/audio . in game time just open your mobile
PM
  Top
 

 
Braveheartuk  
Posted: Thursday, Aug 9 2012, 00:11
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 2, 2012

XXXXX



I meant how I would play a sound in-game using C#, not ambient voice though. For example a radio message from police_scanner.rpf. Similar to the original game when completing a mission, a sound will play.
PM
  Top
 

 
jpm1  
Posted: Thursday, Aug 9 2012, 07:46
Quote Post


Vice city citizen
Group Icon
Group: Members
Joined: Sep 26, 2005

fr.gif

XXXXX



ok smile.gif
PM
  Top
 

 
Braveheartuk  
Posted: Friday, Aug 10 2012, 14:03
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 2, 2012

XXXXX



QUOTE (Braveheartuk @ Thursday, Aug 9 2012, 00:11)
I meant how I would play a sound in-game using C#, not ambient voice though. For example a radio message from police_scanner.rpf. Similar to the original game when completing a mission, a sound will play.

Can anyone help out with this?
PM
  Top
 

 
DoTTGaMMa  
Posted: Friday, Aug 10 2012, 22:26
Quote Post


The Coder
Group Icon
Group: Members
Joined: Aug 11, 2010

us.gif

XXXXX



The easiest way to figure something like this out is to browse the GTA IV Native Functions List.

Here are a few Natives I've found that will do the job, although for all but one of them there is no guide for what the char *name takes to convert it to report something in-game.

extern void TRIGGER_POLICE_REPORT(char *name);
extern void REPORT_CRIME(float x, float y, float z, char *name);
extern void REPORT_DISPATCH(int id, float x, float y, float z);
extern void REPORT_POLICE_SPOTTING_SUSPECT(Vehicle veh);
extern void REPORT_SUSPECT_ARRESTED(void);
extern void REPORT_SUSPECT_DOWN(void);

Here's some info on "TRIGGER_POLICE_REPORT"

The Format for using Void natives in the .NET Scripthook (if you didn't know is)

GTA.Native.Function.Call("NATIVE_GOES_HERE", param0, param1);

I know one, or a combination of these Natives can do the job for you, you just might have to do some trial & error on the parameters to figure out what param does what when it comes the the char *name (which actually takes a param of type "string"). You might be able to find what the names are by browsing the police_scanner audio file in OpenIV/ SparkIV, or by searching the internet for the answer or for someones open source code they might have posted online (pastebin.com?)...

Also, with the time feature you were talking about, what would be most efficient for your coding, and easier to accomplish, would be just to call the native for getting the time, and this statement doesn't have to be run in a tick. I find that it is always better to use Natives because if they do not want to work for whatever reason it typically does not error your script. I've posed some pseudo-code below to show this.

if (GTA.Native.Function.Call<int>("GET_HOURS_OF_DAY") > 21)
{
//Do This
}

Hope I've helped you a bit,
-Matt

This post has been edited by DoTTGaMMa on Friday, Aug 10 2012, 22:37
PMMSNXbox Live
  Top
 

 

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG