Aller au contenu


Photo
- - - - -

Tutoriaux


  • Ce sujet est fermé Ce sujet est fermé
20 réponses à ce sujet

#21 midtownmad

midtownmad

    The Godfather

  • MacreaBoss
  • PipPipPipPipPipPip
  • 3174 messages

Posté 04 April 2007 - 05:19 PM

Créér un saut en parachute


Ce tutoriel est à la porté d'un codeur SCM moyen, il est vivement conseillé d'avoir réalisé les tutoriels précédents.

1. Présentation et objectifs
Vous me direz, c'est plutôt simple de créer un saut en parachute, vous donner un parachute au joueur et vous le faites apparaitre en hauteur pour qu'il tombe. Et bien non, vous aurez beau essayer comme ca, ca ne marchera pas !

Voilà ce que ca donne quand on spawn en l'air le joueur et qu'on lui donne un parachute : Le joueur marche en l'air et s'écrase par terre, impossible d'ouvrir le parachute ou quoi que ce soit !


2. Donner le parachute au joueur

Ici, nous allons donner le parachute au joueur, ce qui n'est pas compliqué, mais il fallait y penser. Nous allons donner une arme nommé "GUN_PARA" (parachute arme). Pour ceci, il faut charger le modèle de l'arme puis la donner au joueur. On prend un main basic, et on rajoute un nouveau label :

Code
:Label_2
Model.Load(#GUN_PARA)
038B: load_requested_models
01B2: give actor $PLAYER_ACTOR weapon 46 ammo 1

Mais comment fait-on pour savoir quel modèle il faut charger, et quel numéro correspond à quel arme ? On utilises tout simplement la documentation SCM et en cherchant un tout petit peu, on trouve : 46 371 #gun_para
Le numero d'arme est 46 et le modèle 3D est #gun_para

Notre joueur ne tombe plus les mains vide, mais désormais avec son parachute, dommage qu'il ne puisse pas l'ouvrir !

3. Script parachute

Dans le main original, le parachute est un script externe, nous allons intégrer à notre main basic ce script externe mais il ne sera plus externe, il sera directement dans le main. Voilà comment nous allons procéder :
  • Définir les deux objets qui seront utilisés dans le script.
  • Créér un label pour le script
  • Inserer le script
Pour définir les objets, ce ne sera pas très dificile, il suffit d'ajouter 2 lignes et de modifier une valeur :
Code
DEFINE OBJECTS 3
DEFINE OBJECT (noname)
DEFINE OBJECT PARACHUTE                
DEFINE OBJECT PARA_COLLISION


Ensuite, il nous faut créér un label pour le script, le problème c'est qu'il faut que le script du parachute soit lu mais aussi que le script ou on donne le parachute soit lu.

On va utiliser la fonction Create_thread @Labelx qui permet de lire plusieurs labels en même temps, grâce à cette fonction vous pourrez faire lire au jeu 2 labels en même temps, le label après "Create thread" et le label indiqué dans le create thread. On placera donc cette fonction juste avant le label ou on donne le parachute

Code
create_thread @PLCHUTE

:Label_2
Model.Load(#GUN_PARA)
038B: load_requested_models
01B2: give actor $PLAYER_ACTOR weapon 46 ammo 1
fade 1 3000
004E: end_thread


On à donc le code entier suivant :

CODE
DEFINE OBJECTS 3
DEFINE OBJECT (noname)
DEFINE OBJECT PARACHUTE
DEFINE OBJECT PARA_COLLISION

DEFINE MISSIONS 0
DEFINE EXTERNAL_SCRIPTS -1 // Use -1 in order not to compile AAA script
DEFINE UNKNOWN_EMPTY_SEGMENT 0
DEFINE UNKNOWN_THREADS_MEMORY 0

//-------------MAIN---------------
03A4: name_thread 'MAIN'
042C: set_total_missions_to 0
030D: set_total_mission_points_to 187
0997: (unknown) 1339
01F0: set_max_wanted_level_to 0
0111: set_wasted_busted_check_to 0
00C0: set_current_time 10 0
016A: fade 0 10 ms
01B6: set_weather 3
04BB: select_interior 0
04E4: unknown_refresh_game_renderer_at 0.0 0.0 300.0
03CB: set_camera 0.0 0.0 300.0
0053: $PLAYER_CHAR = create_player #NULL at 0.0 0.0 300.0

:Label_1
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR
0373: set_camera_directly_behind_player
0173: set_actor $PLAYER_ACTOR z_angle_to 262.0
0001: wait 100
087B: set_player $PLAYER_CHAR clothes "VEST" "VEST" body_part 0
087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS" body_part 2
087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER" body_part 3
087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD" body_part 1
070D: build_player $PLAYER_CHAR
016C: restart_if_wasted at 2027.77 -1420.52 15.99 angle 137.0 unknown 0
016D: restart_if_busted at 1550.6801 -1675.49 14.51 angle 90.0 unknown 0
create_thread @PLCHUTE

:Label_2
Model.Load(#GUN_PARA)
038B: load_requested_models
wait 100
01B2: give actor $PLAYER_ACTOR weapon 46 ammo 1
fade 1 3000
004E: end_thread


Il nous suffit maintenant d'ajouter le script du parachute (dont le premier label s'apellera PLCHUTE puisque c'est le nom donné dans le create thread)
Le code est celui-ci : (il est long et compliqué, pas la peine de tout comprendre, moi même je ne comprends pas tout)

CODE
:PLCHUTE
03A4: name_thread 'PLCHUTE'
0004: $1498 = 0
0004: $1513 = 0
0004: $1497 = 0
0005: $1500 = 5.0
0005: $1501 = -5.0
0005: $1503 = -1.5
0005: $1504 = -30.0
0005: $1505 = 32.0
0005: $1506 = 0.0
0004: $1512 = 0
0004: $1513 = 0

:PLCHUTE_100
0001: wait 0 ms
0819: 7@ = actor $PLAYER_ACTOR distance_from_ground
00A0: store_actor $PLAYER_ACTOR position_to $69 $70 $71
00D6: if and
0020: 7@ > 50.0
80DF: NOT actor $PLAYER_ACTOR driving
8118: not actor $PLAYER_ACTOR dead
83EE: NOT player $PLAYER_CHAR controllable
004D: jump_if_false @PLCHUTE_100

:PLCHUTE_118
0001: wait 0 ms
00D6: if
8118: not actor $PLAYER_ACTOR dead
004D: jump_if_false @PLCHUTE_5455
00D6: if
8800: not (unknown)
004D: jump_if_false @PLCHUTE_5455
00D6: if
8038: not $1513 == 0
004D: jump_if_false @PLCHUTE_176
0992: set_player $PLAYER_CHAR weapons_scrollable 0

:PLCHUTE_176
00D6: if
0018: $1497 > 0
004D: jump_if_false @PLCHUTE_219
00D6: if
8491: not actor $PLAYER_ACTOR has_weapon 46
004D: jump_if_false @PLCHUTE_219
0002: jump @PLCHUTE_5521

:PLCHUTE_219
00D6: if
0038: $1497 == 0
004D: jump_if_false @PLCHUTE_274
00D6: if
0491: actor $PLAYER_ACTOR has_weapon 46
004D: jump_if_false @PLCHUTE_274
0247: request_model #PARACHUTE
0004: $1497 = 1
0004: $1498 = 0

:PLCHUTE_274
00D6: if
0038: $1497 == 1
004D: jump_if_false @PLCHUTE_377
00D6: if
0248: model #PARACHUTE available
004D: jump_if_false @PLCHUTE_377
0107: 17@ = create_object #PARACHUTE at $TEMPVAR_X_COORD $TEMPVAR_Y_COORD $TEMPVAR_Z_COORD
069B: attach_object 17@ to_actor $PLAYER_ACTOR at_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0
0750: (unknown) 17@ 0
0004: $1497 = 2

:PLCHUTE_377
00D6: if and
0038: $1497 == 2
0038: $1513 == 1
004D: jump_if_false @PLCHUTE_409
0004: $1497 = 3

:PLCHUTE_409
00D6: if and
0038: $1513 == 0
0018: $1497 > 0
004D: jump_if_false @PLCHUTE_565
00D6: if
0818: (unknown) $PLAYER_ACTOR
004D: jump_if_false @PLCHUTE_565
083D: (unknown) $PLAYER_ACTOR $1507 $1508 $1509
00D6: if
0022: -10.0 > $1509
004D: jump_if_false @PLCHUTE_565
0819: 7@ = actor $PLAYER_ACTOR distance_from_ground
00D6: if
0021: 7@ > 20.0
004D: jump_if_false @PLCHUTE_565
097A: (unknown) -1000.0 -1000.0 -1000.0 1037
0004: $1513 = 1
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 46
0006: 0@ = 0
0005: $8268 = 0.0

:PLCHUTE_565
00D6: if
0038: $1513 == 1
004D: jump_if_false @PLCHUTE_2386
00D6: if
0039: 0@ == 0
004D: jump_if_false @PLCHUTE_608
0006: 0@ = 2

:PLCHUTE_608
00D6: if
0039: 0@ == 2
004D: jump_if_false @PLCHUTE_729
062E: (unknown) $PLAYER_ACTOR 2066 27@
00D6: if
04A4: (unknown) 27@ 7
004D: jump_if_false @PLCHUTE_729
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE" "PED" 1.0 1 0 0 0 -1
04ED: load_animation "PARACHUTE"
0006: 15@ = 1
0172: 1@ = actor $PLAYER_ACTOR z_angle
0006: 0@ = 3

:PLCHUTE_729
00D6: if
0039: 0@ == 3
004D: jump_if_false @PLCHUTE_2386
062E: (unknown) $PLAYER_ACTOR 2066 27@
00D6: if
04A4: (unknown) 27@ 7
004D: jump_if_false @PLCHUTE_815
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE" "PED" 1.0 1 0 0 0 -1

:PLCHUTE_815
0819: 7@ = actor $PLAYER_ACTOR distance_from_ground
00D6: if and
0023: 100.0 > 7@
0021: 7@ > 60.0
004D: jump_if_false @PLCHUTE_912
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_912
00D6: if
0038: $ONMISSION == 0
004D: jump_if_false @PLCHUTE_912
00BC: text_highpriority 'PARA_01' 1000 ms 1 // ~s~Open your parachute!

:PLCHUTE_912
0494: get_joystick_data 0 10@ 11@ 12@ 12@
00D6: if
0038: $1511 == 1
004D: jump_if_false @PLCHUTE_960
0006: 10@ = 0
0006: 11@ = 0

:PLCHUTE_960
0093: 21@ = integer_to_float 10@
0017: 21@ /= 4.267
0063: 21@ -= 2@
0017: 21@ /= 20.0
005B: 2@ += 21@
0087: 21@ = 2@
0017: 21@ /= 5.0
0063: 1@ -= 21@
00D6: if
0021: 1@ > 180.0
004D: jump_if_false @PLCHUTE_1061
000F: 1@ -= 360.0

:PLCHUTE_1061
00D6: if
0023: -180.0 > 1@
004D: jump_if_false @PLCHUTE_1092
000B: 1@ += 360.0

:PLCHUTE_1092
0093: 22@ = integer_to_float 11@
0017: 22@ /= 4.267
0063: 22@ -= 3@
0017: 22@ /= 20.0
005B: 3@ += 22@
083D: (unknown) $PLAYER_ACTOR 8@ 9@ $1509
00D6: if
0024: $1504 > $1509
004D: jump_if_false @PLCHUTE_1177
0086: $1509 = $1504

:PLCHUTE_1177
00D6: if
0024: $8268 > $1509
004D: jump_if_false @PLCHUTE_1204
0086: $8268 = $1509

:PLCHUTE_1204
00D6: if
0024: $1504 > $8268
004D: jump_if_false @PLCHUTE_1231
0086: $8268 = $1504

:PLCHUTE_1231
00D6: if and
0024: $1509 > $8268
8038: not $1902 == 1
004D: jump_if_false @PLCHUTE_1407
00D6: if
84AD: not actor $PLAYER_ACTOR touching_water
004D: jump_if_false @PLCHUTE_1361
00D6: if
0022: -20.0 > $8268
004D: jump_if_false @PLCHUTE_1308
0004: $1513 = 2
0002: jump @PLCHUTE_1354

:PLCHUTE_1308
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE" "PED" 1.0 1 0 0 0 100
0004: $1513 = 7

:PLCHUTE_1354
0002: jump @PLCHUTE_1407

:PLCHUTE_1361
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE" "PED" 1.0 1 0 0 0 100
0004: $1513 = 7

:PLCHUTE_1407
0087: 4@ = 3@
0017: 4@ /= 30.0
006F: 4@ *= $1505
02F6: $1507 = cosine 1@ // sinus swapped with cosine
02F7: $1508 = sinus 1@ // cosine swapped with sinus
006D: $1507 *= 4@
006D: $1508 *= 4@
0011: $1508 *= -1.0
0059: $1508 += $1506
0087: 21@ = 8@
0065: 21@ -= $1507
0013: 21@ *= 0.01
0088: $1507 = 8@
0067: $1507 -= 21@
0087: 21@ = 9@
0065: 21@ -= $1508
0013: 21@ *= 0.01
0088: $1508 = 9@
0067: $1508 -= 21@
0085: 12@ = 10@ and handles
0085: 13@ = 11@ and handles
0095: make 12@ absolute_integer
0095: make 13@ absolute_integer
00D6: if or
0019: 12@ > 40
0019: 13@ > 40
004D: jump_if_false @PLCHUTE_2109
00D6: if
001D: 12@ > 13@
004D: jump_if_false @PLCHUTE_1872
00D6: if
0029: 10@ >= 0
004D: jump_if_false @PLCHUTE_1751
00D6: if
8039: not 15@ == 2
004D: jump_if_false @PLCHUTE_1751
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_1744
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE_R" "PARACHUTE" 1.0 1 0 0 1 -2

:PLCHUTE_1744
0006: 15@ = 2

:PLCHUTE_1751
00D6: if
001B: 0 > 10@
004D: jump_if_false @PLCHUTE_1865
00D6: if
8039: not 15@ == 3
004D: jump_if_false @PLCHUTE_1865
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_1858
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE_L" "PARACHUTE" 1.0 1 0 0 1 -2

:PLCHUTE_1858
0006: 15@ = 3

:PLCHUTE_1865
0002: jump @PLCHUTE_2102

:PLCHUTE_1872
00D6: if
0029: 11@ >= 0
004D: jump_if_false @PLCHUTE_1984
00D6: if
8039: not 15@ == 4
004D: jump_if_false @PLCHUTE_1984
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_1977
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE" "PARACHUTE" 1.0 1 0 0 1 -2

:PLCHUTE_1977
0006: 15@ = 4

:PLCHUTE_1984
00D6: if
001B: 0 > 11@
004D: jump_if_false @PLCHUTE_2102
00D6: if
8039: not 15@ == 5
004D: jump_if_false @PLCHUTE_2102
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_2095
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE_ACCEL" "PARACHUTE" 1.0 1 0 0 1 -2

:PLCHUTE_2095
0006: 15@ = 5

:PLCHUTE_2102
0002: jump @PLCHUTE_2203

:PLCHUTE_2109
00D6: if
8039: not 15@ == 1
004D: jump_if_false @PLCHUTE_2203
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_2203
0812: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE" "PARACHUTE" 1.0 1 0 0 1 -2
0006: 15@ = 1

:PLCHUTE_2203
00D6: if or
00E1: key_pressed 0 17
0038: $1512 == 1
004D: jump_if_false @PLCHUTE_2386
00D6: if
8038: not $1902 == 1
004D: jump_if_false @PLCHUTE_2386
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_2386
00D6: if and
0038: $1497 == 3
0038: $1511 == 0
004D: jump_if_false @PLCHUTE_2386
0812: unknown_action_sequence $PLAYER_ACTOR "PARA_OPEN" "PARACHUTE" 8.0 0 0 0 1 -2
097A: (unknown) -1000.0 -1000.0 -1000.0 1038
008A: $8270 = 32@ and handles
0008: $8270 += 1100
0004: $1513 = 3
0006: 0@ = 0

:PLCHUTE_2386
00D6: if
0038: $1513 == 2
004D: jump_if_false @PLCHUTE_2504
00D6: if
04EE: animation "PARACHUTE" loaded
004D: jump_if_false @PLCHUTE_2492
0173: set_actor $PLAYER_ACTOR z_angle_to 1@
0829: unknown_action_sequence $PLAYER_ACTOR "FALL_SKYDIVE_DIE" "PARACHUTE" 1000.0 0
09F1: (unknown) $PLAYER_ACTOR 1189
0002: jump @PLCHUTE_2497

:PLCHUTE_2492
05BE: AS_kill_actor $PLAYER_ACTOR

:PLCHUTE_2497
0002: jump @PLCHUTE_5521

:PLCHUTE_2504
00D6: if
0038: $1513 == 3
004D: jump_if_false @PLCHUTE_4781
00D6: if
0018: $8270 > 0
004D: jump_if_false @PLCHUTE_2586
00D6: if
001F: 32@ > $8270
004D: jump_if_false @PLCHUTE_2586
097A: (unknown) -1000.0 -1000.0 -1000.0 1039
0004: $8270 = 0

:PLCHUTE_2586
00D6: if
0039: 0@ == 0
004D: jump_if_false @PLCHUTE_2689
0087: 25@ = 3@
0017: 25@ /= 500.0
0087: 26@ = 2@
0017: 26@ /= 500.0
0085: 18@ = 32@ and handles
0085: 19@ = 32@ and handles
0087: 5@ = 4@
0013: 5@ *= -1.0
0089: 6@ = $1509
0006: 0@ = 1

:PLCHUTE_2689
00D6: if
0039: 0@ == 1
004D: jump_if_false @PLCHUTE_2856
0085: 10@ = 32@ and handles
0062: 10@ -= 19@
00D6: if
001B: 500 > 10@
004D: jump_if_false @PLCHUTE_2829
0085: 10@ = 32@ and handles
0062: 10@ -= 18@
0085: 18@ = 32@ and handles
0093: 21@ = integer_to_float 10@
0087: 22@ = 25@
006B: 22@ *= 21@
0087: 23@ = 26@
006B: 23@ *= 21@
0063: 3@ -= 22@
0063: 2@ -= 23@
0002: jump @PLCHUTE_2856

:PLCHUTE_2829
0007: 2@ = 0.0
0007: 3@ = 0.0
0006: 0@ = 2

:PLCHUTE_2856
00D6: if
0039: 0@ == 2
004D: jump_if_false @PLCHUTE_2964
00D6: if
03CA: object 17@ exists
004D: jump_if_false @PLCHUTE_2964
0750: (unknown) 17@ 1
08D2: object 17@ scale_model 0.0
0085: 19@ = 32@ and handles
0001: wait 0 ms
075A: (unknown) 17@ "PARA_OPEN_O" "PARACHUTE" 1000.0 0 1
0006: 0@ = 3

:PLCHUTE_2964
00D6: if
0039: 0@ == 3
004D: jump_if_false @PLCHUTE_3067
0085: 10@ = 32@ and handles
0062: 10@ -= 19@
00D6: if
001B: 500 > 10@
004D: jump_if_false @PLCHUTE_3050
0093: 21@ = integer_to_float 10@
0017: 21@ /= 500.0
08D2: object 17@ scale_model 21@
0002: jump @PLCHUTE_3067

:PLCHUTE_3050
08D2: object 17@ scale_model 1.0
0006: 0@ = 4

:PLCHUTE_3067
00D6: if
0039: 0@ == 5
004D: jump_if_false @PLCHUTE_3136
0107: 20@ = create_object #PARA_COLLISION at 0.0 0.0 0.0
0750: (unknown) 20@ 0
0392: object 20@ toggle_in_moving_list 1
04D9: object 20@ set_scripted_collision_check 1
0006: 0@ = 6

:PLCHUTE_3136
00D6: if
0039: 0@ == 6
004D: jump_if_false @PLCHUTE_4354
0494: get_joystick_data 0 10@ 11@ 12@ 12@
00D6: if
0038: $1511 == 1
004D: jump_if_false @PLCHUTE_3202
0006: 10@ = 0
0006: 11@ = 0

:PLCHUTE_3202
0093: 21@ = integer_to_float 10@
0017: 21@ /= 4.267
0063: 21@ -= 2@
0017: 21@ /= 20.0
005B: 2@ += 21@
0087: 21@ = 2@
0017: 21@ /= 15.0
0063: 1@ -= 21@
00D6: if
0021: 1@ > 180.0
004D: jump_if_false @PLCHUTE_3303
000F: 1@ -= 360.0

:PLCHUTE_3303
00D6: if
0023: -180.0 > 1@
004D: jump_if_false @PLCHUTE_3334
000B: 1@ += 360.0

:PLCHUTE_3334
02F6: $1507 = cosine 1@ // sinus swapped with cosine
02F7: $1508 = sinus 1@ // cosine swapped with sinus
0069: $1507 *= $1500
0069: $1508 *= $1500
0011: $1507 *= -1.0
0085: 12@ = 10@ and handles
0085: 13@ = 11@ and handles
0095: make 12@ absolute_integer
0095: make 13@ absolute_integer
00D6: if or
0019: 12@ > 40
0019: 13@ > 40
004D: jump_if_false @PLCHUTE_4066
00D6: if
001D: 12@ > 13@
004D: jump_if_false @PLCHUTE_3741
0089: 21@ = $1501
0065: 21@ -= $1509
0017: 21@ /= 20.0
005F: $1509 += 21@
00D6: if
0029: 10@ >= 0
004D: jump_if_false @PLCHUTE_3607
00D6: if
8039: not 15@ == 2
004D: jump_if_false @PLCHUTE_3607
0812: unknown_action_sequence $PLAYER_ACTOR "PARA_STEERR" "PARACHUTE" 1.0 1 0 0 1 -2
075A: (unknown) 17@ "PARA_STEERR_O" "PARACHUTE" 1.0 1 1
0006: 15@ = 2

:PLCHUTE_3607
00D6: if
001B: 0 > 10@
004D: jump_if_false @PLCHUTE_3734
00D6: if
8039: not 15@ == 3
004D: jump_if_false @PLCHUTE_3734
0812: unknown_action_sequence $PLAYER_ACTOR "PARA_STEERL" "PARACHUTE" 1.0 1 0 0 1 -2
075A: (unknown) 17@ "PARA_STEERL_O" "PARACHUTE" 1.0 1 1
0006: 15@ = 3

:PLCHUTE_3734
0002: jump @PLCHUTE_4059

:PLCHUTE_3741
00D6: if
0029: 11@ >= 0
004D: jump_if_false @PLCHUTE_3900
0089: 21@ = $1503
0065: 21@ -= $1509
0017: 21@ /= 20.0
005F: $1509 += 21@
00D6: if
8039: not 15@ == 4
004D: jump_if_false @PLCHUTE_3900
0812: unknown_action_sequence $PLAYER_ACTOR "PARA_DECEL" "PARACHUTE" 1.0 1 0 0 1 -2
075A: (unknown) 17@ "PARA_DECEL_O" "PARACHUTE" 1.0 1 1
0006: 15@ = 4

:PLCHUTE_3900
00D6: if
001B: 0 > 11@
004D: jump_if_false @PLCHUTE_4059
0089: 21@ = $1501
0065: 21@ -= $1509
0017: 21@ /= 20.0
005F: $1509 += 21@
00D6: if
8039: not 15@ == 5
004D: jump_if_false @PLCHUTE_4059
0812: unknown_action_sequence $PLAYER_ACTOR "PARA_FLOAT" "PARACHUTE" 1.0 1 0 0 1 -2
075A: (unknown) 17@ "PARA_FLOAT_O" "PARACHUTE" 1.0 1 1
0006: 15@ = 5

:PLCHUTE_4059
0002: jump @PLCHUTE_4225

:PLCHUTE_4066
0089: 21@ = $1501
0065: 21@ -= $1509
0017: 21@ /= 20.0
005F: $1509 += 21@
00D6: if
8039: not 15@ == 5
004D: jump_if_false @PLCHUTE_4225
00D6: if
8039: not 15@ == 1
004D: jump_if_false @PLCHUTE_4225
0812: unknown_action_sequence $PLAYER_ACTOR "PARA_FLOAT" "PARACHUTE" 1.0 1 0 0 1 -2
075A: (unknown) 17@ "PARA_FLOAT_O" "PARACHUTE" 1.0 1 1
0006: 15@ = 1

:PLCHUTE_4225
01BB: store_object 17@ position_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_2
0815: (unknown) 20@ $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_2
00D6: if
04DA: has_object 20@ collided
004D: jump_if_false @PLCHUTE_4318
075A: (unknown) 17@ "PARA_RIP_LOOP_O" "PARACHUTE" 8.0 1 1
0006: 0@ = 7

:PLCHUTE_4318
00D6: if
00E1: key_pressed 0 15
004D: jump_if_false @PLCHUTE_4354
0792: (unknown) $PLAYER_ACTOR
0004: $1513 = 6
0004: $1498 = 3

:PLCHUTE_4354
00D6: if
03CA: object 17@ exists
004D: jump_if_false @PLCHUTE_4593
00D6: if
0837: (unknown) 17@ "PARA_OPEN_O"
004D: jump_if_false @PLCHUTE_4593
0839: (unknown) 17@ "PARA_OPEN_O" 21@
0087: 22@ = 6@
0065: 22@ -= $1501
0087: 23@ = 22@
006B: 23@ *= 21@
0088: $1509 = 6@
0067: $1509 -= 23@
0087: 22@ = 5@
0065: 22@ -= $1500
0087: 23@ = 22@
006B: 23@ *= 21@
0087: 4@ = 5@
0063: 4@ -= 23@
02F6: $1507 = cosine 1@ // sinus swapped with cosine
02F7: $1508 = sinus 1@ // cosine swapped with sinus
006D: $1507 *= 4@
006D: $1508 *= 4@
0011: $1507 *= -1.0
00D6: if and
0043: 21@ == 1.0
0039: 0@ == 4
004D: jump_if_false @PLCHUTE_4593
0006: 0@ = 5

:PLCHUTE_4593
00D6: if
8118: not actor $PLAYER_ACTOR dead
004D: jump_if_false @PLCHUTE_4781
00D6: if
04AD: actor $PLAYER_ACTOR touching_water
004D: jump_if_false @PLCHUTE_4732
0812: unknown_action_sequence $PLAYER_ACTOR "PARA_LAND_WATER" "PARACHUTE" 8.0 1 1 0 0 1000
075A: (unknown) 17@ "PARA_LAND_WATER_O" "PARACHUTE" 1000.0 0 1
0004: $1513 = 5
0006: 0@ = 0

:PLCHUTE_4732
083D: (unknown) $PLAYER_ACTOR 21@ 21@ 23@
00D6: if
0021: 23@ > -0.1
004D: jump_if_false @PLCHUTE_4781
0004: $1513 = 4
0006: 0@ = 0

:PLCHUTE_4781
00D6: if
0038: $1513 == 4
004D: jump_if_false @PLCHUTE_5271
00D6: if
0039: 0@ == 0
004D: jump_if_false @PLCHUTE_5168
0004: $1498 = 1
00A0: store_actor $PLAYER_ACTOR position_to $TEMPVAR_X_COORD $TEMPVAR_Y_COORD $TEMPVAR_Z_COORD
000D: $TEMPVAR_Z_COORD -= 1.0
00A1: put_actor $PLAYER_ACTOR at $TEMPVAR_X_COORD $TEMPVAR_Y_COORD $TEMPVAR_Z_COORD
083E: (unknown) $PLAYER_ACTOR 0.0 0.0 1@
00D6: if
0022: -10.0 > $1509
004D: jump_if_false @PLCHUTE_4922
0004: $1513 = 2
0006: 0@ = 0
0002: jump @PLCHUTE_5092

:PLCHUTE_4922
00D6: if
0022: -4.0 > $1509
004D: jump_if_false @PLCHUTE_5047
0615: define_action_sequences 14@
0812: unknown_action_sequence -1 "FALL_FRONT" "PED" 20.0 0 0 0 1 700
0812: unknown_action_sequence -1 "GETUP_FRONT" "PED" 8.0 0 1 0 0 -2
0616: define_action_sequences_end 14@
0618: assign_actor $PLAYER_ACTOR to_action_sequences 14@
061B: remove_references_to_action_sequences 14@
0002: jump @PLCHUTE_5085

:PLCHUTE_5047
0812: unknown_action_sequence $PLAYER_ACTOR "RUN_PLAYER" "PED" 8.0 1 1 0 0 1000

:PLCHUTE_5085
0006: 0@ = 1

:PLCHUTE_5092
075A: (unknown) 17@ "PARA_LAND_O" "PARACHUTE" 1000.0 0 1
0682: detach_object 17@ 0.0 0.0 0.0 collision_detection 0
0085: 18@ = 32@ and handles
000A: 18@ += 1000

:PLCHUTE_5168
00D6: if
0039: 0@ == 1
004D: jump_if_false @PLCHUTE_5271
00D6: if
0837: (unknown) 17@ "PARA_LAND_O"
004D: jump_if_false @PLCHUTE_5271
0839: (unknown) 17@ "PARA_LAND_O" 21@
00D6: if
0043: 21@ == 1.0
004D: jump_if_false @PLCHUTE_5271
0004: $1498 = 2
0002: jump @PLCHUTE_5521

:PLCHUTE_5271
00D6: if
0038: $1513 == 5
004D: jump_if_false @PLCHUTE_5328
0004: $1498 = 1
00D6: if
0039: 0@ == 0
004D: jump_if_false @PLCHUTE_5328
0004: $1498 = 2
0002: jump @PLCHUTE_5521

:PLCHUTE_5328
00D6: if and
0018: $1513 > 0
001A: 4 > $1513
004D: jump_if_false @PLCHUTE_5405
00D6: if
8118: not actor $PLAYER_ACTOR dead
004D: jump_if_false @PLCHUTE_5405
083C: (unknown) $PLAYER_ACTOR $1507 $1508 $1509
0173: set_actor $PLAYER_ACTOR z_angle_to 1@
083E: (unknown) $PLAYER_ACTOR 3@ 2@ 1@

:PLCHUTE_5405
00D6: if
0038: $1513 == 6
004D: jump_if_false @PLCHUTE_5430
0002: jump @PLCHUTE_5521

:PLCHUTE_5430
00D6: if
0038: $1513 == 7
004D: jump_if_false @PLCHUTE_5455
0002: jump @PLCHUTE_5462

:PLCHUTE_5455
0002: jump @PLCHUTE_118

:PLCHUTE_5462
//0004: $1513 = 0
0006: 0@ = 0
0249: release_model #PARACHUTE
04EF: release_animation "PARACHUTE"
083E: (unknown) $PLAYER_ACTOR 0.0 0.0 1@
0992: set_player $PLAYER_CHAR weapons_scrollable 1
0002: jump @PLCHUTE_5455

:PLCHUTE_5521
0682: detach_object 17@ 0.0 0.0 0.0 collision_detection 0
09A2: (unknown) 17@
0108: destroy_object 20@
0555: remove_weapon 46 from_actor $PLAYER_ACTOR
0004: $1513 = 0
0004: $1497 = 0
0006: 0@ = 0
0249: release_model #PARACHUTE
04EF: release_animation "PARACHUTE"
0249: release_model #GUN_PARA
083E: (unknown) $PLAYER_ACTOR 0.0 0.0 1@
0992: set_player $PLAYER_CHAR weapons_scrollable 1
004E: end_thread


4. Synthèse et tests

Maintenant que nous avons notre script complet il ne reste plus qu'a tester (si vous n'avez pas réussi voilà un Script complet)

Maintenant :





5. Modification des données

Vous pouvez aussi modifier les paramètres de parachutage, la vitesse de chute sans parachute ou encore avec parachute, combien plier les jambes vous ralentira etc... Tout se joue ici :

Code
:PLCHUTE
03A4: name_thread 'PLCHUTE'
0004: $1498 = 0
0004: $1513 = 0
0004: $1497 = 0
0005: $1500 =  5.0
0005: $1501 = -5.0
0005: $1503 = -1.5
0005: $1504 = -30.0
0005: $1505 =  32.0
0005: $1506 =  0.0
0004: $1512 =  0
0004: $1513 =  0


0005: $1500 = 5.0 : C'est la valeur qui vous fait avancer en parachute : si vous mettez 0 vous tomberez sur place, si vous mettez 50 vous avancerez beaucoup en tombant
0005: $1501 = -5.0: C'est la valeur de chute avec votre parachute lorsque vous ne tirez pas les cordes.
0005: $1503 = -1.5: C'est la valeur de chute avec votre parachute lorsque vous tirez les cordes.
0005: $1504 = -30.0: C'est la valeur de chute sans votre parachute (quelque soit la position).
0005: $1505 = 32.0: C'est la valeur qui gère la position (sans parachute) pour aller plus vite, plus elle sera grande, plus vous irez vite en avant.
0005: $1506 = 0.0: C'est la valeur qui gère la position (sans parachute) normale, plus elle sera grande, plus vous irez vite en avant.

Je n'ai pas vu de modification avec les autres valeurs, voilà un saut en parachute qui me parait plus réaliste que le saut normal :
Code
:PLCHUTE
03A4: name_thread 'PLCHUTE'
0004: $1498 = 0
0004: $1513 = 0
0004: $1497 = 0
0005: $1500 =  10.0
0005: $1501 = -8.0
0005: $1503 = -2.5
0005: $1504 = -35.0
0005: $1505 =  38.0
0005: $1506 =  5.0
0004: $1512 =  0
0004: $1513 =  0


Par Vicolaships

IPB Image
midtownmad - http://www.macreators.com | Respectez le forum et vous n'aurez pas de problèmes...




0 utilisateur(s) li(sen)t ce sujet

0 membre(s), 0 invité(s), 0 utilisateur(s) anonyme(s)