GTA SA Main.scm coding Tutorial / english

startup for newbies

  1. Download newest version of Sannybuilder from Seeman at
  3. Install Sannybuilder and create a folder for your scripts
    Therefor youre promt to indicate your GTASA-Install dir.
  4. Then start Sannybuilder and open main.scm of GTA SA game installation
  5. find it in GTA SA install dir\data\script
  6. main.scm and script.img will be decomplied then as one big source text
    save this source text as orig-main.txt in your work folder

    (how to use buttons and functions of the editor can you read in the lesson about editor and help)
  7. don't be scared because of miles of text,
    we remove the total content and work with a stripped main
  8. then adding content step by step
  9. so open now a NEW blank page and copy the script of the first lesson below
    and paste it into the NEW Sannybuilder page
  10. Save it in your work folder and give it a name.
  11. Compile the script. Click on menue icon with "running man" (F7) to choose compile + copy
  12. The script will be compiled as main.scm and copied into GTASA\data\script - folder
  13. As TotalStrippedMain.txt saved and compiled as main.scm

  14. If the compiling process was successful you get then a report message
  15. click on OK to confirm
    At the top it shows the files size of the main part of main.scm and the limit
  16. then the size of the largest mission script and the limit of mission scripts
    then the size of the largest of other scripts
  17. Test now the script ingame, start a new game!

  18. I. use stripped main

    This is a total stripped main, copy and paste the script below into a new empty page of sannybuilder,
    then run the function "compile+copy" and test it ingame,
    but don't forget to backup first your current main.scm
    and don't forget: you must start a new game!

    DEFINE OBJECT (dummyobject) // This is an unused object. You can put anything here.
    03A4: name_thread 'MAIN'
    016A: fade  0 (in)  0 ms
    042C: set_total_missions_to  0
    030D: set_total_mission_points_to  0
    01F0: set_max_wanted_level_to  6
    0111: set_wasted_busted_check_to  0 (disabled)
    00C0: set_current_time  23  0
    04E4: unknown_refresh_game_renderer_at  2494.5 -1668.5
    03CB: set_camera  2494.5 -1668.5 13.4
    0053: $PLAYER_CHAR = create_player #NULL at  2494.5 -1668.5 13.4
    07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
    01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR
    0173: set_actor $PLAYER_ACTOR z_angle_to  7.0
    0373: set_camera_directly_behind_player
    070D: $PLAYER_CHAR
    0629: change_stat  181 (islands unlocked) to  4  // integer see statdisp.dat
    01B6: set_weather  1
    04BB: select_interior  0  // select render area
    01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
    01B7: release_weather
    016C: restart_if_wasted at  2494.5 -1668.5 13.4 angle  180.0 unknown  0
    016D: restart_if_busted at  2494.5 -1668.5 13.4 angle  180.0 unknown  0
    016A: fade  1 (out)  1000 ms
    0001: wait  100 ms
    03E6: remove_text_box
    0180: set_on_mission_flag_to $ONMISSION // Note: your missions have to use the variable defined here
    0001: wait 2500 ms
    0002: jump @MAIN_3


    these are the codes to create the Player_Actor in Gameworld as well as initialising game rendering at spawn location

    04E4: unknown_refresh_game_renderer_at 2494.5 -1668.5 // only X, Y coords
    03CB: set_camera 2494.5 -1668.5 13.4 // X, Y, Z coords

    0053: $PLAYER_CHAR = create_player #NULL at 2494.5 -1668.5 13.4 // X, Y, Z coords
    0173: set_actor $PLAYER_ACTOR z_angle_to 7.0 // z-angle

    Use Coords Manager to read the current player position while game is running in background (when ingame: go to main menue, then press ALT+TAB)
    and change the coords to spawn player at another location


    next lesson >> II. add code to stripped main