Welcome Guest [Log In] [Register]
Welcome to Gtamixmods. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
How to create your own cutscenes..; By Sanny Builder
Topic Started: Oct 7 2012, 11:53 AM (303 Views)
arijitsen

The basic method for scripted cutscenes:
fade in
load, create and arrange stuff
enable widescreen
set camera
fade out


try the simple example below
press backspace to show player with mobile phone
Code:
 
{$CLEO .cs}
:CUTSCENE_Template
03A4: name_thread 'CUTSCEN'

:CUTSCEN_11
wait 0
if
0256: player $PLAYER_CHAR defined
jf @CUTSCEN_11
if
0AB0: key_pressed 8 // press Backspace
jf @CUTSCEN_11
0247: load_model #CELLPHONE

:CUTSCEN_13
wait 0
if
0248: model #CELLPHONE available
jf @CUTSCEN_13

01B4: set_player $PLAYER_CHAR can_move 0
fade 0 1000
wait 1000
0729: AS_actor $PLAYER_ACTOR hold_cellphone 1
067C: put_camera_on_actor $PLAYER_ACTOR with_offset 0.0 1.5 0.6 rotation 0.0 0.2 0.6 0.0 2
02A3: enable_widescreen 1
wait 250
fade 1 1500
33@ = 0 // reset timer

:CUTSCEN_25
wait 0
if
0256: player $PLAYER_CHAR defined
jf @CUTSCEN_25
if or
33@ > 5000// check timer if 5 seconds are passed
00E1: player 0 pressed_key 14
00E1: player 0 pressed_key 15
00E1: player 0 pressed_key 17
00E1: player 0 pressed_key 6
jf @CUTSCEN_25
jump @CUTSCEN_cleanup

:CUTSCEN_cleanup
0729: AS_actor $PLAYER_ACTOR hold_cellphone 0
fade 0 500
wait 500
02A3: enable_widescreen 0
fade 1 1500
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: set_player $PLAYER_CHAR can_move 1
jump @CUTSCEN_11


the variable 32@ and 33@ are reserved as internal timer
try the little script below to understand
press Backspace to reset timer
Code:
 
{$CLEO .cs}
thread 'timer'
while true
wait 0
03F0: enable_text_draw 1
045A: draw_text_1number 300.0 200.0 GXT 'NUMBER' number 33@ // ~1~
if
0AB0: key_pressed 8 // press Backspace
then
33@ = 0
end
end



Example for a cutscene with talking actor
Go into red marker in Grovestreet
Code:
 
{$CLEO .cs}
:CUTSCENE_Template
03A4: name_thread 'CUTSCEN'
0@ = 0

:CUTSCEN_11
wait 0
if
0256: player $PLAYER_CHAR defined
jf @CUTSCEN_11
if
0@ == 0// check for a var to let the cutscene only run for one time
jf @CUTSCEN_11
if
00FE: actor $PLAYER_ACTOR sphere 1 in_sphere 2480.134 -1665.475 13.3348 radius 3.5 3.5 5.5
jf @CUTSCEN_11
00BA: show_text_styled GXT 'LG_37' time 1000 style 2
023C: load_special_actor 'TRUTH' as 1 // models 290-299
04ED: load_animation "GHANDS"

:CUTSCEN_12
wait 0
if and
023D: special_actor 1 loaded
04EE: animation "GHANDS" loaded
004D: jump_if_false @CUTSCEN_12

0247: load_model #spraycan

:CUTSCEN_13
wait 0
if
0248: model #spraycan available
jf @CUTSCEN_13

01B4: set_player $PLAYER_CHAR can_move 0
fade 0 1000
wait 1000
009A: 10@ = create_actor_pedtype 24 model #SPECIAL01 at 2477.5356 -1663.0228 13.3359
060B: set_actor 10@ decision_maker_to 32
01B2: give_actor 10@ weapon 41 ammo 9000 // Load the weapon model before using this
02E2: set_actor 10@ weapon_accuracy_to 100
0639: AS_actor 10@ rotate_to_actor $PLAYER_ACTOR
067C: put_camera_on_actor 10@ with_offset 0.0 1.5 0.6 rotation 0.0 0.2 0.6 0.0 2
02A3: enable_widescreen 1
wait 1500
fade 1 1500
054C: use_GXT_table 'GARAGE1'
33@ = 0 // reset timer
0@ = 1

:CUTSCEN_25
wait 0
if
0256: player $PLAYER_CHAR defined
jf @CUTSCEN_cleanup
if or
33@ > 10000// check timer if 10 seconds are passed
00E1: player 0 pressed_key 14
00E1: player 0 pressed_key 15
00E1: player 0 pressed_key 17
00E1: player 0 pressed_key 6
jf @CUTSCEN_31
jump @CUTSCEN_cleanup


:CUTSCEN_31
if
0@ == 1
jf @CUTSCEN_33
0812: AS_actor 10@ perform_animation "gsign1" IFP_file "GHANDS" 8.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB
7@ = 16484
gosub @CUTSCEN_dialoque_sound_SUB
0967: actor 10@ move_mouth_for 2000 ms
00BC: show_text_highpriority GXT 'GAR1_NE' time 5000 flag 1
33@ = 0 // reset timer
0@ = 2
jump @CUTSCEN_25


:CUTSCEN_33
if and
0@ == 2
33@ > 3000
jf @CUTSCEN_35
0812: AS_actor 10@ perform_animation "IDLE_chat" IFP_file "ped" 8.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB
7@ = 16486
gosub @CUTSCEN_dialoque_sound_SUB
0967: actor 10@ move_mouth_for 3000 ms
00BC: show_text_highpriority GXT 'GAR1_NG' time 5000 flag 1
33@ = 0 // reset timer
0@ = 3
jump @CUTSCEN_25


:CUTSCEN_35
if and
0@ == 3
33@ > 3000
jf @CUTSCEN_37
0812: AS_actor 10@ perform_animation "gsign1" IFP_file "GHANDS" 8.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB
7@ = 16487
gosub @CUTSCEN_dialoque_sound_SUB
0967: actor 10@ move_mouth_for 5000 ms
00BC: show_text_highpriority GXT 'GAR1_NH' time 5000 flag 1
33@ = 0 // reset timer
0@ = 4
jump @CUTSCEN_25

:CUTSCEN_37
if and
0@ == 4
33@ > 5000
jf @CUTSCEN_39
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.9
0668: AS_actor 10@ rotate_and_shoot_at 11@ 12@ 13@ 1000 ms
33@ = 0 // reset timer
0@ = 5
jump @CUTSCEN_25

:CUTSCEN_39
if and
0@ == 5
33@ > 1000
jf @CUTSCEN_25
0@ = 6
jump @CUTSCEN_cleanup


:CUTSCEN_cleanup
fade 0 1000
wait 1000
04EF: release_animation "GHANDS"
02A3: enable_widescreen 0
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
009B: destroy_actor 10@
fade 1 2000
01B4: set_player $PLAYER_CHAR can_move 1
jump @CUTSCEN_11




:CUTSCEN_dialoque_sound_SUB
040D: unload_wav 1
03CF: load_wav 7@ as 1

:CUTSCEN_dialoque_sound_1
wait 0
if
03D0: wav 1 loaded
jf @CUTSCEN_dialoque_sound_1
0949: link_wav 1 to_actor 10@
03D1: play_wav 1
return


Subdivide the main loop into sequences
1. check for a var value
2. check for timer value
read the comments
Code:
 
:CUTSCEN_25
wait 0
if
0256: player $PLAYER_CHAR defined
jf @CUTSCEN_cleanup



:CUTSCEN_31// sequence 1
if
0@ == 1 // check for var value of 0@ to let the code pass to read the sequence codes
jf @CUTSCEN_33
0812: AS_actor 10@ perform_animation "gsign1" IFP_file "GHANDS" 8.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB
7@ = 16484
gosub @CUTSCEN_dialoque_sound_SUB
0967: actor 10@ move_mouth_for 2000 ms
00BC: show_text_highpriority GXT 'GAR1_NE' time 5000 flag 1
33@ = 0 // reset timer
0@ = 2 // change var value
jump @CUTSCEN_25


:CUTSCEN_33// sequence 2
if and
0@ == 2 // check for var value of 0@ to let the code pass to read the sequence codes
33@ > 3000 // ckeck if 3 seconds are passed, since the previous sequence has been started
jf @CUTSCEN_35
0812: AS_actor 10@ perform_animation "IDLE_chat" IFP_file "ped" 8.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB
7@ = 16486
gosub @CUTSCEN_dialoque_sound_SUB
0967: actor 10@ move_mouth_for 3000 ms
00BC: show_text_highpriority GXT 'GAR1_NG' time 5000 flag 1
33@ = 0 // reset timer
0@ = 3 // change var value
jump @CUTSCEN_25


:CUTSCEN_35// sequence 3
if and
0@ == 3 // check for var value of 0@ to let the code pass to read the sequence codes
33@ > 3000 // ckeck if 3 seconds are passed, since the previous sequence has been started
jf @CUTSCEN_37
0812: AS_actor 10@ perform_animation "gsign1" IFP_file "GHANDS" 8.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB
7@ = 16487
gosub @CUTSCEN_dialoque_sound_SUB
0967: actor 10@ move_mouth_for 5000 ms
00BC: show_text_highpriority GXT 'GAR1_NH' time 5000 flag 1
33@ = 0 // reset timer
0@ = 4 // change var value
jump @CUTSCEN_25

:CUTSCEN_37// sequence 4
if and
0@ == 4 // check for var value of 0@ to let the code pass to read the sequence codes
33@ > 5000 // ckeck if 5 seconds are passed, since the previous sequence has been started
jf @CUTSCEN_39
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.9
0668: AS_actor 10@ rotate_and_shoot_at 11@ 12@ 13@ 1000 ms
33@ = 0 // reset timer
0@ = 5 // change var value
jump @CUTSCEN_25

:CUTSCEN_39// sequence 5
if and
0@ == 5 // check for var value of 0@ to let the code pass to read the sequence codes
33@ > 1000 // ckeck if 1 seconds are passed, since the previous sequence has been started
jf @CUTSCEN_25
0@ = 6 // change var value
jump @CUTSCEN_cleanup


Instead of manually checking if the keys are pressed for cutscene skip, just use the appropriate commands? 0707 0701

You can make it skip to a different label if you need to do extra things in case the cutscene was skipped (e.g. if the player was walking somewhere in the cutscene, teleport him instantly) and also remember to free any loaded models, animations etc. (these should be loaded before the cutscene skip and removed after it as the cutscene can be skipped at any time during it's progress).

I hope that it helps you ..
Remember to give your useful comments guys.. ;D
Offline Profile Quote Post Goto Top
 
The_Sorrow
Administrator
Very good tutorial :P
Offline Profile Quote Post Goto Top
 
arijitsen

Thanks I ll post some more as soon I get some time..
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Coding lounge · Next Topic »
Add Reply

Black Water created by tiptopolive of the Zetaboards Theme Zone