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

Another favour !


pep legal
 Share

Recommended Posts

Here I am (again)...bothering you people (scripters)...asking for some more help...Let's go :

 

I would really like to put an "Automatic Landing Gears Up/Down" for SA airplanes.

 

Why ? Well...not only because it would be pretty. ! (oh yeah...that would be very pretty).

 

But It's mostly because the game internally changes the acceleration power differently as landing gears are Up or Down.

 

There are two parameters in Handling.cfg associated with plane acceleration (one for LG up...other for LG down).

 

Even for planes which don't have that feature (i.e. Dodo )...the switching of parameters still happens.

 

This feature would let me put some more realistic handlings for small planes. (I've redone handlings for every vehicle in this game...now they have strong inertia, heavy mass, realistic acceleration, brakes and steers).

 

 

The basic idea is :

 

- When player first enters into an airplane, the current height is stored.

 

- After then, all height differences is calculated. Once the [ height difference is above 30 meters...or so ] AND [ speed is above 70 km/h] then Landing Gears must be set UP.

 

- Also...once [speed is below 30 km/h] then Landing Gears must be set DOWN ( no height checking is necessary this time - cause you can land on any other place ).

 

 

 

Just that ( :D ).

 

Thanks.

Edited by pep legal
Link to comment
Share on other sites

Here I am (again)...bothering you people (scripters)...asking for some more help...Let's go :

 

I would really like to put an "Automatic Landing Gears Up/Down" for SA airplanes.

 

Why ? Well...not only because it would be pretty. ! (oh yeah...that would be very pretty).

 

But It's mostly because the game internally changes the acceleration power differently as landing gears are Up or Down.

 

There are two parameters in Handling.cfg associated with plane acceleration (one for LG up...other for LG down).

 

Even for planes which don't have that feature (i.e. Dodo )...the switching of parameters still happens.

 

This feature would let me put some more realistic handlings for small planes. (I've redone handlings for every vehicle in this game...now they have strong inertia, heavy mass, realistic acceleration, brakes and steers).

 

 

The basic idea is :

 

- When player first enters into an airplane, the current height is stored.

 

- After then, all height differences is calculated. Once the [ height difference is above 30 meters...or so ] AND [ speed is above 70 km/h] then Landing Gears must be set UP.

 

- Also...once [speed is below 30 km/h] then Landing Gears must be set DOWN ( no height checking is necessary this time - cause you can land on any other place ).

 

 

 

Just that ( :D ).

 

Thanks.

There's a pinned request topic for such requests.

Link to comment
Share on other sites

Ok...thanks ! I made by myself !

 

 

I've been "smelling" other people code and learning how to do it...

 

...Well...it's not that good...but it works ! ( :lol: )

 

But any Professional inspection would be very welcome ( :cool: )

 

 

OBS.: The landing gears appear and disappear suddenly...I don't know how to use the proper animation.

 

 

 

 

{$CLEO .cs}thread 'AUTO_LG'[email protected] : float = [email protected] : float = [email protected] : float = [email protected] : float = 0.0end:startwait 250if	Player.Defined($PLAYER_CHAR)else_jump @startif   Actor.Driving($PLAYER_ACTOR)else_jump @startif   84C8:   not actor $PLAYER_ACTOR driving_flying_vehicleelse_jump @check_helijump @start :check_heli//to do check heli:check_jetpack//duno how to check jetpack0811: [email protected] = actor $PLAYER_ACTOR used_car0819: [email protected] = actor $PLAYER_ACTOR [email protected] = [email protected]: [email protected] = car [email protected] [email protected] = [email protected]@ -= [email protected]: get_plane_undercarriage_position [email protected] store_to [email protected]    [email protected] > 35.0else_jump @landing    if and  [email protected] > 45.0  [email protected] > 0.2  [email protected] == 0.0else_jump @start 08E6: set_plane [email protected] landing_gear 1018C: play_sound 1057 at 0 0 0jump @start:landingif and  [email protected] < 35.0  [email protected] < -0.2  [email protected] > 0.0else_jump @start08E6: set_plane [email protected] landing_gear 0018C: play_sound 1056 at 0 0 0jump @start

 

Edited by pep legal
Link to comment
Share on other sites

OBS.: The landing gears appear and disappear suddenly...I don't know how to use the proper animation.

 

Here is an example :

 

 

while truewait 0091F: get_plane [email protected] landing_gear_status_to [email protected]    if and        [email protected] <> 0        0AB0:   key_pressed 9    then    wait 250    0AB1: call_scm_func @PlaneShowLandGear params 2 plane [email protected] speed 0.1    end        if and        [email protected] <> 1        0AB0:   key_pressed 9    then    wait 250    0AB1: call_scm_func @PlaneHideLandGear params 2 plane [email protected] speed 0.1    endend

 

 

Functions:

 

 

:PlaneShowLandGear0A97: [email protected] = car [email protected] struct0085: [email protected] = [email protected] // (int)0085: [email protected] = [email protected] // (int)[email protected] += [email protected] += [email protected] += 0x9CC0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0repeatwait 00063: [email protected] -= [email protected]  // (float)0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 0until [email protected] <= 0.00A8C: write_memory [email protected] size 4 value 0.0 virtual_protect 00A8C: write_memory [email protected] size 4 value 0x3C23D70A virtual_protect 00A8C: write_memory [email protected] size 1 value 0 virtual_protect [email protected] += 10A8C: write_memory [email protected] size 1 value 0 virtual_protect [email protected] += 10A8C: write_memory [email protected] size 1 value 0 virtual_protect [email protected] += 10A8C: write_memory [email protected] size 1 value 0 virtual_protect 00AB2: ret 0:PlaneHideLandGear                      0A97: [email protected] = car [email protected] struct0085: [email protected] = [email protected] // (int)0085: [email protected] = [email protected] // (int)[email protected] += [email protected] += 0x5A5                        [email protected] += 0x9CC0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0repeatwait 0005B: [email protected] += [email protected]  // (float)0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 0until [email protected] >= 1.00A8C: write_memory [email protected] size 4 value 1.0 virtual_protect 00A8C: write_memory [email protected] size 4 value 0x3A83126F virtual_protect 0  0A8C: write_memory [email protected] size 1 value 2 virtual_protect [email protected] += 10A8C: write_memory [email protected] size 1 value 2 virtual_protect [email protected] += 10A8C: write_memory [email protected] size 1 value 2 virtual_protect [email protected] += 10A8C: write_memory [email protected] size 1 value 2 virtual_protect 0     0AB2: ret 0

 

 

Edited by Manfred Von Karma
Link to comment
Share on other sites

Hey Manfred...you are a coding Ninja ! :blink:

 

I'm indebted to you...for life.

 

Thanks.

Link to comment
Share on other sites

Hey Manfred...you are a coding Ninja ! :blink:

 

I'm indebted to you...for life.

 

Thanks.

You`re always welcome, feel free to ask for anything :^:

Link to comment
Share on other sites

Ok people...

 

...having been learning a lot during last few days...I'm getting (slowly) better in that Cleo sh*t.

 

I've put some "engineering" on this code...and made it a bit more organized.

 

I know it seems too much for almost no feature...but c'mon...it's for educational purpose mostly.

 

It needs 2 mp3 files for properly working...I will upload them soon.

 

Thanks.

 

 

 

 

 

 

{$CLEO .cs}thread 'AUTO_LANDGEAR'{Pep Legal #2014 - Free for distribution - You can use part or the whole thing}{just give the usual credits for Pep Legal and Manfred Von Karma }const_hCar_          = [email protected]    // Player car handle_speedZ_        = [email protected]    // Z component of speed vector_steady_        = [email protected]    // angular stability indicator_speedXsmoth_   = [email protected]    // smoothed X component of speed vector_speedYsmoth_   = [email protected]    // smoothed Y component of speed vector_nowSpeed_      = [email protected]    // current car speed sample_speedSmooth_   = [email protected]    // smoothed car speed_carHeight_     = [email protected]    // player car height from ground_temp_1F_       = [email protected]   // temp FLOAT_temp_2F_       = [email protected]   // temp FLOAT_temp_3F_       = [email protected]   // temp FLOAT_temp_1I_       = [email protected]   // temp INT_hSound_Tower_  = [email protected]   // airport tower sound handle_hSound_Gears_  = [email protected]   // landing gears sound handle_gripAdress_    = [email protected]   // CVehicle grip parameter address_deltaSpeed_    = [email protected]   // differencial Speed_landGearUD_    = [email protected]   // landing gears position (UP or DOWN)_originalGrip_  = [email protected]   // from handling parameter_fastGrip_      = [email protected]   // from handling [email protected]  : int = 0       [email protected]  : int = [email protected]  : float = 0.0   [email protected]  : float = 0.0   [email protected]  : float = 0.0   [email protected]  : float = 0.0   [email protected]  : float = 0.0   [email protected]  : float = 0.0   [email protected]  : float = 0.0   [email protected] : float = 0.0   [email protected] : float = 0.0   [email protected] : float = 0.0   [email protected] : int = 0   [email protected] : int = 0       [email protected] : int = 0       [email protected] : int = [email protected] : float = [email protected] : float = [email protected] : float = [email protected] : float = 0.0end//======================================================================//check files:startwait 1000if and    0AAB:   file_exists "cleo_sounds/landgear.mp3"    0AAB:   file_exists "cleo_sounds/airportctrl.mp3"else_jump @start        //======================================================================:idle_loop_originalGrip_ = 0.0        //must be kept clear if not in flightif    _hSound_Tower_ > 0then    Audiostream.PerformAction(_hSound_Tower_, STOP)    Audiostream.release(_hSound_Tower_)    _hSound_Tower_ = 0end        if    _hSound_Gears_ > 0then    Audiostream.PerformAction(_hSound_Gears_, STOP)    Audiostream.release(_hSound_Gears_)    _hSound_Gears_ = 0end        //======================================================================:main_loop//======================================================================//check basic conditionswait 100if	Player.Defined($PLAYER_CHAR)else_jump @idle_loop     if   Actor.Driving($PLAYER_ACTOR)else_jump @idle_loopif or      84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle    04A9:   actor $PLAYER_ACTOR driving_heli    0A0C:   is_player_using_jetpack $PLAYER_CHARelse_jump @chk_basic_endjump @idle_loop :chk_basic_end//======================================================================//To begin0811: _hCar_ = actor $PLAYER_ACTOR used_car//prepare Grip address0A97: _gripAdress_ = car _hCar_ struct_gripAdress_ += 152if    _originalGrip_ == 0.0then    0A8D: _originalGrip_ = read_memory _gripAdress_ size 4 virtual_protect 0    _fastGrip_ = _originalGrip_    _fastGrip_ /= 3    end    //======================================================================//Load soundsif  and    _hSound_Tower_ == 0    _hSound_Gears_ == 0then    _hSound_Tower_ = Audiostream.Load("cleo_sounds/airportctrl.mp3")        _hSound_Gears_ = Audiostream.Load("cleo_sounds/landgear.mp3")    wait 10end    if and    _hSound_Gears_ > 0    _hSound_Tower_ > 0else_jump @idle_loopAudiostream.Loop(_hSound_Gears_, 0)Audiostream.Volume(_hSound_Gears_) = 1.0Audiostream.Loop(_hSound_Tower_, 1)Audiostream.Volume(_hSound_Tower_) = 0.5//======================================================================// Get angular components06A2: get_car_speed_vector _hCar_ store_to _temp_1F_ _temp_2F_ _temp_3F_05A4: get_angle_between_2d_vectors _temp_1F_ _temp_2F_ and _speedXsmoth_ _speedYsmoth_ store_to _steady_//average XY speed vector -> gets stability info of trajectory if     _speedXsmoth_  == 0.0then    _speedXsmoth_  = _temp_1F_                 //first initializationelse    _speedXsmoth_  *= 0.9                      //smooth X component    _temp_1F_ *= 0.1    _speedXsmoth_  += _temp_1F_end    if     _speedYsmoth_ == 0.0then    _speedYsmoth_  = _temp_2F_                 //first initializationelse    _speedYsmoth_  *= 0.9                     //smooth Y component    _temp_2F_ *= 0.1    _speedYsmoth_  += _temp_2F_end    if     _speedZ_ == 0.0then    _speedZ_  = _temp_3F_                    //first initializationelse    _speedZ_  *= 0.9                         //smooth Z component    _temp_3F_ *= 0.1    _speedZ_  += _temp_3F_end    //======================================================================//get speed                02E3: _nowSpeed_ = car _hCar_ speed_temp_1F_    = _nowSpeed__speedSmooth_ *= 0.95               //smooth Speed samples_temp_1F_ *= 0.05_speedSmooth_ += _temp_1F_//compute differencial of speed _deltaSpeed_ = _nowSpeed__deltaSpeed_ -= _speedSmooth_//======================================================================//get player's height  (from ground)      0819: _carHeight_ = actor $PLAYER_ACTOR distance_from_ground//======================================================================//current landing gears status091F: get_plane_undercarriage_position _hCar_ store_to _landGearUD_//======================================================================//Check airports nearby0AB9: get_mp3 _hSound_Tower_ state_to _temp_1I_if or                                                                       00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 1495.0 1410.0 100.0 radius 350.0 740.0 500.0  //LV    00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 1650.0 -2515.0 100.0 radius 740.0 400.0 500.0 //LS    00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere -1350.0 -0.0 100.0 radius 600.0 700.0 500.0   //SFthen    if        _temp_1I_ <> 1    then                                                    //just got into airport        Audiostream.PerformAction(_hSound_Tower_, PLAY)    // play airport tower chat        Audiostream.Volume(_hSound_Tower_) = 0.5        041E: set_radio_channel 12                          //turn off radio                                        0A8C: write_memory _gripAdress_ size 4 value _originalGrip_ virtual_protect 0 //change Grip when close to airport                                    end   else    if        _temp_1I_ == 1    then                                                   //just got out from airport            Audiostream.PerformAction(_hSound_Tower_, STOP)            if            _landGearUD_ > 0.0                              // if landing gear is up ?        then                    0A8C: write_memory _gripAdress_ size 4 value _fastGrip_ virtual_protect 0        end    endend               //======================================================================//ok...let's compare all those things and take some action.if and    _speedZ_     > 0.0       // long moving up    _nowSpeed_   > 20.0      // with good speed    _carHeight_  > 30.0      // enough height    _deltaSpeed_ > 1.0       // just started horizontal moving    _landGearUD_ == 0.0      // landing gear is downthen     Audiostream.PerformAction(_hSound_Gears_, PLAY)    0AB1: call_scm_func @PlaneHideLandGear params 2 plane _hCar_ speed 0.05    08E6: set_plane _hCar_ landing_gear 1    0A8D: _fastGrip_ = read_memory _gripAdress_ size 4 virtual_protect 0  //update actual fast gripelse            if and        _speedZ_     < 0.0    // long moving down        _steady_     < 7.0    // nose stable        _nowSpeed_   < 40.0   // not too fast        _carHeight_  < 30.0   // not too high        _deltaSpeed_ < 0.0    // braking        _landGearUD_ > 0.0    // landing gear is up                            then        Audiostream.PerformAction(_hSound_Gears_, PLAY)        0AB1: call_scm_func @PlaneShowLandGear params 2 plane _hCar_ speed 0.05        08E6: set_plane _hCar_ landing_gear 0    endend//======================================================================jump @main_loop    //======================================================================// Perform Landing gear animation ( thanks to Manfred Von Karma - GTAforums.com ):PlaneShowLandGear0A97: [email protected] = car [email protected] [email protected] += 0x9CC0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0repeatwait 00063: [email protected] -= [email protected]  // (float)0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 0until [email protected] <= 0.00AB2: ret 0:PlaneHideLandGear                      0A97: [email protected] = car [email protected] [email protected] += 0x9CC0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0repeatwait 0005B: [email protected] += [email protected]  // (float)0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 0until [email protected] >= 1.00AB2: ret 0

 

Edited by pep legal
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.