Jump to content

using custom text / sound for native functions


nordi

Recommended Posts

Hey

 

I would like to know, what options I have, to use custom: sounds, text, with native functions.

I think, using advancedHook, is the solution (or at least for texts), is it correct ?

 

The natives I want to use are:

extern void DRAW_CURVED_WINDOW_TEXT(float, float, float, int, int, char *, char *, int);

extern void PLAY_SOUND_FROM_POSITION(int sound_id, char *name, float x, float y, float z);

 

Thanks.

Link to comment
Share on other sites

some time ago i made a tutorial about that and more, its a little outdated now but may help:

 

http://gtaxscripting.blogspot.com.br/2013/03/tut-playing-native-sounds-and-external.html

 

about that DRAW_CURVED_WINDOW_TEXT native i never tried

 

 

Well, your tutorial is the reason I'm asking this question ^^ (I was not aware of the options, natives functions provide to play a sound (from position, from car, etc.) until i found your tutorial)

Using NAudio, will allow me to play external sound yes, but I will hear this sound anywhere in the map, while I really want to use the PLAY_SOUND_FROM_POSITION

Edited by nordi
Link to comment
Share on other sites

what you didnt understand in the PLAY_SOUND_FROM_POSITION section?

 

did you tested some code yet?

Link to comment
Share on other sites

the PLAY_SOUND_FROM_POSITION and "her friends" will do this, the question is if you want be able to stop the sound or not, some sounds like rocket on flight need to be stopped because they are looped

if you do this you will play a sound, but will not be able to stop it:

dim pos as vector3 = game.currentCamera.positionGTA.Native.Function.Call("PLAY_SOUND_FROM_POSITION", -1, "GENERAL_WEAPONS_ROCKET_LOOP", pos.X, pos.Y, pos.Z)

That tutorial has link to a file that list some game sounds, unfortunately its not possible play external sounds using those native methods, i imagine

Link to comment
Share on other sites

Hmm, that kinda sucks.. How do i play external sounds?? I want to add this is my slowmotion mod and personal vehicle mod..

Link to comment
Share on other sites

that tutorial show some examples, look for the "Playing external sounds" section

Link to comment
Share on other sites

There is no programmatic way to play external sounds using native GTA functions. You can probably change the game files, but that is out of my knowledge range.

 

You can however calculate sound level over distance, from my experience it is more a hassle than it is a useful feature but anyway here is my approach:

 

Say you have sl1 and dt1 has your reference sound level and distance, for instance 5 to 1 (meaning, at 1 meter from sound source, sound level is 5db) you can then use the following formula to calculate sl2 at dt2:

sl2 = sl1 - (10 * log(dt1 / dt2))

with our 5 to 1, to calculate level at 20 meters, would be:

sl2 = 5 - (10 * log(1 / 20))

Mathematical, this should give you the correct sound level in decibel, at the time of research this didn't prove very useful, but the need for it wasn't that big, so you may want to continue yourself from here and hopefully manage to achieve good results.

Edited by pedro2555
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
  • 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.