Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Please be aware that this is not a tutorial request forum! Use the appropriate topic for the effect.
Sign in to follow this  
fastman92

[GTA SA] How to properly add car generators with CLEO script?

Recommended Posts

fastman92

How to properly add car generators with CLEO script?

 

Tutorial for GTA SA.

 

For many years there was a problem with car generators in CLEO script.

CLEO script would run everytime you load the game and car generators made with SCM would then be written to savefile the next time you save the game.

Therefore, it may be desirable to make car generators temporary and prevent them from being saved.

 

 

 

 

{$CLEO}// Create a car generator for infernus014B: [email protected] = init_car_generator #INFERNUS color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 2492.0278 -1665.8153 13.3437 angle 90.0014C: set_parked_car_generator [email protected] cars_to_generate_to 1010AB1: call_scm_func @DisableCarGeneratorFromBeingSaved 1 car_generator [email protected]// Make a CLEO script no longer execute.0A93: end_custom_thread//////////////////////////////////////////////////////////////:DisableCarGeneratorFromBeingSaved{Description:Disables car generator from being written into savefile.Fixes a corruption of savefile because of car generators used in CLEO.Parameters:Passed:[email protected] - car generator indexExample:0AB1: call_scm_func @DisableCarGeneratorFromBeingSaved 1 car_generator [email protected]}// Is invalid generator [email protected] == -1then0AB2: ret 0end0A8D: [email protected] = read_memory 0x6F32AA size 1 virtual_protect false // CCarGenerator_size0AA7: call_function 0x479D60 num_params 1 pop 1 [email protected] store_result_to [email protected] // CCarGenerator* [email protected] >= 0x30 // is CCarGenerator_extended [email protected] += 0x220A8C: write_memory [email protected] size 2 value 0xFFFF virtual_protect false // [email protected] += 0x1C0A8C: write_memory [email protected] size 1 value 0xFF virtual_protect false // iplFileend0AB2: ret 0
When you made a car generator, you just have to call function @DisableCarGeneratorFromBeingSaved

 

3 lines of code

 

014B: [email protected] = init_car_generator #INFERNUS color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 2492.0278 -1665.8153 13.3437 angle 90.0014C: set_parked_car_generator [email protected] cars_to_generate_to 1010AB1: call_scm_func @DisableCarGeneratorFromBeingSaved 1 car_generator [email protected]
You need to copy my function DisableCarGeneratorFromBeingSaved into your CLEO script and put it to the end of file.

Share this post


Link to post
Share on other sites
OrionSR

Interesting, but how does this function... function? I've had some experience with unallocating gargens using cleo by removing the allocation flag. It occurred to me that I might be able to make the cargens temporary by also setting an IPL flag and letting the vehicle get discarded when CJ leaves the area. This strategy sounds like it would leave a more persistent vehicle during that play.

 

I had an idea for another strategy for managing the problem of persistent cargens: Add whatever you want using standard opcodes and when you are unhappy with the results dump the entire cargen pool and put the standards and favorites back the way you want them. All vehicles can be displayed and then the reward vehicle hidden based on mission variables and stats. I made reasonably good progress on a hide car script and I think I worked out everything except how to tease out the export vehicles mid-mission, which is probably manageable but wasn't necessary for the task at hand.

 

And that task was to put the cars back but do it better. Like nudge a few so they spawn properly, reduce the locks on combines, add a few force spawn and player owned flags, and make the export vehicles be displayed all the time. Or put the cars back in a Chain Game configuration with the export vehicles auto-exporting in the export circle - fun trick. Or, here's the gargen pool in a nutshell, knock yourself out. Need more cargens? Spawn and remove your custom cargen based on county, city, or zone. Anyway, that project got sidetracked when I lost access to my phone, but perhaps I should revisit it for PC.

 

Added: Sorry, I forgot I was in the tutorial section when I posted. Feel free to manage this post as you feel necessary.

Edited by OrionSR

Share this post


Link to post
Share on other sites
fastman92

Interesting, but how does this function... function? I've had some experience with unallocating gargens using cleo by removing the allocation flag. It occurred to me that I might be able to make the cargens temporary by also setting an IPL flag and letting the vehicle get discarded when CJ leaves the area. This strategy sounds like it would leave a more persistent vehicle during that play.

 

I had an idea for another strategy for managing the problem of persistent cargens: Add whatever you want using standard opcodes and when you are unhappy with the results dump the entire cargen pool and put the standards and favorites back the way you want them. All vehicles can be displayed and then the reward vehicle hidden based on mission variables and stats. I made reasonably good progress on a hide car script and I think I worked out everything except how to tease out the export vehicles mid-mission, which is probably manageable but wasn't necessary for the task at hand.

 

And that task was to put the cars back but do it better. Like nudge a few so they spawn properly, reduce the locks on combines, add a few force spawn and player owned flags, and make the export vehicles be displayed all the time. Or put the cars back in a Chain Game configuration with the export vehicles auto-exporting in the export circle - fun trick. Or, here's the gargen pool in a nutshell, knock yourself out. Need more cargens? Spawn and remove your custom cargen based on county, city, or zone. Anyway, that project got sidetracked when I lost access to my phone, but perhaps I should revisit it for PC.

 

Added: Sorry, I forgot I was in the tutorial section when I posted. Feel free to manage this post as you feel necessary.

My function is very simple:

it sets the IPL ID to 0xFF or 0xFFFF,

later when you make a savefile, only car generators where IPL ID is 0 (SCM) will be saved.

When IPL ID is not 0, then car generator won't be saved.

 

Your project sounds too complicated.

Edited by fastman92

Share this post


Link to post
Share on other sites
OrionSR

Please provide a compatibility link for the extended cargen records.

 

Yes, very simple. I think I understand now: Cargens created with this function will persist as long as the player isn't using the maximum number of streaming IPL files, then these cargens will be discarded when that stream goes inactive (I haven't really tested this but I think this is how the streaming cargens work). How can I manually enable or disable an IPL stream by number? Or, can this function be adapted to apply the proper IPL number so the vehicles are discarded when CJ leaves the area? Is it possible to tap into the standard streaming cargen procedure and let it do all the work?

 

Why? Say I wanted to create stream-like cargens whenever CJ entered certain areas. I could track my cargens by index and unallocate them individually to free up room for the next area but that's a lot of work and I quickly run out of locals. It would be much easier to toggle an IPL flag (truth's farm for lack of number control) and dump the whole lot at once. Or, spawn them with proper IPL ids so they disappear on their own. Fire and forget cargens, I just can't get so carried away that I run out of room in the cargen pool for the standard streaming vehicles.

 

The index gets passed, so I think I'll move that cars_to_generate code into the function and disable display afterwards if for some strange reason I don't want to see my temp cargen all the time.

 

If I may have a little fun with imperfect analogies: Our projects employ different strategies towards a similar goal, preventing the unwanted pregnancy of cargen pools. Your strategy encourages proper prevention - like a condom. But you know how young modders are, they're going to take risks and get into trouble. My project is more like a morning after pill. An overall cargen health care program would want to combine multiple strategies to be most effective. The Plan B project is on hold due to lack of interest.

Edited by OrionSR

Share this post


Link to post
Share on other sites
_RJSingh_

It works perfect! Thanks Fastman92. :lol:

Share this post


Link to post
Share on other sites
Neddo

Wonderful! Will cleo or asi scripts ever be able to add vehicles with function (cops, taxis...)?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 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.