Forum: GTA IV Mod Releases / W.I.P.s


The above video goes away if you are a member and logged in, so log in now!




 
Would you like to get all the new info from
PSX-Scene in your email each day?




Want to learn more about the team keeping you up to date with the latest scene news?

Read about them now!

Check out our Developer bios, too!

 


User Tag List

Like Tree355Likes

Thread: The Mega Script Thread
  

Page 18 of 42 FirstFirst ... 8 16 17 18 19 20 28 ... LastLast
Results 171 to 180 of 419
  1. #171  
    keredor's Avatar
    keredor is online now Developer
    Join Date
    Mar 2012
    Posts
    180
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    136
    Likes Received
    123
    Quote Originally Posted by Colt View Post
    Is this what I need to do to get mine working? I've made a loader and I'm trying to use it as like a main menu, where I can just open it instead of loading it from a slot, but I've done 7 CD's and it hasn't worked yet

    I've called it mod_library and I've made a load_mod_library (Just like 3) but it won't open, any ideas?

    Edit: So this will allow to me to load my script straight up as I enter a game, right?
    Yes. as long as you are in multiplayer(from the second you enter multiplayer) the 4 scripts will be loaded
    Colt likes this.
    Reply With Quote  

  2. #172 Thumbs up Speedometers 
    maps4890 is offline Member
    Join Date
    Mar 2012
    Posts
    60
    Downloads
    1
    Uploads
    0
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    16
    Likes Received
    45
    Hey guys,
    I have today different styles of speedometers. I figure why not have a speedometer you can see from all the way back on the couch. lol They are about the size of mini map. Better Screenshots also included in Download.
    lol.jpg


    Download SCO's/ Source


    Credits to skorpo for his speedometer.
    Heres the Source.
    Code:
    #include <natives.h>
    #include <common.h>
    #include <consts.h>
    #include <types.h>
    #include <strings.h>
    
    
    void SkorproTextAndInt(float x1, float y1, int red1, int green1, int blue1, int 
    
    num, float x2, float y2, int red2, int green2, int blue2)
    {
    // TEXT
    SET_TEXT_FONT(1); // TEXTFONT_LED
    SET_TEXT_BACKGROUND(0);
    SET_TEXT_SCALE(0.88, 1.08);
    SET_TEXT_COLOUR(red1, green1, blue1, 255);
    SET_TEXT_EDGE(1, 0, 0, 0, 0);
    SET_TEXT_RIGHT_JUSTIFY(0);
    SET_TEXT_DROPSHADOW(0, 255, 255, 255, 255);
    DISPLAY_TEXT_WITH_LITERAL_STRING(x1, y1, "STRING", "MPH");
    
    // NUM
    SET_TEXT_FONT(1); // TEXTFONT_LED
    SET_TEXT_BACKGROUND(0);
    SET_TEXT_SCALE(1.76, 2.16);
    SET_TEXT_COLOUR(red2, green2, blue2, 255);
    SET_TEXT_EDGE(1, 0, 0, 0, 0);
    SET_TEXT_RIGHT_JUSTIFY(0);
    SET_TEXT_DROPSHADOW(0, 255, 255, 255, 255);
    DISPLAY_TEXT_WITH_NUMBER(x2, y2, "NUMBER", num);
    }
    
    void funnycar(void)
    {
    Car veh_speed;
    float fSpeed;
    int iSpeed;
    bool rep_speed = 0;
    if (IS_CHAR_IN_ANY_CAR(GetPlayerPed())) { rep_speed = 1; } 
     else { rep_speed = 0; }
    
     if (rep_speed == 1) // LOOP start
     {
      if (!IS_CHAR_IN_ANY_CAR(GetPlayerPed()))
      {
       rep_speed = 0; // LOOP end
      }
      GET_CAR_CHAR_IS_USING(GetPlayerPed(), &veh_speed);
      GET_CAR_SPEED(veh_speed, &fSpeed);
      fSpeed = fSpeed * 2.94; // Speed multiplier
      iSpeed = (int) fSpeed; // float to int
      SkorproTextAndInt(0.4, 0.865, 0, 255, 0, iSpeed, 0.17, 0.8, 255, 0, 0);
     }
    }
    
    
    void main(void){			
    THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
    	while(true)
    	{
    funnycar();
    WAIT(0);
    }  
    }
    Reply With Quote  

  3. #173  
    Colt's Avatar
    Colt is online now Developer
    Join Date
    Jun 2012
    Posts
    740
    Downloads
    0
    Uploads
    0
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    732
    Likes Received
    218
    You sir, have just earned yourself a mod folder on my Desktop

    But this is great, I'll add this to something soon.
    maps4890 likes this.
    Reply With Quote  

  4. #174  
    Raeralus's Avatar
    Raeralus is offline Software Engineer
    Join Date
    Nov 2012
    Location
    0x456e676c616e64
    Posts
    143
    Downloads
    2
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    11
    Likes Received
    45
    I couldn't find anything really apart from the sound files themselves, I found two similar sounds to being in the heart.

    I take it you can add sounds somehow?
    Reply With Quote  

  5. #175  
    Colt's Avatar
    Colt is online now Developer
    Join Date
    Jun 2012
    Posts
    740
    Downloads
    0
    Uploads
    0
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    732
    Likes Received
    218
    Quote Originally Posted by Raeralus View Post
    I couldn't find anything really apart from the sound files themselves, I found two similar sounds to being in the heart.

    I take it you can add sounds somehow?
    I saw it in 3's Mod Manager source, I think it's PLAY_AMBIENT_EVENT or PLAY_AMBIENT_SOUND. One or the other I'm sure.
    Reply With Quote  

  6. #176  
    Raeralus's Avatar
    Raeralus is offline Software Engineer
    Join Date
    Nov 2012
    Location
    0x456e676c616e64
    Posts
    143
    Downloads
    2
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    11
    Likes Received
    45
    Quote Originally Posted by Colt View Post
    I saw it in 3's Mod Manager source, I think it's PLAY_AMBIENT_EVENT or PLAY_AMBIENT_SOUND. One or the other I'm sure.
    I assume you cannot just do:

    Code:
    PLAY_AMBIENT_SOUND('sound.xxx');
    Do the sounds have IDs?

    I am going to have another look; see how the game loads this sound.
    Reply With Quote  

  7. #177  
    Colt's Avatar
    Colt is online now Developer
    Join Date
    Jun 2012
    Posts
    740
    Downloads
    0
    Uploads
    0
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    732
    Likes Received
    218
    Quote Originally Posted by Raeralus View Post
    I assume you cannot just do:

    Code:
    PLAY_AMBIENT_SOUND('sound.xxx');
    Do the sounds have IDs?

    I am going to have another look; see how the game loads this sound.
    I think that's literally how it is. It is in 3's files.

    PLAY_AUDIO_EVENT("FRONTEND_MENU_ERROR");
    Reply With Quote  

  8. #178  
    Raeralus's Avatar
    Raeralus is offline Software Engineer
    Join Date
    Nov 2012
    Location
    0x456e676c616e64
    Posts
    143
    Downloads
    2
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    11
    Likes Received
    45
    Quote Originally Posted by Colt View Post
    I think that's literally how it is. It is in 3's files.

    PLAY_AUDIO_EVENT("FRONTEND_MENU_ERROR");
    For the car wash SCO, I found this (L349):
    Code:
    REQUEST_AMBIENT_AUDIO_BANK( "SCRIPT_AMBIENT/CAR_WASH" );
    It seems there are two types if of audio. Audio or audio bank (A collection of sounds associated). So, this audio bank contains all the noises associated with the car wash unlike the normal audio file.
    Reply With Quote  

  9. #179  
    Colt's Avatar
    Colt is online now Developer
    Join Date
    Jun 2012
    Posts
    740
    Downloads
    0
    Uploads
    0
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    732
    Likes Received
    218
    Quote Originally Posted by Raeralus View Post
    For the car wash SCO, I found this (L349):
    Code:
    REQUEST_AMBIENT_AUDIO_BANK( "SCRIPT_AMBIENT/CAR_WASH" );
    It seems there are two types if of audio. Audio or audio bank (A collection of sounds associated). So, this audio bank contains all the noises associated with the car wash unlike the normal audio file.
    So, with this you would do something like:

    Code:
    void soundtest(void){
    	if(IS_BUTTON_JUST_PRESSED(0,X){
    		REQUEST_AMBIENT_AUDIO_BANK("SCRIPT_AMBIENT/CAR_WASH");
    		PLAY_AUDIO_EVENT("SCRIPT_AMBIENT/CAR_WASH");
    		Print("Sound Test 1: Car Wash");
    	}
    }
    Is that correct? Press X to play a sound?
    Reply With Quote  

  10. #180  
    Raeralus's Avatar
    Raeralus is offline Software Engineer
    Join Date
    Nov 2012
    Location
    0x456e676c616e64
    Posts
    143
    Downloads
    2
    Uploads
    0
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    11
    Likes Received
    45
    Quote Originally Posted by Colt View Post
    So, with this you would do something like:

    Code:
    void soundtest(void){
        if(IS_BUTTON_JUST_PRESSED(0,X){
            REQUEST_AMBIENT_AUDIO_BANK("SCRIPT_AMBIENT/CAR_WASH");
            PLAY_AUDIO_EVENT("SCRIPT_AMBIENT/CAR_WASH");
            Print("Sound Test 1: Car Wash");
        }
    }
    Is that correct? Press X to play a sound?
    No, I think theres more to it.

    I am looking at this car wash script, this is what I've discovered, and think how it works:

    Code:
    l_U267 = "CAR_WASH_BARRIER";
    l_U268 = "CAR_WASH_SPRAY";
    l_U269 = "CAR_WASH_BRUSH_MOTOR";
    l_U270 = "CAR_WASH_BRUSHES";
    l_U271 = "CAR_WASH_PAY";
    
    REGISTER_SCRIPT_WITH_AUDIO( 0 ); // Register the script with audio.
    GET_SOUND_ID(); // Returns an ID?
    RELEASE_SOUND_ID(); // Releases an ID? Might be deallocation.
    REQUEST_AMBIENT_AUDIO_BANK( Audio bank file ( ie "SCRIPT_AMBIENT/CAR_WASH") ); // Load a audio bank.
    AMBIENT_AUDIO_BANK_NO_LONGER_NEEDED(); // Memory?
    UNREGISTER_SCRIPT_WITH_AUDIO(); // Unregister the script with audio.
    HAS_SOUND_FINISHED( Sound ID ); // Has sound finished playing?
    STOP_SOUND( Sound ID ); // Stop sound.
    PLAY_SOUND_FROM_POSITION( Sound ID, X, Y); // Play the sound?
    PLAY_SOUND_FROM_POSITION( Sound ID, Sound Name, ?); // Play the sound? The final parameter might be a vector (Could be a struct with fields X, Y, and Z?)
    It seems a sound ID is always greater than -1
    Once a sound is released, the variable that contained it is always assigned to -1

    I will try and make a script out of this in a second.

    EDIT:

    Possible way to produce sound:
    Code:
    uint soundId = -1; // Sound IDs are greater than -1. The initial assignment is used as a test condition later. I see a lot of variables initialised without a data type. It is more than likely a integer (uint, int, etc)
    
    // The sounds that are inside this audio bank. Loaded later on in the script.
    const char* carWashBarrierSound = "CAR_WASH_BARRIER";
    const char* carWashSpraySound = "CAR_WASH_SPRAY";
    const char* carWashBrushMotorSound = "CAR_WASH_BRUSH_MOTOR";
    const char* carWashBrushesSound = "CAR_WASH_BRUSHES";
    const char* carWashPaySound = "CAR_WASH_PAY";
    
    REGISTER_SCRIPT_WITH_AUDIO(0); // Not sure what this could possibly do, but it seems essential. It might be related to memory.
    
    // Load the audio bank into memory.
    if (REQUEST_AMBIENT_AUDIO_BANK( "SCRIPT_AMBIENT/CAR_WASH" )) {
    
        AMBIENT_AUDIO_BANK_NO_LONGER_NEEDED(); // Memory related.
    
    }
    
    // Get sound ID. This doesn't seem related to anything, so maybe this is simply a randomly generated ID for sounds?
    // If only one bank/audio file can be loaded at one time, then it could possibly be the ID of either that was loaded in memory (above).
    soundId = GET_AUDIO_ID();
    
    // Fire when X button is pressed.
    if(IS_BUTTON_PRESSED(0, BUTTON_X)) {
    
        // If again my theory is right about only one audio item can be loaded into memory at one time, then this makes sense.
        // Pass in the ID of that audio item, then pass in the sound you want to play.
        PLAY_SOUND_FROM_POSITION(soundId, carWashBarrierSound, ?); // I don't know what this final parameter is. Cannot tell from the code. It might be a vector however.
    
    }
    
    // Once either sound has finished playing...
    // This native could be used to stop sound by negation, and then simply calling STOP_SOUND(soundId);
    if(HAS_SOUND_FINISHED(soundId)) {
    
        // Release the ID (Allocated above, and now deallocated).
        // Testing whether or not to release the ID could also be done by checking if the variable is greater than -1.
        RELEASE_SOUND_ID(soundId);
    
    }
    
    // Similar to the first native call. I think it's memory-related.
    UNREGISTER_SCRIPT_WITH_AUDIO();
    Still looking into this. Trying to work out the final parameter for PLAY_SOUND_FROM_POSITION(). I don't think its a vector, whatever it is it is heavily used for calculations. It might be the Z coordinate. Try leaving it as 0.

    EDIT 2:

    Looking at natives.h, it shows that the final parameter for PLAY_SOUND_FROM_POSITION is the X coordinate, the Y and Z coordinates can be passed as the other two final parameters.

    Here is the list of native definitions for the natives associated to producing sound:
    Code:
    extern void REGISTER_SCRIPT_WITH_AUDIO(boolean reg); // Register script with audio.
    extern void UNREGISTER_SCRIPT_WITH_AUDIO(void); // Un-register script with audio.
    
    extern uint GET_SOUND_ID(void); // Generate a sound ID. Sound IDs are uints.
    extern void RELEASE_SOUND_ID(uint sound); // Release the sound ID.
    extern boolean HAS_SOUND_FINISHED(uint sound); // Checks whether or not sound from the audio asset has finished playing.
    extern void STOP_SOUND(uint sound); // Stop the sound.
    extern void PLAY_SOUND_FROM_POSITION(int sound_id, char *name, float x, float y, float z); // Play a sound from the loaded audio asset.
    
    extern boolean REQUEST_AMBIENT_AUDIO_BANK(char *name); // Load an audio bank.
    extern void AMBIENT_AUDIO_BANK_NO_LONGER_NEEDED(void); // Mark the audio bank as no longer needed.
    Last edited by Raeralus; 01-05-2013 at 04:57 PM.
    Colt likes this.
    Reply With Quote  

Page 18 of 42 FirstFirst ... 8 16 17 18 19 20 28 ... LastLast
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •