Jump to content

Tutorial - Animations for Custom Cut Scenes


JAB HacksouL

Recommended Posts

I will be using Sanny as the editor compiler. I will try to stick with the original SASCM.

Part 1 - Getting the Stripped SCM Set Up.

Load up the stripped MAIN.SCM and edit yours to look like mine or you can cut and paste this code.

DEFINE MISSIONS 1
DEFINE MISSION 0 AT @MY_CUT01
DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA script
//DEFINE SCRIPT {NAME}  AT {LABEL} @
DEFINE UNKNOWN_EMPTY_SEGMENT 0
DEFINE UNKNOWN_THREADS_MEMORY 0

{$VERSION 3.0.0000}
var
$PLAYER_CHAR: Player
end // var 
03A4: name_thread 'MAIN' 
01F0: set_max_wanted_level_to 6 
0111: toggle_wasted_busted_check 0 
00C0: set_current_time_hours_to 8 minutes_to 0 
04E4: unknown_refresh_game_renderer_at 2488.56 -1666.84 
03CB: set_rendering_origin_at 2488.56 -1666.84 13.38 
0053: $PLAYER_CHAR = create_player #NULL at 2488.56 -1666.84 13.38 
01F5: $PLAYER_ACTOR = create_player_actor $PLAYER_CHAR 
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group 
0373: set_camera_directly_behind_player 
01B6: set_weather 0 
0001: wait 0 ms 
087B: set_player $PLAYER_CHAR clothes_texture "PLAYER_FACE" model "HEAD" body_part 1 
087B: set_player $PLAYER_CHAR clothes_texture "JEANSDENIM" model "JEANS" body_part 2 
087B: set_player $PLAYER_CHAR clothes_texture "SNEAKERBINCBLK" model "SNEAKER" body_part 3 
087B: set_player $PLAYER_CHAR clothes_texture "VEST" model "VEST" body_part 0 
070D: rebuild_player $PLAYER_CHAR 
01B4: toggle_player $PLAYER_CHAR can_move 1 
016A: fade 1 time 0 
04BB: select_interior 0 
0629: change_integer_stat 181 to 4 
016C: restart_if_wasted_at 2027.77 -1420.52 15.99 angle 137.0 town_number 0 
016D: restart_if_busted_at 1550.68 -1675.49 14.51 angle 90.0 town_number 0 
0180: set_on_mission_flag_to $ONMISSION 
0004: $DEFAULT_WAIT_TIME = 250
03E6: remove_text_box 

02A7: $Marker_Mission = create_icon_marker_and_sphere 47 at 2516.2034 -1671.8353 13.839
$ONMISSION = 0

:MAIN_LOOP
0001: wait $DEFAULT_WAIT_TIME ms
00BF: $TIME_HOURS = current_time_hours, $TIME_MINS = current_time_minutes

00D6: if and
0038:   $ONMISSION == 0 
00ED:   actor $PLAYER_ACTOR 0 near_point 2516.2034 -1671.8353 radius 1.0 1.0 on_foot 
004D: jump_if_false @MAIN_MISSION_END
016A: fade 0 time 200
0001: wait 500 ms 
0417: start_mission 0 
:MAIN_MISSION_END

0002: jump @MAIN_LOOP

Part 2 - Creation of the Cut Scene Mission

At the very bottom we add the new thread:

:MY_CUT01
03A4: name_thread 'MY_CUT01'
$ONMISSION = 1

The $ONMISSION = 1 line shuts down that start mission. Next we initialize some variables and load some models.

Now we add this:

:MY_CUT01_100 //Initialize Cut Scene

Model.Load(#BFYPRO)
Model.Load(#BMYPIMP)
038B: load_requested_models

This loads up 2 ped models the BFYPRO is short for Black Female Young PROstitue. I shouldn't have to tell you what the BMYPIMP is then correct?

:MYCUT01_110
0001: wait 0 ms
if and
Model.Available(#BFYPRO)
Model.Available(#BMYPIMP) 
jf @MYCUT01_110

This checks to see the models have loaded yet. JF means jump if false.

01EB: set_traffic_density_multiplier_to 0.0 
03DE: set_pedestrians_density_multiplier_to 0.0 
0395: clear_area 1 at 2487.355 -1646.4497 14.0703 radius 20.0

This clears up any traffic and people in a radius of 20 meters and the first two shuts down the generators.

Actor.Create($The_Woman, 5, #BFYPRO, 2487.355, -1646.4497, 14.0703)
Actor.Angle($The_Woman) = 161.5
Actor.Create($The_Man, 5, #BMYPIMP, 2470.8086 -1650.4838 13.4721)
Actor.Angle($The_Man) = 270.0
067C: put_camera_on_actor $The_Man with_offset 1.5 1.5 -0.5 rotation 0.0 0.0 0.0 0.0 2 
05D3: AS_actor $The_Man goto_point 2486.3293 -1650.4094 13.481 mode 4 -1 ms

Now we create and position the actors on the set. The 5th line sets the camera on the male and travels with him at the offset. The 6th line tells the male actor to walk to a given x y z location. The -1 in milliseconds is telling him to take his time.

02A3: enable_widescreen true 
016A: fade 1 time 1000 
0001: wait 1300 ms

We make the wide screen effect and turn up the lights. Notice my wait time is longer than the fade time? Safety margin.

:MYCUT01_120
0001: wait 0 ms 
if 
00ED:   actor $The_Man 0 near_point 2486.3293 -1650.4094 radius 1.0 1.0 on_foot
jf @MYCUT01_120

This loop waits for the man to come within 1 meter of his destination.

067C: put_camera_on_actor $The_Man with_offset 0.5 -3.0 0.0 rotation 0.0 0.0 0.0 0.0 2 
0A1D: AS_actor $The_Man rotate_to_and_look_at_actor $The_Woman
0A1D: AS_actor $The_Woman rotate_to_and_look_at_actor $The_Man
0605: actor $The_Man perform_animation_sequence "IDLE_CHAT" IFP_file "PED" 4.0 loop 0 0 0 0 time -1 
0605: actor $The_Woman perform_animation_sequence "WOMAN_IDLESTANCE" IFP_file "PED" 4.0 loop 0 0 0 0 time -1
05D3: AS_actor $The_Woman goto_point 2488.1172 -1655.0673 13.3429 mode 4 -1 ms

The next line shifts the position of the camera behind the man. The -3.0 offset is the key -y is behind. The two lines make both actors face each other. And the 4th line tells the man to wave his arms around looking like he is chatting (there is no audio). The last line tells the actress to be rude and ignore the man walking right past him.

:MYCUT01_130
0001: wait 0 ms 
if 
00ED:   actor $The_Woman 0 near_point 2488.1172 -1655.0673 radius 1.0 1.0 on_foot
jf @MYCUT01_130

This like the loop above waits for the woman to complete her stroll.

067C: put_camera_on_actor $The_woman with_offset 0.5 3.0 0.5 rotation 0.0 0.0 0.0 0.0 2 
0605: actor $The_Woman perform_animation_sequence "FUCKU" IFP_file "PED" 4.0 loop 0 0 0 0 time -1
04C4: store_coords_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 from_actor $The_Woman with_offset 0.0 1.0 0.0 
05D3: AS_actor $The_Man goto_point $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3 mode 4 -1 ms

The next line puts the camera focus on the woman. The second line makes her do a rude gesture to the man. And then code 04C4 will store an offset of the females coordinates to the temporary variables. The last line makes the male walk over to the woman.

:MYCUT01_140
0001: wait 0 ms 
if 
00ED:   actor $The_Man 0 near_point $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 radius 1.0 1.0 on_foot
jf @MYCUT01_140

I use these loops a lot they keep the action from happening all at once.

067C: put_camera_on_actor $The_woman with_offset 0.5 -1.0 0.0 rotation 0.0 0.0 0.0 0.0 2
05E2: AS_actor $The_Man kill_actor $The_Woman
05E2: AS_actor $The_Woman kill_actor $The_Man

We again change the angle of the camera and tell them to kill each other. If you need the outcome to be certain you will need to change the winners health higher than the losers. I didn't care so this fight is uncertain.

:MYCUT01_900
wait 0
if or
Actor.Dead($The_Man)
Actor.Dead($The_Woman)
jf @MYCUT01_900
02A3: enable_widescreen false
01EB: set_traffic_density_multiplier_to 1.0 
03DE: set_pedestrians_density_multiplier_to 1.0 
00D8: mission_cleanup 
004E: end_thread

And finally we wait for a winner and end the cut scene by cleaning it up and destroying the thread. I am attaching the working demo2.txt to this tutorial. I hopes this helps you understand the San Andreas mission code.

JAB B)

demo2.zip

BTW further testing of this demo script has shown that once in awhile a cop will interfere with the cut scene (at least on my PC) the pimp and his ho will beat the cop to death then continue the scene.

Edited by JAB HacksouL
Link to comment
Share on other sites

Sweet! It really works, I could code a cutscene in Sanny! :D

Edit:

I also made some changes to the code, find them for yourself!

You lose control of your cut scene by adding the random pedestrians back into it. The idea behind a cut scene is the action must play out the same each time you view it. That was the problem with my cut scene above. The policeman shows up and gets involved in the fight. If he kills both of them the cut scene won't end.

These lines are added to clear the block so you don't get random interference.

01EB: set_traffic_density_multiplier_to 0.0
03DE: set_pedestrians_density_multiplier_to 0.0
0395: clear_area 1 at 2487.355 -1646.4497 14.0703 radius 80.0

Notice I changed the 3rd line to 80.0? This will keep out anyone within 80 meters.

Setting these first two lines higher as you did won't create more than the program will allow.

01EB: set_traffic_density_multiplier_to 5000.0 
03DE: set_pedestrians_density_multiplier_to 5000.0

It was nice try. I myself made a forced ped spawner and it froze and crashed the game after too many were spawned. This also is the same for vehicles. Try this for example, stand in the center of a busy street. Pop tires on all the cars you see but remain in the area. When cars stop showing up that is the limit of cars the program allows. This is why you cannot have a lot filled bumper to bumper with cars.

It seems to cap off at 1.0 so 5000 won't create 5000 times more peds (I have tried) It works on a percentage basis 1 = 100% and 0.01 = 1% Even at zero it seems to still spawn a few peds.

IF you desire the pimp to win the fight set his health to 99999 or if you desire his ho to win set her health to 99999 but not both or the fight will last a very long time.

I'm glad you took the time to study the code and are at least trying to expand the limits (unlike the rest of you slackers) that is why I posted the tutorial. I have school in the morning so I got to get some sleep... like I don't get enough sleep in school.

JAB B)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...