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

Modding main.scm


aStiffSausage
 Share

Recommended Posts

aStiffSausage

I'm doing some little fixing on the main.scm, but I really wouldn't like to start a new game confused.gif I think I've read about that with some tool or some way you don't need to start a new game, but just can't find it nervous.gif

 

 

And I would like to confirm, is it even possible to play with old save with modded main.scm?

 

And how I can open carmod1.scm, which can imported from script.img? If I try to open it with Sanny Builder, it shows it's empty cry.gif

Edited by oksa8
Link to comment
Share on other sites

metacortex

The script.img contains the compiled extern scripts. If you want to see what carmod1.scm contains, open your main.scm and search for 'carmod1'.

It will lead you to:

 

 

DEFINE SCRIPT CARMOD1 AT @CARMOD       // 66

 

 

Searching for 'CARMOD' will sooner or later lead you to line 520526:

 

//-------------External script 66 (CARMOD1)---------------

 

 

It is the beginning of the tuning thread.

 

As for your other question: I heard about a technique which requires to update the save file so it works with the current main.scm

 

cheers

Link to comment
Share on other sites

Yes, it is possible to play an old save with a modded main.scm. You will need to avoid changing the size of the main thread (not to be confused with main.scm, the full length script). Actually, any changes to any running thread, which includes main, is likely to cause problems.

 

Try to find a "template" copy of Demarest's Darkpact script. There are several versions. V3 is the most complete but I'm not sure if it is available anywhere.

 

Darkpacting used to be the standard method of modding main.scm while maintaining compatibility with previous saves. However, Darkpact no longer supported and has fallen out of use in favor of CLEO. In most cases what you want to change in main.scm can often be handled more easily by a CLEO mod.

 

What are your goals? Perhaps we can suggest more efficient methods to get the job done.

Link to comment
Share on other sites

aStiffSausage

Ok, thanks for the help! smile.gif

 

So, if I basically change some car in a mission to another one, for example MAJESTIC to CHEETAH, so the lenght of the name doesn't change, I don't need to start a new game?

 

I'll try suggested Demarest's Darkpact turn.gif

And if you know more about "updating" savefile, can you give a link or smthing? Because it would sound pretty smart that main.scm size would be saved to savegame, and game-engine checks it during loading, to avoid incompatibility while playing v1 save with v2 main.scm.

 

And I found the carmod1-part, and there's the reason you can't mod police-cars, street racers or lowriders at transfenders sly.gif

And if there's something that defines which car can have secondary color buyable in transfenders, tell me, would be nice little fix sigh.gif

Edited by oksa8
Link to comment
Share on other sites

metacortex

Secondary car colour requires that the model itself has two different areas where different colours can be applied to. Furthermore

GTA SA dir\data\carmods.dat

contains definitions in how far a car can be tuned. As you can see: Law enforcement vehicles, Ambulances and Fire brigades don't have any lines.

Link to comment
Share on other sites

aStiffSausage

 

Secondary car colour requires that the model itself has two different areas where different colours can be applied to. Furthermore
GTA SA dir\data\carmods.dat

contains definitions in how far a car can be tuned. As you can see: Law enforcement vehicles, Ambulances and Fire brigades don't have any lines.

I know it needs a secondary-color remapping, but the problem is, that some of my cars only got one color and they replace cars like Bullet, Blista Compact etc. (I'm a perfectionist biggrin.gif )

 

And about emergency vehicles, they don't have lines, like bikes or special vehicles (Hotknife, Mower etc.) which can be fixed with TransFenders overhaul, but if I remember right you can't mod emergency vehicles with it because GTA:SA doesn't allow modding them.

 

And I think there's also a way how to make street racers be able to be tunable at TF, LCC and WAA at same time, and also the other cars, found this:

 

 

if and84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle 84A7:   not actor $PLAYER_ACTOR driving_boat 8969:   not car $CARMOD_CAR is_noncivilian_vehicle 8975:   not car $CARMOD_CAR emergency_vehicle else_jump @CARMOD_2466 gosub @CARMOD_23687 if   not $10481 == 0 else_jump @CARMOD_2411 if and896F:   not car $CARMOD_CAR street_racing_car 896E:   not car $CARMOD_CAR lowrider else_jump @CARMOD_2356

 

 

And removing few lines from there (noncivilian_vehicle, emergency_vehicle, street_racing_car and lowrider) should grant access to TF with Sultan without changing handling flags, right? And same thing for police car, just add name to carmods.dat and get tuned? tounge.gif

Edited by oksa8
Link to comment
Share on other sites

Yeah, you can change the missions quite a bit since they should never be in memory when a save is made.

 

It's been a long time since I've used a Darkpact script. I seem to remember changing a couple of lines in the main thread in order to spawn different reward vehicles for the Grove St. Hydra and Rhino. So some changes might be possible. Still, it would be best to assume that any changes to the main thread will make your previous saves incompatible.

 

There are a lot of threads that are always running. These are mostly trigger threads that launch larger scripts when needed. It's possible to change these threads by shutting them down with a CLEO script when the original scripts are in place, and then relaunch the threads after changing to your modified scripts. The only thread that can't be ended and restarted is main. You can view what threads are active in the save with GTA:SA Save Game Editor v1.0 by Ryosuke: http://gtasamod.web.fc2.com/tool/sase/index.html

 

That save editor is one way to update saves. I worry about incompatibility since it was designed for the Japanese version of the game. Besides setting the cheat flag unnecessarily, it doesn't display the zones the same way, and my clothes get changes for no reason. However, this is a great save viewer.

 

Another good save editor is GTA SA Savegame Editor v3.0 by Paul Breeuwsma: http://www.paulinternet.nl/sa

 

Paul's savegame editor can change a save between v1 and v2 scripts, which have different sized mains. The trick has something to do with changing the thread pointers to account for the different offsets caused by the size change, but I don't really understand it. Paul's GTAF username is paultjuh, but he hasn't been around in months. paultjuh learned this trick from hmvartak who has an online tool for converting between saves. See: http://hmvartak.110mb.com/conv.htm

 

hmvartak picked up this trick from pdescobar, who hasn't been around in ages. If you are really ambitious you might be able to figure out the trick by examining how their tools alter the save for the different versions.

 

Another trick is to cut and paste the script block of a modified save into an older save using a hex editor. Then copy the global variable space from the original back into the updated script block to maintain the proper indexes for pickups, cars, blips, objects, etc. I've been able to run PS2 saves on PC using this method.

 

Anyway, most of the above assumes that by "updating" savefile you intend to change main or other threads that are always running. If "updating" means you want to fix stuff like spawn conflicts that prevent all 3 bikes from spawning at the bike school, or moving the bribe stuck in the wall in Doherty over the broken bridge in Palomino Creek where it belongs, then... I can go on forever. My specialty is modifying saves so they maintain compatibility with the original scripts. We used to make most of the changes by using a Darkpact script, now we do it all with CLEO. Unfortunately, I don't have the methods documented in one place.

 

So again, what are your goals?

 

Perhaps it would help to know what is actually recorded in the save files. Check out the SA Save File Wiki at GTAModding.

http://www.gtamodding.com/index.php?title=Saves_%28GTA_SA%29

Edited by OrionSR
Link to comment
Share on other sites

aStiffSausage

OrionSR, thanks for the info, I think I can now manage somehow on my own for a while lol.gif

 

Mostly I'm just trying to change some mission cars, maybe moving some stuff from place A to place B, nothing big really. I think you can add gang area's to SF and LV with Cleo, if yes, then no need for main.scm Maybe expand import/export with new vehicles, and also trying to find out the secret of secondary car color in TransFenders.

 

 

And this part:

 

if and84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle84A7:   not actor $PLAYER_ACTOR driving_boat8969:   not car $CARMOD_CAR is_noncivilian_vehicle8975:   not car $CARMOD_CAR emergency_vehicleelse_jump @CARMOD_2466gosub @CARMOD_23687if not $10481 == 0else_jump @CARMOD_2411if and896F:   not car $CARMOD_CAR street_racing_car896E:   not car $CARMOD_CAR lowriderelse_jump @CARMOD_2356

 

 

If I just remove some un-necessary stuff from there, I need to "update" my save?

Link to comment
Share on other sites

Those lines should be safe to change. It's worth a shot, and will probably work.

 

Below is the section of main that triggers the CARMOD1 script, and copied here as an example of how to check what is safe to modify. It's pretty easy to tell that CARMOD1 only runs when needed.

 

 

:MAIN_6019000D6: if or03B0:   garage 'BODLAWN' door_open 03B0:   garage 'MODLAST' door_open 03B0:   garage 'MDSSFSE' door_open 03B0:   garage 'MDS1SFS' door_open 03B0:   garage 'VECMOD' door_open 004D: jump_if_false @MAIN_60312 0926: $Script_Status = external_script_status 66 (CARMOD1) 00D6: if 0038:   $Script_Status == 0 004D: jump_if_false @MAIN_60305 08A9: load_external_script 66 (CARMOD1) 00D6: if 08AB:   external_script 66 (CARMOD1) loaded 004D: jump_if_false @MAIN_60305 0913: run_external_script 66 (CARMOD1)  :MAIN_603050002: jump @MAIN_60316 :MAIN_60312090F: end_external_script 66 (CARMOD1) 

 

 

Changing the days of the week when you can start a Triathlon is more problematic.

 

 

:MS_Beat_The_Cock03A4: name_thread 'TRI' :TRI_812220001: wait 0 ms 00D6: if 0038:   $ONMISSION == 0 004D: jump_if_false @TRI_81830 00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @TRI_81830 00D6: if or0038:   $Weekday == 1 0038:   $Weekday == 7 

 

 

This is because the TRI thread is always running.

 

Line 966:

004F: create_thread @MS_Beat_The_Cock 

 

 

 

 

 

Link to comment
Share on other sites

aStiffSausage

 

This is because the TRI thread is always running.

 

Line 966:

004F: create_thread @MS_Beat_The_Cock 

 

I'm suspecting that I don't have same version of main.scm as you, for me line 966 is:

 

create_thread @TRI

 

 

No opcode at the beginning and name is other. notify.gif

Link to comment
Share on other sites

metacortex

:TRI is the same as MS_Beat_the_Cock

 

You have Options>General>Write Opcodes unticked, that's why there is no opcode.

Link to comment
Share on other sites

aStiffSausage

 

:TRI is the same as MS_Beat_the_Cock

 

You have Options>General>Write Opcodes unticked, that's why there is no opcode.

Ticked it on, still no opcode...

And I thought that do I have other version of main.scm than you? Maybe my downgrading wasn't succesful, and it has some other main.scm? monocle.gif

 

Trying re-install and re-downgrading.

 

It could also explain bug that does crash my game when trying to meet my girlfriends... suicidal.gif

Edited by oksa8
Link to comment
Share on other sites

metacortex

No It's fine, it says

 

004F: create_thread @TRI

for me as well. You need to tick the box and then you have to reopen the main.scm.

Link to comment
Share on other sites

aStiffSausage

Ok, so I now downgraded my GTA:SA, and I think I found reason for many bugs and crashes. At least got few fixed (I got v1.0 exe but v1.1 or smthing scripts):

-No more crash when trying to see GF

-No more crash at countryside

-Hotknife spawns straight away to driver-school, not after going inside and coming back

-Spawns more vehicles.

 

And about those vehicles... dontgetit.gif

Never seen those before, red Infernus near Doherty garage, and Towtruck, and 2 Taxis outside train-station, opposite side of the road of Doherty garage.

Towtruck

Taxi and made some handling-changes, don't worry about wheels

Red Infernus on pick-ups

 

 

AND in main.scm, I now can see opcodes on create_thread-parts. And line 966 now looks like this:

 

004F: create_thread @MS_BEAT_THE_COCK

 

 

I've already made a little modifications on it, but can't seem to find where's 8-Track cars are defined. Found the part where they might be, but not sure about anything, mostly because there's nothing about HOTRING, HOTRINA or HOTRINB, or about ID's sad.gif

 

If you have time, could you check line 144361. I think it's pretty close to defining cars.

Link to comment
Share on other sites

 

I've already made a little modifications on it, but can't seem to find where's 8-Track cars are defined. Found the part where they might be, but not sure about anything, mostly because there's nothing about HOTRING, HOTRINA or HOTRINB, or about ID's  sad.gif

 

If you have time, could you check line 144361. I think it's pretty close to defining cars.

the racescript contains a very big jumptable with table of coords for arrays

there are also the id numbers listed

 

 

 

00A5: [email protected]([email protected],16i) = create_car [email protected]([email protected],16i) at [email protected]([email protected],16f) [email protected]([email protected],16f) [email protected]([email protected],16f)......:CPRACE_208120871: init_jump_table $RACE_INDEX total_jumps 27 default_jump 0 @CPRACE_46262 jumps 0 @CPRACE_21070 1 @CPRACE_21616 2 @CPRACE_22058 3 @CPRACE_22740 4 @CPRACE_23422 5 @CPRACE_24164 6 @CPRACE_25116 0872: jump_table_jumps 7 @CPRACE_26038 8 @CPRACE_27092 9 @CPRACE_28206 10 @CPRACE_28894 11 @CPRACE_29612 12 @CPRACE_30204 13 @CPRACE_30802 14 @CPRACE_32150 15 @CPRACE_33528 0872: jump_table_jumps 16 @CPRACE_34456 17 @CPRACE_35318 18 @CPRACE_36240 19 @CPRACE_36982 20 @CPRACE_38120 21 @CPRACE_40068 22 @CPRACE_42256 23 @CPRACE_43154 24 @CPRACE_44052 0872: jump_table_jumps 25 @CPRACE_44980 26 @CPRACE_45529 -1 @CPRACE_46262 -1 @CPRACE_46262 -1 @CPRACE_46262 -1 @CPRACE_46262 -1 @CPRACE_46262 -1 @CPRACE_46262 -1 @CPRACE_46262.........:CPRACE_449800007: [email protected] = -1398.355 0007: [email protected] = -197.2079 0007: [email protected] = [email protected] = model ID.04AF: [email protected] = 503 // @ = any 04AF: [email protected] = 502 // @ = any 04AF: [email protected] = 494 // @ = any 04AF: [email protected] = 503 // @ = any 04AF: [email protected] = 502 // @ = any 04AF: [email protected] = 494 // @ = any 04AF: [email protected] = 502 // @ = any 04AF: [email protected] = 494 // @ = any 04AF: [email protected] = 503 // @ = any 04AF: [email protected] = 494 // @ = any 04AF: [email protected] = 503 // @ = any 04AF: [email protected] = 503 // @ = any 04AF: [email protected] = 494 // @ = any 04AF: [email protected] = 502 // @ = any 04AF: [email protected] = 494 // @ = any 04AF: [email protected] = 502 // @ = any 0002: jump @CPRACE_46262

 

Edited by ZAZ
Link to comment
Share on other sites

 

This is because the TRI thread is always running.

 

Line 966:

004F: create_thread @MS_Beat_The_Cock 

 

I'm suspecting that I don't have same version of main.scm as you, for me line 966 is:

 

create_thread @TRI

 

 

No opcode at the beginning and name is other. notify.gif

Actually, I would have preferred that TRI be used. This script was decompiled to provide Thread + Global Offsets because the global offsets are required to launch threads with CLEO.

 

 

 

:TRI_8121103A4: name_thread 'TRI' 

 

 

 

//004F: create_thread @TRI_81211004F: create_thread 81211

 

Link to comment
Share on other sites

 

Actually, I would have preferred that TRI be used. This script was decompiled to provide Thread + Global Offsets because the global offsets are required to launch threads with CLEO.

I wondered why he got @MS_BEAT_THE_COCK

 

 

:TRI is the same as MS_Beat_the_Cock

You have Options>General>Write Opcodes unticked, that's why there is no opcode.

 

It's because "custom label names" is enabled

Options>Formats>custom label names

 

I have it allways disabled

 

Does anybody remember if this option is enabled or disabled by default?

Link to comment
Share on other sites

aStiffSausage

ZAZ, thanks for the ID-jumptable lol.gif And I haven't changed SannyBuilder settings much, only show opcodes which I enabled, and Custom label names is on by default.

 

EDIT: Fixed bug, had something to do with other files smile.gif

 

But hey, why there is red Infernus and Towtruck and two Taxis nearby Doherty Garage, they weren't there when I played this game twice through and messed around at that neighbour hood. cry.gif

Edited by oksa8
Link to comment
Share on other sites

I suspect the reason you have extra vehicles is because you experimented with some CLEO mods that added a few car generators. You can easily check which car generators are active in a save with the GTA:SA Save Game Editor v1.0 by Ryosuke: http://gtasamod.web.fc2.com/tool/sase/index.html

 

Compare the information displayed in the Car Generator tab with an unmodified save. Added car generators usually appear at the beginning of the list; there are 208 in a standard game. Record the index numbers of any vehicles that you don't want in your save and modify the code snippet posted below to unallocate those vehicles so they won't get saved.

 

 

 

// Test code that unallocates the East LS Clover so that it won't be saved.{$CLEO .cs}0000:while truewait 250if  0AB0:   key_pressed 0x77    // F8  then                                                                           0085: [email protected] = $2766   // index of the East LS Clover  [email protected] *= 0x20             // cargen record size  [email protected] += 0x00c27ad0 // start of cargen structure  [email protected] += 0x1D            // offset to allocation byte (save offset -2)  0A8C: write_memory [email protected] size 1 value 0 virtual_protect 0  wait 250  00BB: show_text_lowpriority GXT 'FESZ_LS' time 2000 flag 1  // Load Successful.endend

 

 

You'll need to change this line to assign the index of your misplaced car generator to [email protected]

 

   0085: [email protected] = $2766 // index of the East LS Clover

 

 

Use the line below and replace 499 with the index that you get from the save editor. Repeat the 5 lines between then and wait for each additional car to be removed.

 

0006: [email protected] = 499 

 

 

 

 

 

 

Link to comment
Share on other sites

aStiffSausage
I suspect the reason you have extra vehicles is because you experimented with some CLEO mods that added a few car generators. You can easily check which car generators are active in a save with the GTA:SA Save Game Editor v1.0 by Ryosuke: http://gtasamod.web.fc2.com/tool/sase/index.html

 

Compare the information displayed in the Car Generator tab with an unmodified save. Added car generators usually appear at the beginning of the list; there are 208 in a standard game. Record the index numbers of any vehicles that you don't want in your save and modify the code snippet posted below to unallocate those vehicles so they won't get saved.

 

 

...

 

You'll need to change this line to assign the index of your misplaced car generator to [email protected]

 

   0085: [email protected] = $2766 // index of the East LS Clover

 

 

Use the line below and replace 499 with the index that you get from the save editor. Repeat the 5 lines between then and wait for each additional car to be removed.

 

0006: [email protected] = 499 

 

Thanks again a lot, wouldn't have figured that out : turn.gif

 

I thought it had something to do with IPL-files or smthing and was checking them, but not apparently... Getting this thing fixed now smile.gif

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.