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

[VC]Help with a simple SCM mission


NicusorN5
 Share

Recommended Posts

Hello. I need some help with the mission code I made.
 

:INITIAL_A
/*1st cutscene
*/
//load actor
1@ = 0
01B4: set_player $PLAYER_CHAR frozen_state 0
$PLAYER_CHAR.CanMove = False 
while 823D:not special_actor 20 loaded 
wait 1
023C: load_special_actor 20 'BURGER' 
end
Actor.Create(2@,CivMale,#SPECIAL20,420.1907,90.274,11.2881)
//start cutscene
02A3: enable_widescreen 1 
wait 1000
//first dialog
0372: set_actor $PLAYER_ACTOR anim 19 wait_state_time 2000 ms 
Actor.Angle(2@) = 218.4445
Actor.Angle($PLAYER_ACTOR) = 40.0
015F: set_camera_position 417.9948 87.6003 12.4301 0.0 rotation 0.0 0.0 
Camera.PointAt(421.0572,88.7748,11.2801,2)
054C: use_GXT_table 'INTRO'
00BB: text_lowpriority 'DIALOG1' 2000 ms 1 
wait 2000
//second dialog
015F: set_camera_position 423.3226 91.6754 12.5067 0.0 rotation 0.0 0.0 
Camera.PointAt(420.1907,90.274,11.2881,2)
0372: set_actor 2@ anim 19 wait_state_time 2000 ms 
00BB: text_lowpriority 'DIALOG2' 2000 ms 1
wait 2000
//third dialog
015F: set_camera_position 424.1574 87.4424 12.2591 0.0 rotation 0.0 0.0 
Camera.PointAt(421.0572,88.7748,11.2801,2)
052B: actor $PLAYER_ACTOR hold_cellphone 1 
00BB: text_lowpriority 'OBJ1' 1000 ms 1
wait 1000
00BB: text_lowpriority 'DIALOG3' 2000 ms 1
wait 2000
00BB: text_lowpriority 'DIALOG4' 2000 ms 1
wait 2000
052B: actor $PLAYER_ACTOR hold_cellphone 0 
wait 1500
0372: set_actor $PLAYER_ACTOR anim 19 wait_state_time 2000 ms 
00BB: text_lowpriority 'DIALOG5' 2000 ms 1
015F: set_camera_position 423.3226 91.6754 12.5067 0.0 rotation 0.0 0.0 
Camera.PointAt(420.1907,90.274,11.2881,2)
wait 2000
Camera.Restore() 
02A3: enable_widescreen 0
01B4: set_player $PLAYER_CHAR frozen_state 1
$PLAYER_CHAR.CanMove = True
wait 0
1@ = 1
//end cutscene
//start first objective : enter a car
00BB: text_lowpriority 'OBJ2' 2000 ms 1
Model.Load(#ADMIRAL)
038B: load_requested_models 
Car.Create(3@,#ADMIRAL,428.2926 66.0054 10.9891)
Car.Angle(3@) = 308.3486
Marker.CreateAboveCar(4@,3@)
while true 
wait 0
    6@ = Car.Health(3@)
    if 00DC:   player $PLAYER_CHAR driving 3@ 
    then
        if 1@ == 1
        then   
            //start second objective : drive to the club 
            00BB: text_lowpriority 'OBJ3' 2000 ms 1
            Marker.Disable(4@)
            02A7: 5@ = create_icon_marker_and_sphere 20 at 97.0645 -1470.8845 10.4318
            //0168: set_blip $marker2 size 3 
            1@ = 2
        end
    end
    if 6@ < 200
    then
        gosub @INITIAL_B 
        break
    end  
    if 0101:   actor $PLAYER_ACTOR stopped_near_point 97.0645 -1470.8845 10.4318 radius 3.0 3.0 1.5 sphere 0 
    then
        if 1@ == 2
        then
            Marker.Disable(4@)
            03BD: destroy_sphere 4@
            0164: disable_marker 4@
            Actor.DestroyWithFade(2@)
            0296: unload_special_actor 20 
            $missionspassed = 1
            01E3: text_1number_styled 'M_PASS' number 0 time 6000 style 3
            0394: play_music 1  
            1@ = 3
            break
        end
    end
end
return

:INITIAL_B
00BA: text_styled 'M_FAIL' 2000 ms 5
02a7: $initialmissmar create_icon_marker_and_sphere 19 at 421.1947 88.5849 11.2764
$missionspassed = 0
$onmission_alt = 0
return

:INITIAL_C
03BD: destroy_sphere 4@
0164: disable_marker 4@
03BD: destroy_sphere 5@
0164: disable_marker 5@
mission_cleanup
$ONMISSION = 0
return

The code does not create any crashes, BUT when I fail it nothing happends.

Edited by NicusorN5
Script updated again.
Link to comment
Share on other sites

I just realised I posted this into the wrong board. Please any mod move this thread.

Link to comment
Share on other sites

spaceeinstein

Try to minimize your use of global variables and use local variables instead. Sanny Builder allows you to assign local variables to a name so that it's easier to keep track of them. For example:

const
car1 = [email protected]
marker1 = [email protected]
// etc...
end

// ...

Car.Create(car1,#ADMIRAL,428.2926 66.0054 10.9891)
Car.Angle(car1) = 308.3486
Marker.CreateAboveCar(marker1,car1)

 

Your line "while 8112:   not wasted_or_busted" will not work as you expect. Your line "if 0112:wasted_or_busted" uses a specialized opcode that allows the game to persistently check if you are wasted or busted so you don't need to repeat using that opcode anywhere else. Once you are wasted or busted, the game will break away from whatever it is doing in the script and automatically jump to label "INITIAL_B" for you.

Edited by spaceeinstein
Link to comment
Share on other sites

So if I use 'while true' in :INITIAL_A it will still break if i get arrested or busted? Also if I exceed the local variables number, what will happen?

Edited by NicusorN5
Link to comment
Share on other sites

[BUMP] I got the problem with the :INITIAL_B and :INITIAL_C not beign called. But the second sphere won't show up. EDIT: Script updated again. Icon marker does show up.

            02A7: 5@ = create_icon_marker_and_sphere 20 at 97.0645 -1470.8845 10.4318
            0168: set_blip 5@ size 3 

^ 5 @ is the sphere. It only shows up if $ONMISSION is 0.

Edited by NicusorN5
Link to comment
Share on other sites

spaceeinstein

Do you plan to make a very large script? You can reuse local variables if needed. Assigning local variables to constant names makes them easier to manage. Here's my example of reusing local variables multiple times, even taking advantage of bitwise operations in CLEO to squeeze more uses out of the limited number of local variables. If you must need to use global variables, you have to make sure your global variable numbers have no conflict with any other scripts. When Sanny Builder compiles $variable and it doesn't exist in CustomVariables.ini, it uses the next smallest number available in the current file, e.g. $123. When you decompile your compiled script, you can see exactly what number it compiled as.

 

Your initial edit with the first 0112 was correct, it was your second use of 0112 that was incorrect. It only needs to be used once. For example:

:simple_mission
0050: gosub @simple_mission_begin
if
    0112:   wasted_or_busted // only use once here
    // This allows the game to persistently check for wasted/busted and when it does happen, the game stops whatever the script is doing and gosub to simple_mission_failed automatically.
then
    0050: gosub @simple_mission_failed
end
0050: gosub @simple_mission_cleanup
004E: end_thread

:simple_mission_begin
// Place the contents of your mission
// No need to check for any wasted/busted scenarios here
0051: return

:simple_mission_failed
// Died or got busted during your mission
// You can jump to this section of your code from simple_mission_begin, but don't gosub into this from there.
0051: return

:simple_mission_cleanup
// Clean up the contents of your mission so you can end it
$ONMISSION = 0
00D8: mission_cleanup
0051: return
Edited by spaceeinstein
  • Like 2
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.