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. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    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 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 Mods
    10. GTA Vice City

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

      1. Guides & Strategies
      2. Help & Support
      3. GTA 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

user1592591

[GUIDE] Modding main.scm with saves support (GTA SA Only)

Recommended Posts

user1592591
Posted (edited)

NEW METHOD OF MODDING MAIN.SCM WITH SAVES SUPPORT (GTA SA Only)

 

 


The script HOME_BRAINS 20 (:HMLES) is the only one not used, it can be loaded and used to import a mod without conflicts with saves.

 

You need to remove unused lines and add one to avoid resizing the MAIN thread.

 

External scripts create a isolated thread from MAIN, so the protection of the game not reacts to them. But for the script loaders will have to adjust the memory.
You should not create a DEFINE of the new script, because the game checks this section separately, and there is nothing to delete.
But fortunately there is an unused HOME_BRAINS script, use it.

 

For those who do not know the reason for crash when loading saves:
The data on the size of the DEFINE sections and the MAIN thread are saved in the save, and if they do not correspond to the size of the sections and the MAIN thread of your main.scm,
then protection reatcs and the game closes. But this does not apply to EXTERNAL SCRIPT threads.

 

//remove - these lines should be deleted
//add - these lines should be added
//replace - these lines/code blocks should be replaced



...



:MAIN_1960
01E8: create_forbidden_for_cars_cube_cornerA 2500.0 -1677.0 20.0 cornerB 2430.0 -1653.0 0.0 
0004: $671 = 0 
0004: $673 = 0 
0004: $676 = 0 
0005: $691 = 1.0 //remove
0005: $692 = 1.6 //remove
0004: $693 = 200 //remove
0004: $694 = 200 //remove
0004: $695 = 200 //remove
0004: $696 = 255 //remove 
0004: $697 = 100 
0004: $698 = 100 
0004: $699 = 100 
0004: $700 = 255 
0004: $701 = 20 
0004: $702 = 20 
0004: $703 = 20 
0004: $704 = 255 
014B: $4161 = init_car_generator #RHINO color -1 -1 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 2435.302 -1671.848 12.8007 angle 90.0 
014C: set_parked_car_generator $4161 cars_to_generate_to 0

  
  
...



00D7: create_thread @Noname_7 // without extra params 
00D7: create_thread @Noname_8 // without extra params 
00D7: create_thread @HJ // without extra params 
00D7: create_thread @CELLFON // without extra params 
016A: fade 0 time 0 
09BA: show_entered_zone_name 0 
0001: wait 0 ms 
0001: wait 0 ms	 		//remove 
03B7: process_cutscene_only 0 
0169: set_fade_color_RGB 0 0 0 
0001: wait 2000 ms 
03B7: process_cutscene_only 1 
01F0: set_max_wanted_level_to 4 


...


:MAIN_5749
0001: wait 0 ms 
00D6: if 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false @MAIN_7482 
077E: get_active_interior_to $42 
0652: $24 = integer_stat 181 
07D0: $39 = weekday 
09FB: $153 = current_language 
0842: $3253 = player $PLAYER_CHAR town_number 
01BD: $6668 = current_time_in_ms
00D6: if 
0038:   $671 == 1 
004D: jump_if_false @MAIN_5888 
0084: $6667 = $6668 // (int) 
0060: $6667 -= $6669 // (int) 
00D6: if 
0028:   $6667 >= 180000 
004D: jump_if_false @MAIN_5888 
0004: $671 = 0 
0004: $673 = 0
0004: $6667 = 0
0004: $11398 = 0
0004: 0@ = 0 		//add


...



0913: run_external_script 66 (CARMOD1)

:MAIN_6003
0002: jump @MAIN_6014 //replace with 0002: jump @MAIN_8304

:MAIN_6010
090F: end_external_script 66 (CARMOD1)

//ADD BELOW THIS COMMENT

:MAIN_8304
0926: 0@ = external_script_status 20 (HOME_BRAINS) 
00D6: if 
0038:   0@ == 0 
004D: jump_if_false @MAIN_6014 
08A9: load_external_script 20 (HOME_BRAINS) 
00D6: if 
08AB:   external_script 20 (HOME_BRAINS) loaded 
004D: jump_if_false @MAIN_6014
0913: run_external_script 20 (HOME_BRAINS)

//AND ABOVE THIS, CODE, THAT IS INSIDE

:MAIN_6014
00D6: if 
0491:   actor $PLAYER_ACTOR has_weapon 46 
004D: jump_if_false @MAIN_6088 
0926: $712 = external_script_status 0 (PLAYER_PARACHUTE) 
00D6: if 
0038:   $712 == 0 
004D: jump_if_false @MAIN_6081 
08A9: load_external_script 0 (PLAYER_PARACHUTE) 
00D6: if 
08AB:   external_script 0 (PLAYER_PARACHUTE) loaded 
004D: jump_if_false @MAIN_6081 
0913: run_external_script 0 (PLAYER_PARACHUTE)  

:MAIN_6081
0002: jump @MAIN_6092 



...


//------------- External script 20 (HOME_BRAINS) ---------------

:HMLES //replace everything from the "EXTERNAL SCRIPT 20" comment to the "EXTERNAL SCRIPT 21" comment by this code
03A4: name_thread 'HMLES'
0001: wait 0 ms

//your scripts here.
//need to have its source to add.
//:Label scripts should be connected:

//:Label
//	START OF SCRIPT
//:Label0
//	END OF SCRIPT
//jump @Label1
//	START OF OTHER SCRIPT
//:Label1
//	END OF OTHER SCRIPT
//jump @Label
//end_thread

//Remove all wait 0 at the beginning of the scripts before :Label, except wait 0 after name_thread 'HMLES'.

//if some scripts are cyclic and more than 1,
//then merge everything :Label into one cyclic chain, and put after the usual scripts, before end_thread

004E: end_thread

//------------- External script 21 (POOL_SCRIPT) ---------------



...

After that, your script will support saves

 

 

 

 

The author of the solution is Megafox (before MegaFirefox)
https://vk.com/megafirefox
https://gtaforums.com/profile/1143658-user1592591/

 

Tested on Android mainV1.scm, PC main.scm.

Edited by user1592591

Share this post


Link to post
Share on other sites
Light Syde Riandy

@VENEZUELA Z

 

I hope this guide can eliminate the need to start over to find out which mission  in "San Andreas 2.0" is not working properly faster than ever.

Share this post


Link to post
Share on other sites
user1592591

Tell me who worked / did not work, it works for me, at least on Android

Share this post


Link to post
Share on other sites
ZAZ
Posted (edited)

Nice method :cookie:

Another way, bit more easier, replace the useless camera script

Just replace the conditional check:

:MAIN_4418
00D6: if and                                               <<<<<<  REPLACE
0491:   actor $PLAYER_ACTOR has_weapon 43                  <<<<<<  REPLACE
0038:   $ONMISSION == 0                                    <<<<<<  REPLACE
004D: jump_if_false @MAIN_4499
0926: $SCRIPT_STATUS = external_script_status 75 (CAMERA)
00D6: if
0038:   $SCRIPT_STATUS == 0
004D: jump_if_false @MAIN_4492
08A9: load_external_script 75 (CAMERA)
00D6: if
08AB:   external_script 75 (CAMERA) loaded
004D: jump_if_false @MAIN_4492
0913: run_external_script 75 (CAMERA)

 

WITH THIS:


 

00D6: if or
0491:   actor $PLAYER_ACTOR has_weapon 0
0491:   actor $PLAYER_ACTOR has_weapon 1

 

to get this :

 

:MAIN_4418
00D6: if or
0491:   actor $PLAYER_ACTOR has_weapon 0
0491:   actor $PLAYER_ACTOR has_weapon 1
004D: jump_if_false @MAIN_4499
0926: $SCRIPT_STATUS = external_script_status 75 (CAMERA)
00D6: if
0038:   $SCRIPT_STATUS == 0
004D: jump_if_false @MAIN_4492
08A9: load_external_script 75 (CAMERA)
00D6: if
08AB:   external_script 75 (CAMERA) loaded
004D: jump_if_false @MAIN_4492
0913: run_external_script 75 (CAMERA)

 

Then replace  External script 75 (CAMERA)
with your script

//-------------External script 75 (CAMERA)---------------

:CAMERA
03A4: name_thread 'CAMERA'

//your scripts here.

//-------------External script 76 (DEBT)---------------

 

 

 

 

 

 

 

 

P.S.

what could be the reason that the modified AMUNAT script doesn't work?

because it's more code inthere, than in the origin one?

 

 

 

 

 

 

 

Edited by ZAZ

Share this post


Link to post
Share on other sites
user1592591
5 hours ago, ZAZ said:

Nice method :cookie:

Another way, bit more easier, replace the useless camera script

Just replace the conditional check:

:MAIN_4418
00D6: if and                                               <<<<<<  REPLACE
0491:   actor $PLAYER_ACTOR has_weapon 43                  <<<<<<  REPLACE
0038:   $ONMISSION == 0                                    <<<<<<  REPLACE
004D: jump_if_false @MAIN_4499
0926: $SCRIPT_STATUS = external_script_status 75 (CAMERA)
00D6: if
0038:   $SCRIPT_STATUS == 0
004D: jump_if_false @MAIN_4492
08A9: load_external_script 75 (CAMERA)
00D6: if
08AB:   external_script 75 (CAMERA) loaded
004D: jump_if_false @MAIN_4492
0913: run_external_script 75 (CAMERA)

 

WITH THIS:


 

00D6: if or
0491:   actor $PLAYER_ACTOR has_weapon 0
0491:   actor $PLAYER_ACTOR has_weapon 1

 

to get this :

 

:MAIN_4418
00D6: if or
0491:   actor $PLAYER_ACTOR has_weapon 0
0491:   actor $PLAYER_ACTOR has_weapon 1
004D: jump_if_false @MAIN_4499
0926: $SCRIPT_STATUS = external_script_status 75 (CAMERA)
00D6: if
0038:   $SCRIPT_STATUS == 0
004D: jump_if_false @MAIN_4492
08A9: load_external_script 75 (CAMERA)
00D6: if
08AB:   external_script 75 (CAMERA) loaded
004D: jump_if_false @MAIN_4492
0913: run_external_script 75 (CAMERA)

 

Then replace  External script 75 (CAMERA)
with your script

//-------------External script 75 (CAMERA)---------------

:CAMERA
03A4: name_thread 'CAMERA'

//your scripts here.

//-------------External script 76 (DEBT)---------------

 

 

 

 

 

 

 

 

P.S.

what could be the reason that the modified AMUNAT script doesn't work?

because it's more code inthere, than in the origin one?

 

 

 

 

 

 

 

This script is based on cleared main.scm, so it will not work in saves. Code size is smaller than original.

Share this post


Link to post
Share on other sites
OrionSR

ZAZ's snippet looks like PC decompiled with the thread + local offset setting. I usually use the thread + global offset setting because it helps with things like relaunching threads with cleo or killing saved missions. I'm expecting things to work as described.

 

Useless camera script? Homies and girlfriends taking your picture? I'm not sure if I've ever tried that. I remember reading about it way back when but forgot about it completely.

 

Share this post


Link to post
Share on other sites
ZAZ
6 hours ago, user1592591 said:

This script is based on cleared main.scm, so it will not work in saves. Code size is smaller than original.

 

I'm talking about the Extern script AMUNAT

I posted it embedded in a stripped main at pastebin , so you can test it first to see that you can buy Rocketlauncher, Minigun and Firethrower

 

Then of course copy only the Extern script AMUNAT and replace the original one of originally main.scm

 

 

4 hours ago, OrionSR said:

Useless camera script? Homies and girlfriends taking your picture? I'm not sure if I've ever tried that. I remember reading about it way back when but forgot about it completely.

it's glitchy , you'll get a bad picture because of a bad view

i'm shure that nobody need it

 

Share this post


Link to post
Share on other sites
Light Syde Riandy
On 3/15/2019 at 5:59 AM, user1592591 said:

Tell me who worked / did not work, it works for me, at least on Android

What?

Share this post


Link to post
Share on other sites
user1592591
7 hours ago, Light Syde Riandy said:

What?

Sorry, Google Translate translated incorrectly. I meant, does my method work for you?

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.

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.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.