Author Topic: Aschratts SA SCM Tutorial  (Read 11118 times)

0 Members and 1 Guest are viewing this topic.

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« on: October 25, 2008, 02:16:22 AM »
- SCM Tutorial -
Scripting of videosequences & SCM basics


Original Thread


Preamble

You're dream is since a long time to be able to include videosequences into videos, where people are moving around, like you want, cars driving, how you think they should do? You want scenes with such a suppleness, that you can't get with camhack, hollywood like stagings and movements with the camera into more than one direction at the same time? Then this tutorial will help you to make your own dream comes true. Work and learn hard, and you dream, to be able to script, will come true.

About This Tutorial

This tutorial was created, because I wanted to show The Q and ColdDeath how to script. But these two guys thought, this tutorial were to amazing if it doesn't would be released official. So I converted the tutorial into this thread form.

Creating Time: 2 Months
Correction: J-Fox, ColdDeath
Translating: ColdDeath

I hope this tutorial could show up the basics of scripting. Please respect this, so please talk to me if you want to link to the tutorial! Linking to the thread is allowed.
Thanks

Links
Before we start
  • Create a backup of your actuall, unmodded, SCM, before you change anything. Then you will be able to continuously play with your old savegames.
  • Do NOT load any savegame after modifying / replacing the SCM. This works only rarely and because of luck. Start EVERYTIME a new game.
  • Be sure, that a tick is in front of 'Do always write OpCodes' in the Sanny Builder Options. With this little tick, the beginning of scripting will be easier.

Acknowledgments

Special Thanks:
ColdDeath, The Q, piohh, J-Fox

Then I want to thank some people which helped me with the tutorial:
PARADOXON, oCain, AMD, Mardyfox


Part 1: Basics

Learning without practice is dry, practise without theory impossible. The best way to learn something is to work on both sides. It's the same with learning to script.

This tutorial is a crash course, that will show you, how to script videosequences in San Andreas via SCM. Therefore you must read everything carefully. And you're going to translate the things you've learned into practics.

So, let's start with the very basics.

SCM is a scripting language. A script, exactly like a program code, can be very long. So don't be scared, when you see the first time such a amount of code.

Let's look at a mission script. This one spawns the player after the start at the point X:0, Y:0, Z:100 (Z:100 because otherwise the player would be spawned under the ground). It is called also a "stripped" Script, because all missions and everything around it is deleted. This script will be expanded in the next parts of the tutorial.

Code: [Select]
DEFINE OBJECTS  1
DEFINE OBJECT (no object) //unused

DEFINE MISSIONS  0

DEFINE EXTERNAL_SCRIPTS  0

DEFINE UNKNOWN_EMPTY_SEGMENT  0

DEFINE UNKNOWN_THREADS_MEMORY  0

//-------------MAIN---------------


:MAIN_1
03A4: name_thread 'MAIN'
016A: fade  0 ()  0 ms

042C: set_total_missions_to  1
030D: set_total_mission_points_to  1
01F0: set_max_wanted_level_to  6
0111: set_wasted_busted_check_to  0 (disabled)
00C0: set_current_time  10  0

$SpawnX = 0.0
$SpawnY = 0.0
$SpawnZ = 100.0

04E4: unknown_refresh_game_renderer_at  $SpawnX $SpawnY
03CB: set_camera  $SpawnX $SpawnY $SpawnZ
062A: change_stat  165 (energy) to  999.0  // float
062A: change_stat  23 (muscle) to  999.0  // float
062A: change_stat  21 (fat) to  0.0  // float
062A: change_stat  163 (health) to  999.0  // float
062A: change_stat  160 (driving skill) to  999.0  // float
062A: change_stat  229 (bike skill) to  999.0  // float
062A: change_stat  223 (flying skill) to  999.0  // float
062A: change_stat  230 (cicle skill) to  999.0  // float
0629: change_stat  181 (islands unlocked) to  4  // integer see statdisp.dat
0629: change_stat  68 () to  0  // integer see statdisp.dat
0053: $PLAYER_CHAR = create_player #NULL at  $SpawnX $SpawnY $SpawnZ
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


01B6: set_weather  1
087B: set_player $PLAYER_CHAR clothes "bballjackrstar" "bbjack"  0
087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS"  2
087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER"  3
087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD"  1
070D: $PLAYER_CHAR
04BB: select_interior  0  // select render area

01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
01B7: release_weather
016C: restart_if_wasted at  $SpawnX $SpawnY $SpawnZ angle  0.0 unknown  0

0247: request_model #hydra
:MAIN_2
0001: wait  0 ms
00D6: if  0
0248:   model #hydra available
004D: jump_if_false @MAIN_2
00A5: $vehicle = create_car #hydra at $SpawnX $SpawnY $SpawnZ
036A: put_actor $PLAYER_ACTOR in_car $vehicle

016A: fade  1 ()  1000 ms

0001: wait  100 ms
03E6: remove_text_box

:MAIN_3
0001: wait 2500 ms
0002: jump @MAIN_3
(Original by Steve-M for his MapCleaner - http://www.steve-m.com)

The "Header"

Code: [Select]
DEFINE OBJECTS  1
DEFINE OBJECT (no object) //unused

DEFINE MISSIONS  0

DEFINE EXTERNAL_SCRIPTS  0

DEFINE UNKNOWN_EMPTY_SEGMENT  0

DEFINE UNKNOWN_THREADS_MEMORY  0

This is the so called "Header". For the beginning we don't change it, I'll explain it later when we need it (normaly only important if you want to write missions, or place things on the map). Instead of (no object) you could theoretically write everything else, but it's so, that the SannyBuilder writes everytime "SannyBuilder V.XXX". In the program "MissionBuilder" by Barton Waterdruck (BW) you could originally write your own name there, but in my opinion that has no sense anyway.

Little Explaining:
// These two slashes are comments. That means they will be during the converting into a SCM (called "compiling") ignored, and everything behind them will be skipped.

A code can for example look like this:

Code: [Select]
062A: change_stat  165 to  999.0  // Changes energy to 999.0.Only the part in front of the two slashes "//" will be compilled.

Let's look a bit closer on this line:

Code: [Select]
062A: change_stat  165 (energy) to  999.0The 062A: is the "OpCode". Every OpCode (Operation Code) causes something different in the game. Beside of that every OpCode needs values. Basicly you can write everything behind the OpCode. For example this:

Code: [Select]
062A: HABABABABIADFBFABIAFBI 165 AFIBFSIFSAIFSA 999.0 AFEVUFAUVkafOr:

Code: [Select]
062A: 165 999.00But this follows, that you don't know after some time yourself, what you're doing. Therefore we will do everything clean and not untidy. Every OpCode which has a explaining (for example: "change_stat") will not be touched, the explainings are made not without a reason.

Let's look, why the "165" and the "999.00" are so important and needs to be stayed in the script.

Note that you have to see the difference between certain datatypes:

Float = A decimal value (Attention! numbers must be separated using a dot so that SannyBuilder knows that you mean a decimal number!) Example: 999.00.

Integer = Rounded values without any seperator. Example: 1, 2, 3, 4, 234145, 4352611

String = A word or sentence. It's length depents on the OpCode which uses the string but standart OpCodes mostly use strings shorter than 8 signs. Strings allways need to be identified using '' for a short string or "" for a long string. Example: 'short', "I am a long string".

These forms are existing in the SannyBuilder too:

Quote
$ - global variable
s$ - global string variable
v$ - global long string variable
@ - label (text directly AFTER used to reference this label in jumps)
@ - local variable (number BEFORE denotes variable)
@s - local string variable (number BEFORE denotes variable)
@v - local long string variable (number BEFORE denotes variable)
'...' - string (first 8 bytes after OpCode when compiled)
"..." - debug string text
# - model identifier (means you can enter the id name of a model rather than the number)
Original from Modding Wiki: http://www.gtamodding.com


Global means, that the variable will be used over the whole script.

Local means, that the variable will be used only in different parts of the script.

90 % of all variables are global variables. It's important, that you don't confuse a local variable with a label.

Just take this in mind:

Code: [Select]
$ - Global Variable
$s - Global String
@Text - Label (Because Text is just written down behind the @.)

Let's take a look on the mainpart of our script:

Code: [Select]
//-------------MAIN---------------


:MAIN_1
03A4: name_thread 'MAIN'
016A: fade  0 ()  0 ms

042C: set_total_missions_to  1
030D: set_total_mission_points_to  1
01F0: set_max_wanted_level_to  6
0111: set_wasted_busted_check_to  0 (disabled)
00C0: set_current_time  10  0

$SpawnX = 0.0
$SpawnY = 0.0
$SpawnZ = 100.0

04E4: unknown_refresh_game_renderer_at  $SpawnX $SpawnY
03CB: set_camera  $SpawnX $SpawnY $SpawnZ
062A: change_stat  165 (energy) to  999.0  // float
062A: change_stat  23 (muscle) to  999.0  // float
062A: change_stat  21 (fat) to  0.0  // float
062A: change_stat  163 (health) to  999.0  // float
062A: change_stat  160 (driving skill) to  999.0  // float
062A: change_stat  229 (bike skill) to  999.0  // float
062A: change_stat  223 (flying skill) to  999.0  // float
062A: change_stat  230 (cicle skill) to  999.0  // float
0629: change_stat  181 (islands unlocked) to  4  // integer see statdisp.dat
0629: change_stat  68 () to  0  // integer see statdisp.dat
0053: $PLAYER_CHAR = create_player #NULL at  $SpawnX $SpawnY $SpawnZ
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
01B6: set_weather  1

087B: set_player $PLAYER_CHAR clothes "bballjackrstar" "bbjack"  0
087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS"  2
087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER"  3
087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD"  1
070D: $PLAYER_CHAR
04BB: select_interior  0  // select render area

01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
01B7: release_weather
016C: restart_if_wasted at  $SpawnX $SpawnY $SpawnZ angle  0.0 unknown  0

0247: request_model #hydra
:MAIN_2
0001: wait  0 ms
00D6: if  0
0248:   model #hydra available
004D: jump_if_false @MAIN_2
00A5: $vehicle = create_car #hydra at $SpawnX $SpawnY $SpawnZ
036A: put_actor $PLAYER_ACTOR in_car $vehicle

016A: fade  1 ()  1000 ms

0001: wait  100 ms
03E6: remove_text_box

:MAIN_3
0001: wait 2500 ms
0002: jump @MAIN_3

A Script begins everytime with the two rows:
Code: [Select]
:MAIN_1
03A4: name_thread 'MAIN'

:MAIN_1 is a "Label". That means, a point, where you can jump out of the script, that you are able to execute the following commands.

Code: [Select]
03A4: name_thread 'MAIN'
Is a command, which gives the mainthread the name "Main". To show that, I must go more into depth.

The Threadmodel

Threads has basicly the function, to let run certain codeparts parallel.

That's working in this way:

The processor assigns a thread 1/10 s, in which it should run it's command. Then the next thread comes. Ideally is the second one the thread, which will assigned the commands from the 2nd 1/10 s (this doesn't must disturb you). Because of this short timeperiodes the user doesn't recognize what's happen. The whole thing looks faster, because of the amount of threads (up to 300 and more). If a thread should do all SCM commands, it would need twice the time, because it would get still for the twice commands 1/10 s from the processor. That's the reason, why codes will be subdivide into threads. The main thread is everytime the "Mainthread". It steers the rest.

Example "Superjumps":
  • Mainthread will be started
  • Mainthread generates Superjumpthread
  • Superjumpthread checks if the player is doing Superjumps
  • Mainthread runs it's commands parallel

Without threads the mainthread would've take over the work of the Superjumpthread. The script would be more slowly. Therefore threads are very important for programming and scripting.

« Last Edit: November 01, 2009, 09:19:37 AM by ColdDeath »

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« Reply #1 on: October 25, 2008, 02:17:46 AM »
Back to our codeplace:

Code: [Select]
042C: set_total_missions_to  1
030D: set_total_mission_points_to  1
01F0: set_max_wanted_level_to  6
0111: set_wasted_busted_check_to  0 (disabled)
00C0: set_current_time  10  0

That is normaly standart.
The first three lines should be clear. If not: they doesn't have a special meaning for us.

Code: [Select]
0111: set_wasted_busted_check_to  0 (disabled)
Let's the game include a "Godmode". That means, the game doesn't check anylonger, if the player is alive or get's arrested. This is currently not important for us, too. Mostly this commands gets ignored, because the mainthread still checks, if the player is alive or not.

Code: [Select]
00C0: set_current_time  10  0
With this we are able to regulate the Time in the game.
Like this: Hours Minutes

Do we set the time to 18 23, it is 18:23 o'clock in the game. (Attention: 24 0 does not exist. Only 0 0)

In the next rows we defining 3 variables:

Code: [Select]
$SpawnX = 0.0
$SpawnY = 0.0
$SpawnZ = 100.0

All 3 does have a $-Sign before the text. That means, they are global variables (in this case Fall Floats, because they have  a decimal seperator. Furhtermore it is NOT possible to assign this varibale an Integer. It is possible to convert datatypes, but this is most of the time uncertain, because you don't know most of the time what the global variable is written for). Normaly the OpCode 0005: should be used now, but because this one is used very often, it is incorporated in the Compiler, and don't must be written down in front of that.

(Info: 0005: has the task of the creation, or "Declaration", of a float. If you want to set an Integer now on the &SpawnX, the Compiler sets automatically 0004: for Integer, during the Compilation before.)

The next row is important, too.

Code: [Select]
04E4: unknown_refresh_game_renderer_at  $SpawnX $SpawnY
With this code we tell the game, that it should calculate everything in the environment around $SpawnX and $SpawnY. The Height-Coordinates are irrelevant, because we must imagine us the whole as a cylinder around the player.

Time to place the camera.

Code: [Select]
03CB: set_camera  $SpawnX $SpawnY $SpawnZ
We place the camera here. Where the camera shows to, does firstly not matter, because normaly we doesn't see anything at this point yet.

Then we must change some statistics of our player:

Code: [Select]
062A: change_stat  165 (energy) to  999.0  // float
062A: change_stat  23 (muscle) to  999.0  // float
062A: change_stat  21 (fat) to  0.0  // float
062A: change_stat  163 (health) to  999.0  // float
062A: change_stat  160 (driving skill) to  999.0  // float
062A: change_stat  229 (bike skill) to  999.0  // float
062A: change_stat  223 (flying skill) to  999.0  // float
062A: change_stat  230 (cycle skill) to  999.0  // float
0629: change_stat  181 (islands unlocked) to  4  // integer see statdisp.dat
0629: change_stat  68 () to  0  // integer see statdisp.dat

Now it get's intersting. We create our player!

Code: [Select]
0053: $PLAYER_CHAR = create_player #NULL at  $SpawnX $SpawnY $SpawnZ
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR

What is the consequence? First, we assign to the variable $PLAYER_CHAR a worth. Normaly we should assign her 0, but unknown variables gets automatically created, so it doesn't matter. Indeed $PLAYER_CHAR is not a normal variable like we known it, but we tell the variable with the OpCode 0053: that it should be the object #NULL (CJ, through the # we know that NULL should be a model), which the player is. Other OpCodes are doing the same, placing an object, but that isn't then the player. At the point X Y and Z the object (the player) will be created. If we want to change the playermodell, we must do that later. This rows are duty.
At least the player itself will be created, and assigned to the variable $PLAYER_ACTOR.

&PLAYER_GROUP includes a worth, which shows the group membership of the player. This one we can use for example, if we want to create as support for the player a group of Grove Street NPCs.

Code: [Select]
0373: set_camera_directly_behind_player
0173: set_actor $PLAYER_ACTOR z_angle_to  262.0
01B6: set_weather  1

To be able to control our player, we set the camera directly behind him.
Then we rotate him in the desired direction. Attention! That does not mean, that we rotate the player 262.0°, it means, that we set him on 262.0°.
At least we change the weather to 1 (you can extract the different weathertypes for example out of the tool  'San Andreas Control Center').

With the rows:

Code: [Select]
087B: set_player $PLAYER_CHAR clothes "bballjackrstar" "bbjack"  0
087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS"  2
087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER"  3
087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD"  1

We are changing the clothes of the player.
These ones are in the player.img. The number behind is the bodypart. The SannyBuilder does have included some constances for this.

For Example:
A jacket does have the ID 0. We could write "torso" too, and the SannyBuilder would understand it aswell.

oCain had created a Bodyparts Table:

Code: [Select]
0=torso
1=haircut
2=legs
3=feet
13=chains
14=watches
15=shades
16=hats
17=special (aka full body)

Code: [Select]
04BB: select_interior  0  // select render area
Here we change, if CJ is outside or inside of a building. Generell you need, as long you did not moved through an entrance with the yellow marker, always 0, because that is the standart.

Code: [Select]
01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
01B7: release_weather
016C: restart_if_wasted at  $SpawnX $SpawnY $SpawnZ angle  0.0 unknown  0

That we are able to move our player, we must set the "Frozen-state" to 1, so set it movable. 0 is unmovable.

After that we tell the game, that the weather will be changed immediately. (At least we did set it to 1, so it's going to be 1), and then we script, that if the player should die (wasted), the game should respawn the player at the coordinates $SpawnX $SpawnY $SpawnZ with the angle 0.0 again. It's also existing an OpCode for arrest (busted). Insert under this a new row, write there "busted" and press F1 till "restart_if_busted" there appears. There you can tell the game, where the player should be spawn, if he would get arrested.
You can also create several of these coordinates, the player would be spawned at the next one then.

Important! You've just learned to use the button F1 and it's advantage. With this button you can search all OpCodes, which does have such a worth, like the one infront of the cursor currently searches.
If you still dosn't find it, the Sannybuilder does have a tool "OpCodeSearch", 'Tools ==> Usertools'.

Now we have reached theoretically the end of our script. But our task is, not to forget, that the player starts in a hydra. To load a modell, the first thing we must do is to "request" it, so with other words, to ask if it is present. If we wouldn't do this, the game would simply crash.

Code: [Select]
0247: request_model #hydra
Tells the game, that it should check, if the modell #hydra could be loaded. After that we are able to process this information. # means, that hydra is a modell.

Code: [Select]
:MAIN_2
0001: wait  0 ms
00D6: if  0
0248:   model #hydra available
004D: jump_if_false @MAIN_2
00A5: $vehicle = create_car #hydra at $SpawnX $SpawnY $SpawnZ
036A: put_actor $PLAYER_ACTOR in_car $vehicle

What is the consequence?

At first the game waits 0 ms. That sounds pointless, but the SCM Thread still executes the command. That means, the thread, which loads the modell (a not in SCM stored thread), gets the time, to deliver the modell back.

After that we must ask, if the modell is present. This is a typical if-question.

Code: [Select]
00D6: if  0
0248:   model #hydra available
004D: jump_if_false @MAIN_2

The number behind the 'if' is for the number of terms. In this case one term exist. So 0.
(Subtract from the terms always 1, maximum 7 terms!)

After that we ask with the OpCode 0248: if the modell #hydra is available or not. If it is NOT, the script jumps to the Label :MAIN_2 (in our case) back. You can see this, because after the @ directly MAIN_2, so the text, is written: "@MAIN_2". That means, that it is a Label.

In our script the whole will be asked as long as it is available. Is it available then, we don't jump back, but we execute the following rows:

Code: [Select]
00A5: $vehicle = create_car #hydra at $SpawnX $SpawnY $SpawnZ
036A: put_actor $PLAYER_ACTOR in_car $vehicle

We create a car with the modell #hydra (which one is available) at $SpawnX $SpawnY $SpawnZ.

In addition we assign the car to the variable $vehicle, so that we are still be able to use it further. For this we need the OpCode 00A5:.
With the following OpCode 036A: the actor $PLAYER_ACTOR, which one we created earlier, will be set into the car $vehicle, which one we created not five minutes ago.

So far, everything is ready for the game, but at the moment, we doesn't see anything. The screen is only black. Because of this we need this OpCode:

Code: [Select]
016A: fade  1 ()  1000 ms
This one creates a transition from Typ 1 (Black => Normal Picture), which has a lenght of 1000 ms.

Then we wait another 100 milliseconds, and delete all messanges, which could be maybe still on the screen.

Code: [Select]
0001: wait  100 ms
03E6: remove_text_box

Finally the most important thing. We can not simply cancel a thread. The SCM needs at least always one active thread. Because of that, the Main-Thread will be always kept alive, and set into an infinite loop.

Code: [Select]
:MAIN_3
0001: wait 2500 ms
0002: jump @MAIN_3

The script waits 2500 ms, then it jumps back to :MAIN_3, where it waits 2500 ms again, jumps again, waits again, et cetera ...

The whole script is finished now. With a click in Sanny Builder onto 'Compile + Copy (F7)' you compile the script and overwrite automatically your old SCM. Now you can test your script. Start GTA San Andreas by pressing the button 'Run San Andreas (F8)' and start a new game.



(Remember: Save your main.scm and script.img before you press the button 'Compile + Copy (F7)'. You can't load old savegames with new SCMs!)

Part 2 will show how a camera gets animated.

- Stripped_SCM_Source+SCM -
« Last Edit: November 01, 2009, 09:27:30 AM by ColdDeath »

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« Reply #2 on: October 26, 2008, 09:02:45 AM »
Part 2: Camera Movements


We have written now our very first SCM. Because we are highly motivated we do not give us satisfied with such a little script. We want to script whole and good looking video sequences.


1. Content of Part Two

Today we want to start to employ us with camera movements. Therefore we will place CJ anywhere, and let the camera move to him. You will learn how to use the two most important OpCodes:
'set_camera' and 'set_camera_point'


2. Measuring Of Coordinates

To measure of coordinates you can use two different ways. Both of them have advantages and disadvantages. I'll prefer personally the first one, but it will be in your hand, which one you want to use. And it will be good for you, if you try to understand both ways!

a. - Sanny Builder Function

The programm SannyBuilder provides a direct function to read the Coords of the player.
  • Go to the position you want to start.
  • Press (Alt+Tab) to minimize GTA San Andreas and open the SannyBuilder.
  • Create a new, empty file. Save it as for example as 'Projectname: Coordinates'.
  • Move the cursor to the place, where the coordinates should be written down.
  • Right click on the background. Press Insert > Player Coords.
  • A line under the first one, right click again. Press this time Insert > Player Angel.
  • Maximize GTA San Andreas again and go to the next position you want to save.

b. - Proxy-DLL

The Proxy-DLL is a DLL, which get's automatically activated when GTA San Andreas get's started. The "d3d9.dll", which is listed in the attachment of this post, shows you permanently the coordinates of the player and save them in different formates if you press the button F12.

To install it you must copy the file into your GTA San Andreas main folder (there where you can find the "gta_sa.exe"). If you start a new game you will see on the bottom left of the screen the coordinates of the player. Press F12 and end the game. You will see, that in your main GTA San Andreas folder is now a file "coords.txt". This file saves everytime you press F12 the coordinates in the format for maps, for SCM and the z-angel. We need only SCM and the z-angel.

Attention!
The DLL has the disadvantage, that the game begins to flickering. So before you start to run the finished script, you should move the DLL into another folder.


So, let's start to collect the different coordinates.

Here we want to place our CJ.


This different points will be the pathspoints for our camera.




My measurements revealed following coordinates (you can use them for tests yourself):

Code: [Select]
//CJ's Position:
Z-Angle: 175.351334
Script: 2582.972 -1743.250 23.273

//Path #1:
Z-Angle: 0.246362
Script: 2585.120 -2258.113 1.366

//Path #2:
Z-Angle: 359.755280
Script: 2583.599 -2125.722 0.540

//Path #3:
Z-Angle: 357.054321
Script: 2583.347 -2058.116 15.370

//Path #4:
Z-Angle: 2.947391
Script: 2582.560 -1941.235 16.447

//Path #5:
Z-Angle: 353.125641
Script: 2582.882 -1745.574 23.273

The Z-angle is mainly only important for CJ's position, because we will later let the camera in the script point to the next pathpoint. That last point is that one, where the camera should stop infront of CJ.


3. The Script

At first we create a copy of our first script. This one we open in SannyBuilder. Now we search the row, where we definated the spawnpoints and replace there the coordinates with the ones out of path #1 (CJ's position):

Code: [Select]
$SpawnX = 2582.972
$SpawnY = -1743.250
$SpawnZ = 23.273

Then we search the row, where we indicated CJ's Z-angle and replace it with the Z-angle out of path #1 (CJ's position):

Code: [Select]
0173: set_actor $PLAYER_ACTOR z_angle_to  175.351334
In this script we doesn't want that CJ will be spawned in a hydra. Therefore we search the codeplace, where we set CJ into a hydra and delete these one:

Code: [Select]
0247: request_model #hydra

:MAIN_2
0001: wait  0 ms
00D6: if  0
0248:   model #hydra available
004D: jump_if_false @MAIN_2
00A5: $vehicle = create_car #hydra at $SpawnX $SpawnY $SpawnZ
036A: put_actor $PLAYER_ACTOR in_car $vehicle
Delete this code!

Important is, that we let the following code as it is. Do not delete it:

Code: [Select]
016A: fade  1 ()  1000 ms
0001: wait  100 ms
03E6: remove_text_box

If this code would be deleted, the screen would be ingame only black.

If we compile and start the game now we will see, that in the end nothing is changed, expect CJ's startposition is replaced and he doesn't get's spawned in a hydra.

Here is the script again, if you have problems:

Code: [Select]
DEFINE OBJECTS 1
DEFINE OBJECT (no object) //unused

DEFINE MISSIONS 0

DEFINE EXTERNAL_SCRIPTS 0

DEFINE UNKNOWN_EMPTY_SEGMENT 0

DEFINE UNKNOWN_THREADS_MEMORY 0

//-------------MAIN---------------

                        
:MAIN_1
03A4: name_thread 'MAIN'
016A: fade  0 ()  0 ms

042C: set_total_missions_to  1
030D: set_total_mission_points_to  1
01F0: set_max_wanted_level_to  6
0111: set_wasted_busted_check_to  0 (disabled)
00C0: set_current_time  12  0

$SpawnX = 2582.972
$SpawnY = -1743.250
$SpawnZ = 23.273

04E4: unknown_refresh_game_renderer_at  $SpawnX $SpawnY
03CB: set_camera  $SpawnX $SpawnY $SpawnZ
062A: change_stat  165 (energy) to  999.0  // float
062A: change_stat  23 (muscle) to  999.0  // float
062A: change_stat  21 (fat) to  0.0  // float
062A: change_stat  163 (health) to  999.0  // float
062A: change_stat  160 (driving skill) to  999.0  // float
062A: change_stat  229 (bike skill) to  999.0  // float
062A: change_stat  223 (flying skill) to  999.0  // float
062A: change_stat  230 (cicle skill) to  999.0  // float
0629: change_stat  181 (islands unlocked) to  4  // integer see statdisp.dat
0629: change_stat  68 () to  0  // integer see statdisp.dat
0053: $PLAYER_CHAR = create_player #NULL at  $SpawnX $SpawnY $SpawnZ
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  175.351334

01B6: set_weather  1
087B: set_player $PLAYER_CHAR clothes "bballjackrstar" "bbjack"  0
087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS"  2
087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER"  3
087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD"  1
070D: $PLAYER_CHAR
04BB: select_interior  0  // select render area

01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
01B7: release_weather
016C: restart_if_wasted at  $SpawnX $SpawnY $SpawnZ angle  0.0 unknown  0

016A: fade  1 ()  1000 ms
0001: wait  100 ms
03E6: remove_text_box

:MAIN_3
0001: wait 2500 ms
0002: jump @MAIN_3

So, let's start to worry about the camera movements!

Animate the Camera

At first we should list the problems. Problems you should know clearly about:

1. The game has to render at first the surrounding areas.
2. In this script, CJ is not allowed to move, because otherwise he could just drop off the platform.
3. It should always pass some time before the camera starts moving, that the game could load everything.

Well. Fortunately this are solvable problems. We will freeze CJ and we will insert a 5 second 'wait-command', that the game has enough time to render everything.

At first we create a new thread, in which all our camera movements will run. (It is possible to use for this a mission aswell, but I think that's senthless. It is a matter of taste and makes the whole more complicated then it already is!)

To create a new thread we insert under the "remove_text_box"-command following code:

Code: [Select]
00D7: create_thread @CAM_001
So the thread will be created on the Label ":CAM_001". This one doesn't exist still yet, so have to add it. We are add it right under the whole code.

Code: [Select]
:CAM_001
Now the thread need a name. Furthermore we don't want that the thread does not immediately stop, so we simulate a endless loop (for testing).

Code: [Select]
:CAM_001
03A4: name_thread 'CAMERA'
0002: jump @CAM_100

:CAM_100
0001: wait 2500 ms
0002: jump @CAM_100

The next step is to place the camera to the wanted position and to insert the wait-command.

Code: [Select]
:CAM_001
03A4: name_thread 'CAMERA'

:CAM_002
015F: set_camera_position 2585.120 -2258.113 1.366 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.599 -2125.722 0.540 mode 2  
0001: wait 10000 ms
0002: jump @CAM_100

:CAM_100
0001: wait 2500 ms
0002: jump @CAM_100

That's like our thread look like in the end. Let's look a bit closer on the main routine:

Code: [Select]
:CAM_002
015F: set_camera_position 2585.120 -2258.113 1.366 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.599 -2125.722 0.540 mode 2  
0001: wait 10000 ms

The OpCode 015F: causes, that the camera will be placed on the first pathpoint we created. The rotation doesn't matter, because with the OpCode 0160: the camera targets to our pathpoint #2. With the 'mode' we tell the game, if the whole should be done immediately or over a certain time period.

Mode 1 = Move camera to the position
Mode 2 = Place camera immediately on the position

Just try it out.

Because we still can move CJ, we will freeze him now. Therefore we insert under "name_thread 'CAMERA'" the row:

Code: [Select]
01B4: toggle_player $PLAYER_CHAR can_move 0
Let's start now to let the camera moving over the whole path. Because we don't want, that the camera moves jerkily from pathpoint to pathpoint, we try again to change the type, so that our thread looks in the end like this:

Code: [Select]
:CAM_001
03A4: name_thread 'CAMERA'
01B4: toggle_player $PLAYER_CHAR can_move 0

:CAM_002
015F: set_camera_position 2585.120 -2258.113 1.366 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.599 -2125.722 0.540 mode 2    
0001: wait 10000 ms

:CAM_003
015F: set_camera_position 2583.599 -2125.722 0.540 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.347 -2058.116 15.370 mode 1

:CAM_004
015F: set_camera_position 2583.347 -2058.116 15.370 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.560 -1941.235 16.447 mode 1

:CAM_005
015F: set_camera_position 2582.560 -1941.235 16.447 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.882 -1745.574 23.273 mode 1

:CAM_006
015F: set_camera_position 2582.882 -1745.574 23.273 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.972 -1743.250 23.273 mode 1    
0002: jump @CAM_100

:CAM_100
0001: wait 2500 ms
0002: jump @CAM_100

Compile. Start the game. Ready. However we will note, that the camera is moving along our path, but much to fast.

Therefore we must change our script again. This can be done, if we change the so called "Transverse-time" with the OpCode 0460:!

We insert under the first placement of the camera following row in:

Code: [Select]
0460: set_camera_transverse_delay 0.0 time 10000
If we compile our script now, we will see, that everything is slower, but it get's clearly too, that the camera does move through walls. This is because we tell the game immediately new coordinates and do not wait, till it has reached the previous ones. To change this we don't must do much. We only must write under every movement a wait-command over 10000 ms, because the camera needs the time to reach every pathpoint.

If we have done that our thread looks in the end like this:

Code: [Select]
:CAM_001
03A4: name_thread 'CAMERA'
01B4: toggle_player $PLAYER_CHAR can_move 0

:CAM_002
015F: set_camera_position 2585.120 -2258.113 1.366 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.599 -2125.722 0.540 mode 2    
0460: set_camera_transverse_delay 0.0 time 10000
0001: wait 10000 ms

:CAM_003
015F: set_camera_position 2583.599 -2125.722 0.540 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.347 -2058.116 15.370 mode 1
0001: wait 10000 ms

:CAM_004
015F: set_camera_position 2583.347 -2058.116 15.370 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.560 -1941.235 16.447 mode 1
0001: wait 10000 ms

:CAM_005
015F: set_camera_position 2582.560 -1941.235 16.447 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.882 -1745.574 23.273 mode 1
0001: wait 10000 ms

:CAM_006
015F: set_camera_position 2582.882 -1745.574 23.273 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.972 -1743.250 23.273 mode 1
0001: wait 10000 ms    
0002: jump @CAM_100

:CAM_100
0001: wait 2500 ms
0002: jump @CAM_100

Compile, Start, Ready. This time it works!

We can let the whole look a bit better now, for example if we show a "Widescreen" and hide the HUD.

Therefore we add under the row, where we disabled the player function to be able to move, following row:

Code: [Select]
02A3: toggle_widescreen 1 //Widescreen on  (1 = on | 0 = off) | If on, Radar + HUD = off!
0826: toggle_hud 0 //HUD off (0 = off | 1 = on)
0581: toggle_radar 0 //Radar off (0 = off | 1 = on)

If the Widescreen is enabled, you are not able anylonger to open the menü. Therefore I recommend to change everything in the end again. Plus we doesn't want that the thread is still in a endless loop, so we end it.

So we change the last codesection like this:

Code: [Select]
:CAM_100
0001: wait 10000 ms
02A3: toggle_widescreen 0 //Widescreen off
0826: toggle_hud 1 //HUD on
0581: toggle_radar 1 //Radar on
004E: end_thread

Our whole thread looks now like this:

Code: [Select]
:CAM_001
03A4: name_thread 'CAMERA'
01B4: toggle_player $PLAYER_CHAR can_move 0
02A3: toggle_widescreen 1 //Widescreen on  (1 = on | 0 = off) | If on, Radar + HUD = off!
0826: toggle_hud 0 //HUD off (0 = off | 1 = on)
0581: toggle_radar 0 //Radar off (0 = off | 1 = on)

:CAM_002
015F: set_camera_position 2585.120 -2258.113 1.366 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.599 -2125.722 0.540 mode 2    
0460: set_camera_transverse_delay 0.0 time 10000
0001: wait 10000 ms

:CAM_003
015F: set_camera_position 2583.599 -2125.722 0.540 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.347 -2058.116 15.370 mode 1
0001: wait 10000 ms

:CAM_004
015F: set_camera_position 2583.347 -2058.116 15.370 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.560 -1941.235 16.447 mode 1
0001: wait 10000 ms

:CAM_005
015F: set_camera_position 2582.560 -1941.235 16.447 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.882 -1745.574 23.273 mode 1
0001: wait 10000 ms

:CAM_006
015F: set_camera_position 2582.882 -1745.574 23.273 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.972 -1743.250 23.273 mode 1
0001: wait 10000 ms

:CAM_100
0001: wait 10000 ms
02A3: toggle_widescreen 0 //Widescreen off
0826: toggle_hud 1 //HUD on
0581: toggle_radar 1 //Radar on
004E: end_thread

And our whole script like this:

Code: [Select]
DEFINE OBJECTS 1
DEFINE OBJECT (no object) //unused

DEFINE MISSIONS 0

DEFINE EXTERNAL_SCRIPTS 0

DEFINE UNKNOWN_EMPTY_SEGMENT 0

DEFINE UNKNOWN_THREADS_MEMORY 0

//-------------MAIN---------------

                        
:MAIN_1
03A4: name_thread 'MAIN'
016A: fade  0 ()  0 ms

042C: set_total_missions_to  1
030D: set_total_mission_points_to  1
01F0: set_max_wanted_level_to  6
0111: set_wasted_busted_check_to  0 (disabled)
00C0: set_current_time  12  0

$SpawnX = 2582.972
$SpawnY = -1743.250
$SpawnZ = 23.273

04E4: unknown_refresh_game_renderer_at  $SpawnX $SpawnY
03CB: set_camera  $SpawnX $SpawnY $SpawnZ
062A: change_stat  165 (energy) to  999.0  // float
062A: change_stat  23 (muscle) to  999.0  // float
062A: change_stat  21 (fat) to  0.0  // float
062A: change_stat  163 (health) to  999.0  // float
062A: change_stat  160 (driving skill) to  999.0  // float
062A: change_stat  229 (bike skill) to  999.0  // float
062A: change_stat  223 (flying skill) to  999.0  // float
062A: change_stat  230 (cicle skill) to  999.0  // float
0629: change_stat  181 (islands unlocked) to  4  // integer see statdisp.dat
0629: change_stat  68 () to  0  // integer see statdisp.dat
0053: $PLAYER_CHAR = create_player #NULL at  $SpawnX $SpawnY $SpawnZ
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  175.351334

01B6: set_weather  1
087B: set_player $PLAYER_CHAR clothes "bballjackrstar" "bbjack"  0
087B: set_player $PLAYER_CHAR clothes "JEANSDENIM" "JEANS"  2
087B: set_player $PLAYER_CHAR clothes "SNEAKERBINCBLK" "SNEAKER"  3
087B: set_player $PLAYER_CHAR clothes "PLAYER_FACE" "HEAD"  1
070D: rebuild_player $PLAYER_CHAR
04BB: select_interior  0  // select render area

01B4: toggle_player $PLAYER_CHAR can_move 1
01B7: release_weather
016C: restart_if_wasted at  $SpawnX $SpawnY $SpawnZ angle  0.0 unknown  0

016A: fade  1 ()  1000 ms
0001: wait  100 ms
03E6: remove_text_box
00D7: create_thread @CAM_001

:MAIN_3
0001: wait 2500 ms
0002: jump @MAIN_3

:CAM_001
03A4: name_thread 'CAMERA'
01B4: toggle_player $PLAYER_CHAR can_move 0
02A3: toggle_widescreen 1 //Widescreen on  (1 = on | 0 = off) | If on, Radar + HUD = off!
0826: toggle_hud 0 //HUD off (0 = off | 1 = on)
0581: toggle_radar 0 //Radar off (0 = off | 1 = on)

:CAM_002
015F: set_camera_position 2585.120 -2258.113 1.366 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.599 -2125.722 0.540 mode 2    
0460: set_camera_transverse_delay 0.0 time 10000
0001: wait 10000 ms

:CAM_003
015F: set_camera_position 2583.599 -2125.722 0.540 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2583.347 -2058.116 15.370 mode 1
0001: wait 10000 ms

:CAM_004
015F: set_camera_position 2583.347 -2058.116 15.370 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.560 -1941.235 16.447 mode 1
0001: wait 10000 ms

:CAM_005
015F: set_camera_position 2582.560 -1941.235 16.447 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.882 -1745.574 23.273 mode 1
0001: wait 10000 ms

:CAM_006
015F: set_camera_position 2582.882 -1745.574 23.273 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2582.972 -1743.250 23.273 mode 1
0001: wait 10000 ms

:CAM_100
0001: wait 10000 ms
02A3: toggle_widescreen 0 //Widescreen off
0826: toggle_hud 1 //HUD on
0581: toggle_radar 1 //Radar on
004E: end_thread

You can play now a bit with the thread. Just try out to set Point_Camera everywhere on CJ, or simply to insert other coordinates and winding paths.

4. Abstract

We did learned a method of the camera movement. It exists many more, which we doesn't learned yet, but this one is the easiest. It has the side effect to stop for a short time between the pathpoints. That can be used for example to insert in a videoprogramm different text's, but is most of the time inappropriate for direct scenes. Therefore we will learn with the time different methods.

The next step for us will be, to place the camera on a fixed point, which steadily follows CJ and then we will create PEDS and try to animate them.

- Camera Movement_1_Source+SCM -
- dsd9 -
« Last Edit: November 01, 2009, 09:28:30 AM by ColdDeath »

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« Reply #3 on: October 26, 2008, 09:20:24 AM »
Part 3 - Complexe Scripts & Scenes


Because we are able now to move a camera, we will try to write a more complexe script. Better spoken: We will try now to script our first real videosequence. Then I will give you some further tips, how you could form your own script.

In general you should have understand now the basics and we can start working now on unknown things. Our plan looks like this ( no comments to that picture :P ):



Some Ballas will drive on the violett line. Where the "car" is painted, there will be parked a car. From behind will come some Groves as reinforcement.

In the end the result will be, that you will rewrite the same script I have already scripted!



It may be that you think now "Oh my. I never will able to do something like that." Yes, it looks complicated and complexe, but it's not impossible. You will be successfull, if you have understand the 2 previous chapters. You just need time and patience to understand it.

In this chapter, Part 3 - Complexe Scripts & Scenes, we will create a whole videosequence, from the beginning to the end, step by step. 50 % of the work is planning. We will think about the camera movements and the expiry. Where the people should run along, and how much. What do we need then? What must we think about?


3.1. Measuring Of Coordinates
At first we must take care of the coordinates again. So let's start.

Everything what has to do with cars we must do in cars. So the first thing to do is, that we get the car we want or spawn it with a Car Spawn Tool. Then we drive to the right position and place it with the right angle. In my case it is a 'Greenwood'. While sitting in the car we extract the coordinates, because that are the ones, where the car should later be placed.

Then we extract all needed and left coordinates. But this we will do step by step and NOT just immediately after the start, because then we can act better and everything stays clean.


3.2. The Script - The Initialization
At first we must think about, what Objects we will need (PEDs, Cars, Weapons), because these ones we must load before using them!

I used and have "requested" (like we know it from the hydra) in my version following Objects:

Code: [Select]
0247: load_model #GREENWOO  //Car: Greenwood
0247: load_model #TAHOMA    //Car: Tahoma
0247: load_model #ENFORCER  //Car: Enforcer
0247: load_model #COPCARLA  //Car: Copcar (LSPD)
0247: load_model #FAM1      //PED: Grove_1
0247: load_model #FAM2      //PED: Grove_2
0247: load_model #FAM3      //PED: Grove_3
0247: load_model #BALLAS1   //PED: Balla_1
0247: load_model #BALLAS2   //PED: Balla_2
0247: load_model #BALLAS3   //PED: Balla_3
0247: load_model #LAPD1     //PED: Policemen
0247: load_model #SWAT      //PED: SWAT
0247: load_model #TEC9      //GUN: Tec9
0247: load_model #COLT45    //GUN: Pistol
0247: load_model #MP5LNG    //GUN: AK-47
0247: load_model #AK47      //GUN: MP5
0247: load_model #MICRO_UZI //GUN: UZI
0247: load_model #SNIPER    //GUN: Sniper Rifle
0247: load_model #M4        //GUN: M4A1
0247: load_model #CELLPHONE //OBJECT: Mobile
038B: load_request_models

That causes a thread which looks at the moment like this:

Code: [Select]
:SCENE_001
03A4: name_thread 'SCENE1'
01B4: toggle_player $PLAYER_CHAR can_move 0
02A3: toggle_widescreen 0 //Widescreen off  (1 = on | 0 = off)
0826: toggle_hud 0 //HUD off (1 = on | 0 = off)
0581: toggle_radar 0 //Radar off (1 = on | 0 = off)

:SCENE_002
0247: load_model #GREENWOO  //Car: Greenwood
0247: load_model #TAHOMA    //Car: Tahoma
0247: load_model #ENFORCER  //Car: Enforcer
0247: load_model #COPCARLA  //Car: Copcar (LSPD)
0247: load_model #FAM1      //PED: Grove_1



0247: load_model #FAM2      //PED: Grove_2
0247: load_model #FAM3      //PED: Grove_3
0247: load_model #BALLAS1   //PED: Balla_1
0247: load_model #BALLAS2   //PED: Balla_2
0247: load_model #BALLAS3   //PED: Balla_3
0247: load_model #LAPD1     //PED: Policemen
0247: load_model #SWAT      //PED: SWAT
0247: load_model #TEC9      //GUN: Tec9
0247: load_model #COLT45    //GUN: Pistol
0247: load_model #MP5LNG    //GUN: AK-47
0247: load_model #AK47      //GUN: MP5
0247: load_model #MICRO_UZI //GUN: UZI
0247: load_model #SNIPER    //GUN: Sniper Rifle
0247: load_model #M4        //GUN: M4A1
0247: load_model #CELLPHONE //OBJECT: Mobile
038B: load_request_models

:SCENE_999
0249: release_model #GREENWOO  //Car: Greenwood
0249: release_model #TAHOMA    //Car: Tahoma
0249: release_model #ENFORCER  //Car: Enforcer
0249: release_model #COPCARLA  //Car: Copcar (LSPD)
0249: release_model #FAM1      //PED: Grove_1
0249: release_model #FAM2      //PED: Grove_2
0249: release_model #FAM3      //PED: Grove_3
0249: release_model #BALLAS1   //PED: Balla_1
0249: release_model #BALLAS2   //PED: Balla_2
0249: release_model #BALLAS3   //PED: Balla_3
0249: release_model #LAPD1     //PED: Policemen
0249: release_model #SWAT      //PED: SWAT
0249: release_model #TEC9      //GUN: Tec9
0249: release_model #COLT45    //GUN: Pistol
0249: release_model #MP5LNG    //GUN: AK-47
0249: release_model #AK47      //GUN: MP5
0249: release_model #MICRO_UZI //GUN: UZI
0249: release_model #SNIPER    //GUN: Sniper Rifle
0249: release_model #M4        //GUN: M4A1
0249: release_model #CELLPHONE //OBJECT: Mobile
end_thread

Currently it doesn't happen much. The Initialization is nothing more then the preparing for the actuall operation.
At first I turn the HUD and the radar off. Then we write the Label for the Initialization :SCENE_002. There we add the left code, too. The Label :SCENE_999 is in every case the last thing in SCM. Here get's the memory set free again and the thread ends.

Out of clarity reasons we create a second Initialization Label under "038B: load_request_models" and name it ":SCENE_003".
Here we will create now the PEDs and cars and assign them weapons & statistics.

At first we place the cars. You can place them elsewhere too, if you measure the coordinates yourself. Every coordinate I've used is written down in this script, so. For you they can be totally different. But for now I recommend that you work with my coordinates, that you understand the code, before you experimentate with your own coordinates.

Code: [Select]
00A5: 0@ = create_car #GREENWOO at 2483.499 -1667.010 13.344
00A5: 1@ = create_car #TAHOMA at 2290.188 -1661.210 14.519
0175: set_car 0@ Z_angle_to 280.0
0175: set_car 1@ Z_angle_to 267.363403
0674: set_car_model 0@ numberplate "GROVE4L_"  
0674: set_car_model 1@ numberplate "BALLAS__"

We are creating 2 cars. A "Tahoma", which the Ballas will drive right into the Grove Street, and a "Greenwood", which can be used as cover. Then we rotate the cars in the right direction. For the Tahoma this doesn't matter, it steers automatically when it drives along the path, but because the camera starts just next to it, it looks a bit weird.

With the OpCode 0674 we change the numberplates of the cars: The Greenwood (variables 0@) get's "GROVE4L" and the Tahoma "BALLAS". Because there is set a fixed number of signs we must fill the empty place with spaces (space = _).

Let's handle the PEDs (Pedestrians = Actors, NPCs). To create a "Actor" we use the OpCode 009A: . That causes for the Groves following code, which we insert under the cars:

Code: [Select]
009A: 11@ = create_actor_pedtype 8 model #FAM1 at 2481.606 -1700.239 13.524
009A: 12@ = create_actor_pedtype 8 model #FAM3 at 2480.171 -1704.558 13.532
009A: 13@ = create_actor_pedtype 8 model #FAM2 at 2459.221 -1687.116 13.543
009A: 14@ = create_actor_pedtype 8 model #FAM3 at 2463.329 -1684.491 13.534
0173: set_actor 11@ Z_angle_to 7.644567
0173: set_actor 12@ Z_angle_to 271.260498
0173: set_actor 13@ Z_angle_to 275.320099
0173: set_actor 14@ Z_angle_to 150.583267

The variables 11@, 12@, 13@ and 14@ are our 4 Groves in the beginning. They have the models #FAM1, #FAM2 and #FAM3. The last 3 variables are the positions. The Type is the gang affiliation.

In GTA San Andreas exist following "Gangs" or "PED-Types":

Code: [Select]
0=player1
1=player2
2=player_network
3=player_unused
4=civmale
5=civfemale
6=cop
7=gang1
8=gang2
9=gang3
10=gang4
11=gang5
12=gang6
13=gang7
14=gang8
15=gang9
16=gang10
17=dealer
18=medic
19=fireman
18=criminal
19=bum
20=prostitute
21=special)

In the folder "data" of your GTA SA Installation is a file, called "pedgrp.dat". Search there for "gang1" (for example) and you will find out, that it's a Ballas gang. Our 4 Groves belongs to Type 8 = Gang2 (Families aka Groves).

With the OpCode 0173 we rotate the Groves in the wanted direction. It doesn't matter so, where we create the Ballas, because they will be teleported later directly into the cars. So the Ballas needs the following code:

Code: [Select]
009A: 15@ = create_actor_pedtype 7 model #BALLAS1 at 0.0 0.0 0.0
009A: 16@ = create_actor_pedtype 7 model #BALLAS2 at 0.0 0.0 0.0
009A: 17@ = create_actor_pedtype 7 model #BALLAS3 at 0.0 0.0 0.0
009A: 18@ = create_actor_pedtype 7 model #BALLAS1 at 0.0 0.0 0.0
0173: set_actor 15@ Z_angle_to 0.0
0173: set_actor 16@ Z_angle_to 0.0
0173: set_actor 17@ Z_angle_to 0.0
0173: set_actor 18@ Z_angle_to 0.0

At next we assign the Groves to the group of the player, because then they won't shoot back, if you accidentally shoot them.

Code: [Select]
0631: put_actor 11@ in_group $PLAYER_GROUP
0631: put_actor 12@ in_group $PLAYER_GROUP
0631: put_actor 13@ in_group $PLAYER_GROUP
0631: put_actor 14@ in_group $PLAYER_GROUP

That our Ballas are able to drive into the car, we place them into it now. Therefore we need a driver. The other 3 PEDs will we set randomly on the free seats. (Because of that -1).

Code: [Select]
072A: put_actor 15@ into_car 1@ driverseat
072B: put_actor 16@ into_car 1@ passengerseat -1
072B: put_actor 17@ into_car 1@ passengerseat -1
072B: put_actor 18@ into_car 1@ passengerseat -1

Now our gangmembers need weapons. Then the weapons are senthless, if we haven't loaded them. To do that we need following code:

Code: [Select]
01B2: give_actor 11@ weapon 32 ammo 9999        //TEC9
01B2: give_actor 12@ weapon 29 ammo 9999        //MP5
01B2: give_actor 13@ weapon 22 ammo 9999        //PISTOL
01B2: give_actor 14@ weapon 29 ammo 9999        //MP5
01B9: set_actor 11@ armed_weapon_to 32
01B9: set_actor 12@ armed_weapon_to 29
01B9: set_actor 13@ armed_weapon_to 22
01B9: set_actor 14@ armed_weapon_to 29
01B2: give_actor 15@ weapon 30 ammo 9999        //AK-47
01B2: give_actor 16@ weapon 28 ammo 9999        //UZI
01B2: give_actor 17@ weapon 28 ammo 9999        //UZI
01B2: give_actor 18@ weapon 22 ammo 9999        //PISTOL
01B9: set_actor 15@ armed_weapon_to 30
01B9: set_actor 16@ armed_weapon_to 28
01B9: set_actor 17@ armed_weapon_to 28
01B9: set_actor 18@ armed_weapon_to 22

Because we doesn't want initially that our guys die, that they only try to shoot themselfs, they get a godmode against bullets:

Code: [Select]
02AB: set_actor 11@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 12@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 13@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 14@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 15@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 16@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 17@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 18@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 0@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 1@ immunities BP 1 FP 0 EP 0 DP 0 SP 0

1 = enable
0 = disable

Example:
BP = Bullet Proof
FP = Fire Proof
EP = Explosion Proof

The cars have now a godmode, because single bullets could hit the car. The cars could start to burn, what would have the result that the PEDs in the environment would run away, what we don't want.

In the end of the Initialisation we force the PEDs to use ONLY weapons. Otherwise it could be, that they would beat themselvs:

Code: [Select]
02E2: set_actor 11@ weapon_accuracy_to 100  
02E2: set_actor 12@ weapon_accuracy_to 100
02E2: set_actor 13@ weapon_accuracy_to 100
02E2: set_actor 14@ weapon_accuracy_to 100
02E2: set_actor 15@ weapon_accuracy_to 100
02E2: set_actor 16@ weapon_accuracy_to 100
02E2: set_actor 17@ weapon_accuracy_to 100
02E2: set_actor 18@ weapon_accuracy_to 100

3.3. Driving Cars
Because we have everything loaded and prepared now we want to add the first few animations.

At first we place the camera next to the Balla's car.

Code: [Select]
:SCENE_004
015F: set_camera_position 2287.091 -1664.189 14.930 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2341.206 -1659.069 13.077 mode 2

After that we begin to create a path. A path exist out of several points, on which we can let an actor (PED) or a car drive along. But at first we must delete a eventuell existing path. After that we add point by point the path:

Code: [Select]
05D6: clear_scmpath
05D7: add_point_to_scmpath  2290.188 -1661.210 14.519
05D7: add_point_to_scmpath  2341.206 -1659.069 13.077
05D7: add_point_to_scmpath  2476.207 -1659.009 13.024

Now we set, like in Part 2, the Transverse Delay of the camera to 10000 and wait till everything loaded:

Code: [Select]
0460: set_camera_transverse_delay 0.0 time 10000
0001: wait 10000 ms

Now we will tell the PED, which sits on the driverseat, that he should drive the path along. We will link him and the car to the path:

Code: [Select]
:SCENE_005
06BB: set_actor 15@ drive_car 1@ speed 10.0 along_SCM_path

The worths should be clear now.
Some more camera movements for the text later in the video editing program:

Code: [Select]
015F: set_camera_position 2290.188 -1661.210 34.519 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2341.206 -1659.069 13.077 mode 1
0001: wait 10000 ms
015F: set_camera_position 2476.207 -1656.009 13.024 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2470.207 -1659.009 14.024 mode 1
0001: wait 13500 ms

We wait at the end 3500 ms, because we must wait, till the car has reached the last pathpoint. After that we want that our PEDs get out of the car:

Code: [Select]
05CF: AS_actor 15@ exit_car 1@ when_at 2476.207 -1659.009 13.024    
05CF: AS_actor 16@ exit_car 1@ when_at 2476.207 -1659.009 13.024
05CF: AS_actor 17@ exit_car 1@ when_at 2476.207 -1659.009 13.024
05CF: AS_actor 18@ exit_car 1@ when_at 2476.207 -1659.009 13.024

3.4. The Beginning of the Gangwar
Nearly the rest of the script is only changing coordinates and camera movements like we just did it. We begin at first to move our 4 Groves into the Greenwoods direction. They will attack the Ballas automatically, because we have assigned them different gangs, which are definated among themselves in the pedgrp.dat on HATE!

Code: [Select]
05D6: clear_scmpath
05D7: add_point_to_scmpath  2483.308 -1670.123 13.336
05D7: add_point_to_scmpath  2482.613 -1682.936 13.330
05D8: AS_assign_scmpath to_actor 11@ flags 6 1
05D8: AS_assign_scmpath to_actor 12@ flags 6 1
05D8: AS_assign_scmpath to_actor 13@ flags 6 1
05D8: AS_assign_scmpath to_actor 14@ flags 6 1

To let the happenings not being boring we let the camera rotate around the whole:

Code: [Select]
0460: set_camera_transverse_delay 0.0 time 5000
015F: set_camera_position 2497.089 -1667.746 21.968 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2476.207 -1659.009 13.024 mode 1
0001: wait 7000 ms
015F: set_camera_position 2482.613 -1682.936 13.330 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2476.207 -1659.009 13.024 mode 1
0001: wait 7000 ms
015F: set_camera_position 2464.332 -1673.342 19.127 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2476.207 -1659.009 13.024 mode 1
0001: wait 7000 ms
015F: set_camera_position 2482.581 -1647.620 18.931 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.499 -1667.010 13.344 mode 1
0001: wait 10000 ms
« Last Edit: November 03, 2009, 11:03:01 AM by ColdDeath »

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« Reply #4 on: October 26, 2008, 09:28:46 AM »
3.5. Calling Reinforcement
Out Script is already looking quiet good, but it happend till yet not that much. Therefore we will let a Grove call reinforcement and let some guys die aswell. Nobody survives a endless fight.  

At first we let the screen getting black, that the viewer doesn't notice the new PED immediately.

Code: [Select]
:SCENE_007
016A: fade 0 time 500
0001: wait 500 ms

The wait-time is needed, because it is, like the camera movement aswell, asynchon. That means, it get's started and while that more commands get's executed. If we wouldn't wait, everything would be to fast visible again.

Code: [Select]
:SCENE_008
009A: 21@ = create_actor_pedtype 8 model #FAM2 at 2515.713 -1680.229 13.466  
0173: set_actor 21@ Z_angle_to 255.938110
01B2: give_actor 21@ weapon 29 ammo 9999        //MP5
02E2: set_actor 21@ weapon_accuracy_to 100  
02AB: set_actor 21@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
015F: set_camera_position 2516.765 -1680.873 13.456 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2515.713 -1680.229 13.966 mode 2

Should be clear, because it isn't different then the code above. Next goal is, that our PED speaks:

Code: [Select]
0729: AS_actor 21@ hold_cellphone 1
0967: actor 21@ move_mouth 100 ms

100 ms seems to be short, but is the time between mouth open and mouth closed. Then again mouth open, closed ... till the whole get's cancelled again.
Now we let the PED appear infront of the camera:

Code: [Select]
0001: wait 500 ms
016A: fade 1 time 500
0001: wait 10000 ms
0729: AS_actor 21@ hold_cellphone 0

Then we wait a moment and force the PED to hang up. We let him take his weapon in his hand and let him run then to the middlepoint of the Grove Street:

Code: [Select]
05D3: AS_actor 21@ goto_point 2483.308 -1670.123 13.336 mode 6 7500 ms
0001: wait 100 ms
01B9: set_actor 21@ armed_weapon_to 29
0001: wait 900 ms
015F: set_camera_position 2464.332 -1673.342 19.127 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.499 -1667.010 13.344 mode 1
0001: wait 10000 ms

With the OpCode 05D3 we tell the PED, that he should move with Mode 6 (Run) to a pathpoint. If he hasn't arrived the pathpoint in max. 7500 ms, he get's teleportated to the point; if he doesn't get killed or get's involved into a fight. Then the camera will be moved a bit, too.

Now the reinforcement is on the way:

Code: [Select]
:SCENE_009
016A: fade 0 time 500
0001: wait 500 ms
009A: 5@ = create_actor_pedtype 7 model #BALLAS1 at 2481.807 -1719.387 13.546
009A: 6@ = create_actor_pedtype 7 model #BALLAS2 at 2481.184 -1722.680 13.555
009A: 7@ = create_actor_pedtype 7 model #BALLAS3 at 2482.469 -1715.928 13.543
009A: 8@ = create_actor_pedtype 7 model #BALLAS1 at 2479.322 -1712.078 13.537
009A: 22@ = create_actor_pedtype 8 model #FAM1 at 2510.481 -1696.526 13.480
009A: 23@ = create_actor_pedtype 8 model #FAM3 at 2502.140 -1643.145 13.783
009A: 24@ = create_actor_pedtype 8 model #FAM2 at 2528.099 -1690.698 13.658
009A: 25@ = create_actor_pedtype 8 model #FAM3 at 2527.253 -1686.881 13.808
01B2: give_actor 22@ weapon 32 ammo 9999        //TEC9
01B2: give_actor 23@ weapon 29 ammo 9999        //MP5
01B2: give_actor 24@ weapon 22 ammo 9999        //PISTOL
01B2: give_actor 25@ weapon 29 ammo 9999        //MP5
01B9: set_actor 22@ armed_weapon_to 32
01B9: set_actor 23@ armed_weapon_to 29
01B9: set_actor 24@ armed_weapon_to 22
01B9: set_actor 25@ armed_weapon_to 29
01B2: give_actor 5@ weapon 30 ammo 9999        //AK-47
01B2: give_actor 6@ weapon 28 ammo 9999        //UZI
01B2: give_actor 7@ weapon 28 ammo 9999        //UZI
01B2: give_actor 8@ weapon 22 ammo 9999        //PISTOL
01B9: set_actor 5@ armed_weapon_to 30
01B9: set_actor 6@ armed_weapon_to 28
01B9: set_actor 7@ armed_weapon_to 28
01B9: set_actor 8@ armed_weapon_to 22
02AB: set_actor 22@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 23@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 24@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 25@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 5@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 6@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 7@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 8@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02E2: set_actor 22@ weapon_accuracy_to 100  
02E2: set_actor 23@ weapon_accuracy_to 100
02E2: set_actor 24@ weapon_accuracy_to 100
02E2: set_actor 25@ weapon_accuracy_to 100
02E2: set_actor 5@ weapon_accuracy_to 100
02E2: set_actor 6@ weapon_accuracy_to 100
02E2: set_actor 7@ weapon_accuracy_to 100
02E2: set_actor 8@ weapon_accuracy_to 100

It get's 8 new PEDs created and "initialisated". Exactly like we did it above.

Now we will undo the fade and place the camera, too.

Code: [Select]
:SCENE_010
0460: set_camera_transverse_delay 0.0 time 7000
015F: set_camera_position 2482.613 -1682.936 13.330 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2482.613 -1685.936 13.330 mode 2
016A: fade 1 time 500
0001: wait 700 ms

Now we disable the godmode of the old PDDs and let the Ballas run to the middlepoint. Then we animate the camera.

Code: [Select]
02AB: set_actor 11@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 12@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 13@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 14@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 15@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 16@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 17@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 18@ immunities BP 0 FP 0 EP 0 DP 0 SP 0  
05D6: clear_scmpath
05D7: add_point_to_scmpath  2483.797 -1685.592 13.508
05D7: add_point_to_scmpath  2490.620 -1671.115 13.336
05D8: AS_assign_scmpath to_actor 5@ flags 6 1
05D8: AS_assign_scmpath to_actor 6@ flags 6 1
05D8: AS_assign_scmpath to_actor 7@ flags 6 1
05D8: AS_assign_scmpath to_actor 8@ flags 6 1
015F: set_camera_position 2476.207 -1659.009 23.024 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.499 -1667.010 13.344 mode 1  
0160: set_camera_point_at 2515.713 -1680.229 13.466 mode 1

... and the Groves starts moving as reinforcement forwards...

Code: [Select]
:SCENE_011
05D6: clear_scmpath
05D7: add_point_to_scmpath  2490.620 -1671.115 13.336
05D8: AS_assign_scmpath to_actor 22@ flags 6 1
05D8: AS_assign_scmpath to_actor 23@ flags 6 1
05D8: AS_assign_scmpath to_actor 24@ flags 6 1
05D8: AS_assign_scmpath to_actor 25@ flags 6 1
0001: wait 7000 ms

With another swing the viewer get's a complete overview over the battlefield.

Our Ballas have a secret weapon: A sniper! We will bring him now into the fight. Therefore we need a fade from the Type 0:

Code: [Select]
:SCENE_012
015F: set_camera_position 2513.292 -1666.519 13.570 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2490.620 -1671.115 13.336 mode 2
0001: wait 10000 ms
016A: fade 0 time 500
0001: wait 500 ms

And again the same with other PEDs:

Code: [Select]
:SCENE_013
05D6: clear_scmpath
05D7: add_point_to_scmpath 2528.646 -1667.925 15.169
05D7: add_point_to_scmpath 2523.344 -1669.096 14.978
05D7: add_point_to_scmpath  2490.620 -1671.115 13.336
015F: set_camera_position 2524.079 -1666.532 15.059 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2523.344 -1669.096 14.978 mode 2
009A: 9@ = create_actor_pedtype 7 model #BALLAS2 at 2528.646 -1667.925 15.169
01B2: give_actor 9@ weapon 34 ammo 9999        //SNIPER
02E2: set_actor 9@ weapon_accuracy_to 100  
02AB: set_actor 9@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
01B9: set_actor 9@ armed_weapon_to 34

Create SCM Path, place Camera, create Model, distribute Weapons and set Immunities.

Because the sniper is something special, we want that he firstly only walks fast, nut runs. To do that, we must change a Flag in the SCM Path. Insteat of 6 we use 4!

Code: [Select]
:SCENE_014
05D8: AS_assign_scmpath to_actor 9@ flags 4 1
016A: fade 1 time 500
0001: wait 10000 ms

We wait till the sniper has moves passed us and opened the fire. Then we place the camera on the roof of CJ's house, that we have an better overview. With a swing we let the camera rotate to the mainfight again.

Code: [Select]
:SCENE_015
016A: fade 0 time 500
0001: wait 1000 ms
016A: fade 1 time 500
0001: wait 500 ms
015F: set_camera_position 2494.763 -1690.037 21.657 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2513.430 -1670.087 13.513 mode 2
0001: wait 7500 ms

:SCENE_016
0460: set_camera_transverse_delay 0.0 time 25000
0160: set_camera_point_at 2467.655 -1671.798 13.489 mode 1
0001: wait 25000 ms

3.6. The Police Cleares The Situation
Now we give the whole an end. Through the intervention of the police and the Los Santos SWAT Unit the Gangwar will be ended. Therefore we let the camera swing once again to the entrance of the Grove Street, because from there the police will come.

Code: [Select]
0460: set_camera_transverse_delay 0.0 time 7000
015F: set_camera_position 2490.620 -1671.115 17.336  rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.797 -1685.592 13.508 mode 1
0001: wait 10000 ms

Nowe we must create at the beginning 2 cars, place it's occupants and let the cars drive along the path. The problem: The cars should drive along 2 different paths. And the gang Police doesn't  intervinate automatically. So we use some tricks, but more to that later.

Let's start with the same Initialisation like at the beginning:

Code: [Select]
:SCENE_017
00A5: 3@ = create_car #ENFORCER at 2342.256 -1655.591 12.988
00A5: 2@ = create_car #COPCARLA at 2345.657 -1660.752 13.045
009A: 26@ = create_actor_pedtype 9 model #LAPD1 at 0.0 0.0 0.0
009A: 27@ = create_actor_pedtype 9 model #LAPD1 at 0.0 0.0 0.0
009A: 28@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0
009A: 29@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0
009A: 30@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0
009A: 31@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0
01B2: give_actor 26@ weapon 22 ammo 9999        //PISTOL
01B2: give_actor 27@ weapon 22 ammo 9999        //PISTOL
01B9: set_actor 26@ armed_weapon_to 22
01B9: set_actor 27@ armed_weapon_to 22
01B2: give_actor 28@ weapon 28 ammo 9999        //UZI
01B2: give_actor 29@ weapon 28 ammo 9999        //UZI
01B2: give_actor 30@ weapon 28 ammo 9999        //UZI
01B2: give_actor 31@ weapon 28 ammo 9999        //UZI
01B9: set_actor 28@ armed_weapon_to 28
01B9: set_actor 29@ armed_weapon_to 28
01B9: set_actor 30@ armed_weapon_to 28
01B9: set_actor 31@ armed_weapon_to 28
02AB: set_actor 26@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 27@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 28@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 29@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 30@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 31@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 2@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 3@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
072A: put_actor 26@ into_car 2@ driverseat
072B: put_actor 27@ into_car 2@ passengerseat -1
072A: put_actor 28@ into_car 3@ driverseat  
072B: put_actor 29@ into_car 3@ passengerseat -1
072B: put_actor 30@ into_car 3@ passengerseat -1  
072B: put_actor 31@ into_car 3@ passengerseat -1

Now it's get interesting. The camera still swings, when the cars are driving into the field of view. The cars should drive then already. Therefore the goal is, to lose no time and bind to the path. But 2 at the same time? The trick here is to create the paths one after the other and to bind them single-wise on the paths. The game reacts that fast, that the differenc is not even a second.

Code: [Select]
:SCENE_018
05D6: clear_scmpath
05D7: add_point_to_scmpath 2342.256 -1655.591 12.988
05D7: add_point_to_scmpath 2460.311 -1656.473 12.914
05D7: add_point_to_scmpath 2476.071 -1653.240 13.059
06BB: set_actor 28@ drive_car 3@ speed 20.0 along_SCM_path
0001: wait 500 ms
05D6: clear_scmpath
05D7: add_point_to_scmpath 2345.657 -1660.752 13.045
05D7: add_point_to_scmpath 2463.326 -1661.198 12.912
05D7: add_point_to_scmpath 2473.702 -1673.519 12.936
06BB: set_actor 26@ drive_car 2@ speed 20.0 along_SCM_path
0160: set_camera_point_at 2470.207 -1659.009 14.024 mode 1
0001: wait 12500 ms

Because of the short wait-time of 500 ms we reach, that later the cars do not crash into another and that they drive a bit moved. I have set the speed to 20, because the police hurrys. You could turn on the Siren of the car now. That works by setting over the SCM Path the OpCodes..

Code: [Select]
0397: toggle_car 2@ siren 1
0397: toggle_car 3@ siren 1

.. but that's personal choice.

Now we have nearly reached our goal. The police cars would drive to the fight Groves vs. Ballas. And then? They would get out off the cars. Like above. Then we disable the godmode of all Gang Members. With that action we ensure, that the police officers comes into connection with the shoot. We let them move to the middlepoint of the Grove Street, too.

Code: [Select]
:SCENE_019
05CF: AS_actor 26@ exit_car 2@ when_at 2473.702 -1673.519 12.936  
05CF: AS_actor 27@ exit_car 2@ when_at 2473.702 -1673.519 12.936
05CF: AS_actor 28@ exit_car 3@ when_at 2476.071 -1653.240 13.059
05CF: AS_actor 29@ exit_car 3@ when_at 2476.071 -1653.240 13.059
05CF: AS_actor 30@ exit_car 3@ when_at 2476.071 -1653.240 13.059
05CF: AS_actor 31@ exit_car 3@ when_at 2476.071 -1653.240 13.059  
015F: set_camera_position 2519.357 -1674.796 21.089 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2470.207 -1659.009 14.024 mode 1
05D6: clear_scmpath
05D7: add_point_to_scmpath 2490.620 -1671.115 13.336
05D8: AS_assign_scmpath to_actor 26@ flags 6 1
05D8: AS_assign_scmpath to_actor 27@ flags 6 1
05D8: AS_assign_scmpath to_actor 28@ flags 6 1
05D8: AS_assign_scmpath to_actor 29@ flags 6 1
05D8: AS_assign_scmpath to_actor 30@ flags 6 1
05D8: AS_assign_scmpath to_actor 31@ flags 6 1
02AB: set_actor 22@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 23@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 24@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 25@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 5@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 6@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 7@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 8@ immunities BP 0 FP 0 EP 0 DP 0 SP 0  
02AB: set_actor 9@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
0001: wait 10000 ms

One more camera swing and we nearly did it.

Code: [Select]
:SCENE_020
015F: set_camera_position 2481.611 -1645.757 22.273 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2490.620 -1671.115 13.336 mode 1
0001: wait 7000 ms
0460: set_camera_transverse_delay 0.0 time 25000
0160: set_camera_point_at 2467.134 -1663.728 13.293 mode 1
0001: wait 50000 ms

That the game doesn't simply crash, we return to our player:

Code: [Select]
:SCENE_998
0001: wait 7000 ms
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: toggle_player $PLAYER_CHAR can_move 1
01B2: give_actor $PLAYER_ACTOR weapon 32 ammo 9999        //TEC9

The Whole Thread
Here once again the whole Thread, like I scripted it (with Comments):

Code: [Select]
:SCENE_001
03A4: name_thread 'SCENE1'
01B4: toggle_player $PLAYER_CHAR can_move 0
02A3: toggle_widescreen 0 //Widescreen off  (1 = on | 0 = off)
0826: toggle_hud 0 //HUD off (1 = on | 0 = off)
0581: toggle_radar 0 //Radar off (1 = on | 0 = off)

//PATH COORDS:

//Balla_Car
//2290.188 -1661.210 14.519
//2341.206 -1659.069 13.077
//2476.207 -1659.009 13.024

:SCENE_002
0247: load_model #GREENWOO  //Car: Greenwood
0247: load_model #TAHOMA    //Car: Tahoma
0247: load_model #ENFORCER  //Car: Enforcer
0247: load_model #COPCARLA  //Car: Copcar (LSPD)
0247: load_model #FAM1      //PED: Grove_1
0247: load_model #FAM2      //PED: Grove_2
0247: load_model #FAM3      //PED: Grove_3
0247: load_model #BALLAS1   //PED: Balla_1
0247: load_model #BALLAS2   //PED: Balla_2
0247: load_model #BALLAS3   //PED: Balla_3
0247: load_model #LAPD1     //PED: Policemen
0247: load_model #SWAT      //PED: SWAT
0247: load_model #TEC9      //GUN: Tec9
0247: load_model #COLT45    //GUN: Pistol
0247: load_model #MP5LNG    //GUN: AK-47
0247: load_model #AK47      //GUN: MP5
0247: load_model #MICRO_UZI //GUN: UZI
0247: load_model #SNIPER    //GUN: Sniper Rifle
0247: load_model #M4        //GUN: M4A1
0247: load_model #CELLPHONE //OBJECT: Mobile
038B: load_request_models
00A5: 0@ = create_car #GREENWOO at 2483.499 -1667.010 13.344
00A5: 1@ = create_car #TAHOMA at 2290.188 -1661.210 14.519
0175: set_car 0@ Z_angle_to 280.0
0175: set_car 1@ Z_angle_to 267.363403
0674: set_car_model 0@ numberplate "GROVE4L_"  
0674: set_car_model 1@ numberplate "BALLAS__"

//gang_2 = GROVES (ID=8)
//gang_1 = BALLAS (ID=7)
 
:SCENE_003
//Groves
009A: 11@ = create_actor_pedtype 8 model #FAM1 at 2481.606 -1700.239 13.524
009A: 12@ = create_actor_pedtype 8 model #FAM3 at 2480.171 -1704.558 13.532
009A: 13@ = create_actor_pedtype 8 model #FAM2 at 2459.221 -1687.116 13.543
009A: 14@ = create_actor_pedtype 8 model #FAM3 at 2463.329 -1684.491 13.534
0173: set_actor 11@ Z_angle_to 7.644567
0173: set_actor 12@ Z_angle_to 271.260498
0173: set_actor 13@ Z_angle_to 275.320099
0173: set_actor 14@ Z_angle_to 150.583267
 
//Ballas - doesnt matter where they are spawned!
009A: 15@ = create_actor_pedtype 7 model #BALLAS1 at 0.0 0.0 0.0
009A: 16@ = create_actor_pedtype 7 model #BALLAS2 at 0.0 0.0 0.0
009A: 17@ = create_actor_pedtype 7 model #BALLAS3 at 0.0 0.0 0.0
009A: 18@ = create_actor_pedtype 7 model #BALLAS1 at 0.0 0.0 0.0
0173: set_actor 15@ Z_angle_to 0.0
0173: set_actor 16@ Z_angle_to 0.0
0173: set_actor 17@ Z_angle_to 0.0
0173: set_actor 18@ Z_angle_to 0.0

//Setting Up Groups
0631: put_actor 11@ in_group $PLAYER_GROUP
0631: put_actor 12@ in_group $PLAYER_GROUP
0631: put_actor 13@ in_group $PLAYER_GROUP
0631: put_actor 14@ in_group $PLAYER_GROUP

//Setting Ballas into car
072A: put_actor 15@ into_car 1@ driverseat
072B: put_actor 16@ into_car 1@ passengerseat -1  
072B: put_actor 17@ into_car 1@ passengerseat -1
072B: put_actor 18@ into_car 1@ passengerseat -1

//Giving everyone a weapon
01B2: give_actor 11@ weapon 32 ammo 9999        //TEC9
01B2: give_actor 12@ weapon 29 ammo 9999        //MP5
01B2: give_actor 13@ weapon 22 ammo 9999        //PISTOL
01B2: give_actor 14@ weapon 29 ammo 9999        //MP5
01B9: set_actor 11@ armed_weapon_to 32
01B9: set_actor 12@ armed_weapon_to 29
01B9: set_actor 13@ armed_weapon_to 22
01B9: set_actor 14@ armed_weapon_to 29
01B2: give_actor 15@ weapon 30 ammo 9999        //AK-47
01B2: give_actor 16@ weapon 28 ammo 9999        //UZI
01B2: give_actor 17@ weapon 28 ammo 9999        //UZI
01B2: give_actor 18@ weapon 22 ammo 9999        //PISTOL
01B9: set_actor 15@ armed_weapon_to 30
01B9: set_actor 16@ armed_weapon_to 28
01B9: set_actor 17@ armed_weapon_to 28
01B9: set_actor 18@ armed_weapon_to 22

//Creating Immunitives for everyone
02AB: set_actor 11@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 12@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 13@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 14@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 15@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 16@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 17@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 18@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 0@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 1@ immunities BP 1 FP 0 EP 0 DP 0 SP 0

//Making Actors only use Weapons
02E2: set_actor 11@ weapon_accuracy_to 100  
02E2: set_actor 12@ weapon_accuracy_to 100
02E2: set_actor 13@ weapon_accuracy_to 100
02E2: set_actor 14@ weapon_accuracy_to 100
02E2: set_actor 15@ weapon_accuracy_to 100
02E2: set_actor 16@ weapon_accuracy_to 100
02E2: set_actor 17@ weapon_accuracy_to 100
02E2: set_actor 18@ weapon_accuracy_to 100

:SCENE_004
015F: set_camera_position 2287.091 -1664.189 14.930 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2341.206 -1659.069 13.077 mode 2
05D6: clear_scmpath
05D7: add_point_to_scmpath  2290.188 -1661.210 14.519
05D7: add_point_to_scmpath  2341.206 -1659.069 13.077
05D7: add_point_to_scmpath  2476.207 -1659.009 13.024
0460: set_camera_transverse_delay 0.0 time 10000
//Wait for Starting Film
0001: wait 10000 ms

:SCENE_005
06BB: set_actor 15@ drive_car 1@ speed 10.0 along_SCM_path
015F: set_camera_position 2290.188 -1661.210 34.519 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2341.206 -1659.069 13.077 mode 1
0001: wait 10000 ms
015F: set_camera_position 2476.207 -1656.009 13.024 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2470.207 -1659.009 14.024 mode 1
0001: wait 13500 ms
05CF: AS_actor 15@ exit_car 1@ when_at 2476.207 -1659.009 13.024    
05CF: AS_actor 16@ exit_car 1@ when_at 2476.207 -1659.009 13.024
05CF: AS_actor 17@ exit_car 1@ when_at 2476.207 -1659.009 13.024
05CF: AS_actor 18@ exit_car 1@ when_at 2476.207 -1659.009 13.024

:SCENE_006
05D6: clear_scmpath
05D7: add_point_to_scmpath  2483.308 -1670.123 13.336
05D7: add_point_to_scmpath  2482.613 -1682.936 13.330
05D8: AS_assign_scmpath to_actor 11@ flags 6 1
05D8: AS_assign_scmpath to_actor 12@ flags 6 1
05D8: AS_assign_scmpath to_actor 13@ flags 6 1
05D8: AS_assign_scmpath to_actor 14@ flags 6 1
0460: set_camera_transverse_delay 0.0 time 5000
015F: set_camera_position 2497.089 -1667.746 21.968 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2476.207 -1659.009 13.024 mode 1
0001: wait 7000 ms
015F: set_camera_position 2482.613 -1682.936 13.330 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2476.207 -1659.009 13.024 mode 1
0001: wait 7000 ms
015F: set_camera_position 2464.332 -1673.342 19.127 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2476.207 -1659.009 13.024 mode 1
0001: wait 7000 ms
015F: set_camera_position 2482.581 -1647.620 18.931 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.499 -1667.010 13.344 mode 1
0001: wait 10000 ms

:SCENE_007
016A: fade 0 time 500
0001: wait 500 ms

//Reinforcemence
:SCENE_008
009A: 21@ = create_actor_pedtype 8 model #FAM2 at 2515.713 -1680.229 13.466  
0173: set_actor 21@ Z_angle_to 255.938110
01B2: give_actor 21@ weapon 29 ammo 9999        //MP5
02E2: set_actor 21@ weapon_accuracy_to 100  
02AB: set_actor 21@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
015F: set_camera_position 2516.765 -1680.873 13.456 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2515.713 -1680.229 13.966 mode 2
0729: AS_actor 21@ hold_cellphone 1
0967: actor 21@ move_mouth 100 ms
0001: wait 500 ms
016A: fade 1 time 500
0001: wait 10000 ms
0729: AS_actor 21@ hold_cellphone 0
05D3: AS_actor 21@ goto_point 2483.308 -1670.123 13.336 mode 6 7500 ms
0001: wait 100 ms
01B9: set_actor 21@ armed_weapon_to 29
0001: wait 900 ms
015F: set_camera_position 2464.332 -1673.342 19.127 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.499 -1667.010 13.344 mode 1
0001: wait 10000 ms

:SCENE_009
016A: fade 0 time 500
0001: wait 500 ms
009A: 5@ = create_actor_pedtype 7 model #BALLAS1 at 2481.807 -1719.387 13.546
009A: 6@ = create_actor_pedtype 7 model #BALLAS2 at 2481.184 -1722.680 13.555
009A: 7@ = create_actor_pedtype 7 model #BALLAS3 at 2482.469 -1715.928 13.543
009A: 8@ = create_actor_pedtype 7 model #BALLAS1 at 2479.322 -1712.078 13.537
009A: 22@ = create_actor_pedtype 8 model #FAM1 at 2510.481 -1696.526 13.480
009A: 23@ = create_actor_pedtype 8 model #FAM3 at 2502.140 -1643.145 13.783
009A: 24@ = create_actor_pedtype 8 model #FAM2 at 2528.099 -1690.698 13.658
009A: 25@ = create_actor_pedtype 8 model #FAM3 at 2527.253 -1686.881 13.808
01B2: give_actor 22@ weapon 32 ammo 9999        //TEC9
01B2: give_actor 23@ weapon 29 ammo 9999        //MP5
01B2: give_actor 24@ weapon 22 ammo 9999        //PISTOL
01B2: give_actor 25@ weapon 29 ammo 9999        //MP5
01B9: set_actor 22@ armed_weapon_to 32
01B9: set_actor 23@ armed_weapon_to 29
01B9: set_actor 24@ armed_weapon_to 22
01B9: set_actor 25@ armed_weapon_to 29
01B2: give_actor 5@ weapon 30 ammo 9999        //AK-47
01B2: give_actor 6@ weapon 28 ammo 9999        //UZI
01B2: give_actor 7@ weapon 28 ammo 9999        //UZI
01B2: give_actor 8@ weapon 22 ammo 9999        //PISTOL
01B9: set_actor 5@ armed_weapon_to 30
01B9: set_actor 6@ armed_weapon_to 28
01B9: set_actor 7@ armed_weapon_to 28
01B9: set_actor 8@ armed_weapon_to 22

//Creating Immunitives for everyone
02AB: set_actor 22@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 23@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 24@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 25@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 5@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 6@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 7@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 8@ immunities BP 1 FP 0 EP 0 DP 0 SP 0

//Making Actors only use Weapons
02E2: set_actor 22@ weapon_accuracy_to 100  
02E2: set_actor 23@ weapon_accuracy_to 100
02E2: set_actor 24@ weapon_accuracy_to 100
02E2: set_actor 25@ weapon_accuracy_to 100
02E2: set_actor 5@ weapon_accuracy_to 100
02E2: set_actor 6@ weapon_accuracy_to 100
02E2: set_actor 7@ weapon_accuracy_to 100
02E2: set_actor 8@ weapon_accuracy_to 100

:SCENE_010
0460: set_camera_transverse_delay 0.0 time 7000
015F: set_camera_position 2482.613 -1682.936 13.330 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2482.613 -1685.936 13.330 mode 2
016A: fade 1 time 500
0001: wait 700 ms
02AB: set_actor 11@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 12@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 13@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 14@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 15@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 16@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 17@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 18@ immunities BP 0 FP 0 EP 0 DP 0 SP 0  
05D6: clear_scmpath
05D7: add_point_to_scmpath  2483.797 -1685.592 13.508
05D7: add_point_to_scmpath  2490.620 -1671.115 13.336
05D8: AS_assign_scmpath to_actor 5@ flags 6 1
05D8: AS_assign_scmpath to_actor 6@ flags 6 1
05D8: AS_assign_scmpath to_actor 7@ flags 6 1
05D8: AS_assign_scmpath to_actor 8@ flags 6 1
015F: set_camera_position 2476.207 -1659.009 23.024 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.499 -1667.010 13.344 mode 1  
0160: set_camera_point_at 2515.713 -1680.229 13.466 mode 1

:SCENE_011
05D6: clear_scmpath
05D7: add_point_to_scmpath  2490.620 -1671.115 13.336
05D8: AS_assign_scmpath to_actor 22@ flags 6 1
05D8: AS_assign_scmpath to_actor 23@ flags 6 1
05D8: AS_assign_scmpath to_actor 24@ flags 6 1
05D8: AS_assign_scmpath to_actor 25@ flags 6 1
0001: wait 7000 ms

:SCENE_012
015F: set_camera_position 2513.292 -1666.519 13.570 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2490.620 -1671.115 13.336 mode 2
0001: wait 10000 ms
016A: fade 0 time 500
0001: wait 500 ms

:SCENE_013
05D6: clear_scmpath
05D7: add_point_to_scmpath 2528.646 -1667.925 15.169
05D7: add_point_to_scmpath 2523.344 -1669.096 14.978
05D7: add_point_to_scmpath  2490.620 -1671.115 13.336
015F: set_camera_position 2524.079 -1666.532 15.059 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2523.344 -1669.096 14.978 mode 2
009A: 9@ = create_actor_pedtype 7 model #BALLAS2 at 2528.646 -1667.925 15.169
01B2: give_actor 9@ weapon 34 ammo 9999        //SNIPER
02E2: set_actor 9@ weapon_accuracy_to 100  
02AB: set_actor 9@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
01B9: set_actor 9@ armed_weapon_to 34

:SCENE_014
05D8: AS_assign_scmpath to_actor 9@ flags 4 1
016A: fade 1 time 500
0001: wait 10000 ms

:SCENE_015
016A: fade 0 time 500
0001: wait 1000 ms
016A: fade 1 time 500
0001: wait 500 ms
015F: set_camera_position 2494.763 -1690.037 21.657 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2513.430 -1670.087 13.513 mode 2
0001: wait 7500 ms

:SCENE_016
0460: set_camera_transverse_delay 0.0 time 25000
0160: set_camera_point_at 2467.655 -1671.798 13.489 mode 1
0001: wait 25000 ms
0460: set_camera_transverse_delay 0.0 time 7000
015F: set_camera_position 2490.620 -1671.115 17.336  rotation 0.0 0.0 0.0
0160: set_camera_point_at 2483.797 -1685.592 13.508 mode 1
0001: wait 10000 ms

:SCENE_017
00A5: 3@ = create_car #ENFORCER at 2342.256 -1655.591 12.988
00A5: 2@ = create_car #COPCARLA at 2345.657 -1660.752 13.045
009A: 26@ = create_actor_pedtype 9 model #LAPD1 at 0.0 0.0 0.0
009A: 27@ = create_actor_pedtype 9 model #LAPD1 at 0.0 0.0 0.0
009A: 28@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0
009A: 29@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0
009A: 30@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0
009A: 31@ = create_actor_pedtype 9 model #SWAT at 0.0 0.0 0.0

01B2: give_actor 26@ weapon 22 ammo 9999        //PISTOL
01B2: give_actor 27@ weapon 22 ammo 9999        //PISTOL
01B9: set_actor 26@ armed_weapon_to 32
01B9: set_actor 27@ armed_weapon_to 29
01B2: give_actor 28@ weapon 28 ammo 9999        //UZI
01B2: give_actor 29@ weapon 28 ammo 9999        //UZI
01B2: give_actor 30@ weapon 28 ammo 9999        //UZI
01B2: give_actor 31@ weapon 28 ammo 9999        //UZI
01B9: set_actor 28@ armed_weapon_to 30
01B9: set_actor 29@ armed_weapon_to 28
01B9: set_actor 30@ armed_weapon_to 28
01B9: set_actor 31@ armed_weapon_to 22

//Creating Immunitives for everyone
02AB: set_actor 26@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 27@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 28@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 29@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 30@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 31@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 2@ immunities BP 1 FP 0 EP 0 DP 0 SP 0
02AC: set_car 3@ immunities BP 1 FP 0 EP 0 DP 0 SP 0

072A: put_actor 26@ into_car 2@ driverseat
072B: put_actor 27@ into_car 2@ passengerseat -1
072A: put_actor 28@ into_car 3@ driverseat  
072B: put_actor 29@ into_car 3@ passengerseat -1
072B: put_actor 30@ into_car 3@ passengerseat -1  
072B: put_actor 31@ into_car 3@ passengerseat -1

:SCENE_018
05D6: clear_scmpath
05D7: add_point_to_scmpath 2342.256 -1655.591 12.988
05D7: add_point_to_scmpath 2460.311 -1656.473 12.914
05D7: add_point_to_scmpath 2476.071 -1653.240 13.059
06BB: set_actor 28@ drive_car 3@ speed 20.0 along_SCM_path
0001: wait 500 ms
05D6: clear_scmpath
05D7: add_point_to_scmpath 2345.657 -1660.752 13.045
05D7: add_point_to_scmpath 2463.326 -1661.198 12.912
05D7: add_point_to_scmpath 2473.702 -1673.519 12.936
06BB: set_actor 26@ drive_car 2@ speed 20.0 along_SCM_path
0160: set_camera_point_at 2470.207 -1659.009 14.024 mode 1
0001: wait 12500 ms

:SCENE_019
05CF: AS_actor 26@ exit_car 2@ when_at 2473.702 -1673.519 12.936  
05CF: AS_actor 27@ exit_car 2@ when_at 2473.702 -1673.519 12.936
05CF: AS_actor 28@ exit_car 3@ when_at 2476.071 -1653.240 13.059
05CF: AS_actor 29@ exit_car 3@ when_at 2476.071 -1653.240 13.059
05CF: AS_actor 30@ exit_car 3@ when_at 2476.071 -1653.240 13.059
05CF: AS_actor 31@ exit_car 3@ when_at 2476.071 -1653.240 13.059  
015F: set_camera_position 2519.357 -1674.796 21.089 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2470.207 -1659.009 14.024 mode 1
05D6: clear_scmpath
05D7: add_point_to_scmpath 2490.620 -1671.115 13.336
05D8: AS_assign_scmpath to_actor 26@ flags 6 1
05D8: AS_assign_scmpath to_actor 27@ flags 6 1
05D8: AS_assign_scmpath to_actor 28@ flags 6 1
05D8: AS_assign_scmpath to_actor 29@ flags 6 1
05D8: AS_assign_scmpath to_actor 30@ flags 6 1
05D8: AS_assign_scmpath to_actor 31@ flags 6 1
02AB: set_actor 22@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 23@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 24@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 25@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 5@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 6@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 7@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
02AB: set_actor 8@ immunities BP 0 FP 0 EP 0 DP 0 SP 0  
02AB: set_actor 9@ immunities BP 0 FP 0 EP 0 DP 0 SP 0
0001: wait 10000 ms

:SCENE_020
015F: set_camera_position 2481.611 -1645.757 22.273 rotation 0.0 0.0 0.0
0160: set_camera_point_at 2490.620 -1671.115 13.336 mode 1
0001: wait 7000 ms
0460: set_camera_transverse_delay 0.0 time 25000
0160: set_camera_point_at 2467.134 -1663.728 13.293 mode 1
0001: wait 50000 ms
 
:SCENE_998
0001: wait 7000 ms
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: toggle_player $PLAYER_CHAR can_move 1
01B2: give_actor $PLAYER_ACTOR weapon 32 ammo 9999        //TEC9

:SCENE_999
0249: release_model #GREENWOO  //Car: Greenwood
0249: release_model #TAHOMA    //Car: Tahoma
0249: release_model #ENFORCER  //Car: Enforcer
0249: release_model #COPCARLA  //Car: Copcar (LSPD)
0249: release_model #FAM1      //PED: Grove_1
0249: release_model #FAM2      //PED: Grove_2
0249: release_model #FAM3      //PED: Grove_3
0249: release_model #BALLAS1   //PED: Balla_1
0249: release_model #BALLAS2   //PED: Balla_2
0249: release_model #BALLAS3   //PED: Balla_3
0249: release_model #LAPD1     //PED: Policemen
0249: release_model #SWAT      //PED: SWAT
0249: release_model #TEC9      //GUN: Tec9
0249: release_model #COLT45    //GUN: Pistol
0249: release_model #MP5LNG    //GUN: AK-47
0249: release_model #AK47      //GUN: MP5
0249: release_model #MICRO_UZI //GUN: UZI
0249: release_model #SNIPER    //GUN: Sniper Rifle
0249: release_model #M4        //GUN: M4A1
0249: release_model #CELLPHONE //OBJECT: Mobile
end_thread

« Last Edit: November 13, 2008, 09:41:18 AM by ColdDeath »

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« Reply #5 on: October 26, 2008, 09:29:45 AM »
How It's Going On
- Epilogue -


It is clear, that you are after this tutorial no SCM-Pro. But at least you should have developed the feeling of Scripting. I have collected some tips for your Scripter Career:

1. The Sanny Builder contains some very good solutions for things, where you don't know immediately how you should do it. This solution is called: "OpCode Search".
Path: "Tools => IDE Tools => OpCode Search". If you want to know for example, how you can turn on the siren of cars, you must insert there the name siren, and the tools searches every contect which is connected to the word.

Then you should now, that not everything in SCM is known. But the OpCode Table of the Sanny Builder for SA get's often updated. Therefore just look into the Thread of the Sanny Builder on GTA Forums or on www.sannybuilder.com.

And you should take a look on the help the Sanny Builder offers, too. There are some further things explained.


2. If you know something, what happens in San Andreas, then you could search it in the original SA SCM. This one is extremly big, but with some trick you can save time. But take in mind, a search does take always some time. You must try to understand how the scriptpart works.
Search for example in the header the missionnumber and then you must search the Label, where the mission starts.

Then you will bump into problems, that can't  be solved without further notice, because they are more complexe then what we've learned.

With this tutorial I wanted to set the basics for the understanding of SCM. If you have read it the first time and only have rewritten everything, then change for example the coordinates. Just try different things. To create an own camera movement.
You need patience. That is everytime so, if you want to learn something complexe. SCM is parts-parts the most complexe, what GTA Modding offers. But if you don't give up and try to understand the tutorial (and if you read it again and again), then I don't see any problems, that you will understand Scripting some day.

SCM is mainly a habituation thing. Who doesn't tryed programming before or doesn't have done something similar before will have problems in the beginning. But after some tome it will be 'click' and everything will be logic. Every Scripter knows that. And till yet no superhero is fallen from the sky.

Respect the tips I told you. You will soon enjoy scripting. The biggest problem is the complexity, and who can handle that, understands SCM!

To the Thread:

You can ask for sure question, but please no "I don't understand anything here.", "This is way to complexe for me." I like to help, but please try at first to solve your problem yourself. That is the way to learn something.
Tips and Suggestions are wanted!


Happy Modding & Greetz... Aschratt  



© 2007 | Aschratt, gta-worldmods.de
All Rights Reserved.
Nobody is allowed to offer this tutorial on his site, as long he doesn't speak to me.
« Last Edit: November 01, 2009, 09:46:36 AM by ColdDeath »

Offline SnowMan

  • Veteran Member
  • Posts: 7125
  • Life is what you make it
    • View Profile
Aschratts SA SCM Tutorial
« Reply #6 on: October 26, 2008, 09:30:11 AM »
finnally its translated

Offline PhysicX

  • Posts: 222
    • View Profile
Aschratts SA SCM Tutorial
« Reply #7 on: October 26, 2008, 09:32:17 AM »
Finally i can learn scripting xD

Offline Adonai

  • Posts: 1548
    • View Profile
    • http://
Aschratts SA SCM Tutorial
« Reply #8 on: October 26, 2008, 10:05:09 AM »
Awesome. I read this tutorial a while ago, and my German is not so good, so I needed a dictionary to understand. Thanks CD.

Offline Bixel

  • Veteran Member
  • Posts: 2453
  • DSS Crew
    • View Profile
Aschratts SA SCM Tutorial
« Reply #9 on: October 26, 2008, 10:08:26 AM »
ohh its haard

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« Reply #10 on: October 26, 2008, 10:40:48 AM »
Only the beginning Bixel. It's something absoluty new for someone who haven't scripted and programmed before. Just work through the tutorial and don't give up, the rest will come then, I'm sure.

Offline Adonai

  • Posts: 1548
    • View Profile
    • http://
Aschratts SA SCM Tutorial
« Reply #11 on: October 26, 2008, 01:12:09 PM »
If you have some basic knowledge about programming and logical sequences concepts, you will get this easy. I just scripted my cutscene in 30 minutes. It looks great (guys on GTAF told it), and wasn't so hard. And I haven't scripted in SA before.
« Last Edit: October 26, 2008, 01:13:44 PM by Adonai »

Offline Bixel

  • Veteran Member
  • Posts: 2453
  • DSS Crew
    • View Profile
Aschratts SA SCM Tutorial
« Reply #12 on: October 26, 2008, 01:28:32 PM »
never programed or scripted before but i am kinda gettin it
when i need script for new vid i will reread this again for now i am good

Offline LiveLife

  • Veteran Member
  • Posts: 1495
    • View Profile
Aschratts SA SCM Tutorial
« Reply #13 on: November 08, 2008, 02:21:36 AM »
Started again the work on Part 2. I guess it will be finished tomorrow.

Offline Labiloute

  • Veteran Member
  • Posts: 2502
    • View Profile
    • YouTube Channel
Aschratts SA SCM Tutorial
« Reply #14 on: November 08, 2008, 02:50:43 AM »
Dude, hope u will add this

0460: set_camera_transverse_delay 0.0 time 3000

When u say there is two important opcodes yes ok, but this one is important too :]


Keep up this epic tutorial

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal