GTAStunting

GTA Series => GTA Modding => Tutorials => Topic started by: PtRvY on May 20, 2011, 09:26:54 AM

Title: .scm Camera Scripting Tutorial - SA
Post by: PtRvY on May 20, 2011, 09:26:54 AM
PtRvY's Camera Scripting Tutorial for San Andreas.

Things you'll need:

- Sanny Builder 3
get it here: www.sannybuilder.com

- Basic main.scm, by Labiloute
get it here: https://dl.dropboxusercontent.com/u/94754009/Basic_SCM_By_Labiloute.txt

Before we begin!

Make sure you have backed up your original / Dannye's main.scm.
Make sure you have configured your Sanny Builder to point to the right SA folder.
For Windows 7 Users: Run Sanny Builder and GTA as administrator!

Let's start!

1. Alright, fire up Sanny Builder. After it's done loading you should see this screen:

(http://noob.hu/2011/05/20/tut_img1.png)

2. Create a new script, by going to File => New... or by clicking the icon in the toolbox.
Copy all the text contained in the basic .scm into this new script.
After you've pasted everything in, it should look like this:

(http://noob.hu/2011/05/20/tut_img2.png)

3. I won't bother explaining what all the basic .scm's functions mean, since that's not the focus of this tutorial - maybe some other time. Now start writing the following text between the "wait 1000" and "end_thread" (the final two) lines:

0460: set_camera_transverse_delay 0.0 time <T>
015F: set_camera_position X Y Z rotation 0.0 0.0 0.0
0160: set_camera_point_at X1 Y1 Z1 mode 2
wait <T>
015F: set_camera_position X Y Z rotation 0.0 0.0 0.0
0160: set_camera_point_at X1 Y1 Z1 mode 1
wait <T>
015F: set_camera_position X Y Z rotation 0.0 0.0 0.0
0160: set_camera_point_at X1 Y1 Z1 mode 1
wait <T>


It should now look like this:

(http://noob.hu/2011/05/20/tut_img3.png)

4. Now, replace all the "<T>" with the amount of time (in miliseconds, 1000 = 1 second) that you want the camera to travel from one point to another. In this example I will put 3 seconds or 3000.

In my example it should look like this:

(http://noob.hu/2011/05/20/tut_img4.png)

5. Now it's time to pick positions for your camera. Fire up San Andreas (and leave Sanny Builder open).

------------------------ This is the only part which could be hard to understand ---------------------------------
A camera angle is determined with two X-Y-Z points.
One point is the position of the camera, and the other point is the point the camera is focused ("looking") at.
-------------------------------------------------------------------------------------------------------------------------------------------------

Now that you've opened San Andreas, use the jetpack from Dannye's to get to a point which could be a good position for the camera, and then minimize (Alt+Tab) out of the game.

In my example, this seems to be a nice position for the camera, looking up to the skyscrapers:
(http://noob.hu/2011/05/20/position1.png)

After minimizing, go to Sanny Builder's coordinate reader.
It can be found in Tools => IDE Tools => Coords Manager...
The tool will automatically read the coordinates from SA, but click "Read" just to be sure.
Copy the X, Y and Z values instead of the first X Y Z in the code we added.
Here's how my code looks after this change:

(http://noob.hu/2011/05/20/tut_img5.png)

6. I mentioned I want the camera to look at the skyscrapers, so a good focus point could be on top of a skyscraper. Go back to SA, and use the jetpack to get on top of a skyscraper (or, any other suitable looking point for your camera).

(http://noob.hu/2011/05/20/position2.png)

And then, minimize the game again, and read the coordinates.
This time, paste them into the first X1, Y1 and Z1.
Here's how my code looks now:

(http://noob.hu/2011/05/20/tut_img6.png)

7. Make new camera angles by repeating steps 5 and 6 for the 2nd set of X Y Z and X1 Y1 Z1, and same for the 3rd.

If you want more than three camera angles, just paste the last three lines behind the last wait:
015F: set_camera_position X Y Z rotation 0.0 0.0 0.0
0160: set_camera_point_at X1 Y1 Z1 mode 1
wait <T>

And replace the values, for every new camera angle you want.

8. Close San Andreas, hit F7 on your keyboard (Compile + Copy), save the .txt file anywhere, it will then compile the created main.scm and script.img files into the SA folder. Now you can fire up San Andreas again.
Start a new game.

Your camera script should start playing out after a second or two. You can record it with Fraps immediately or save a replay which you can then work on.

In order to go back to your normal game, paste the backup main.scm and script.img files into the /data/script folder of your SA.

-----------------------------------
Any questions, bug notifications, and criticism are appreciated.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: A maid on May 20, 2011, 09:34:48 AM
Very nice tutorial. I don't think you missed anything (but I just gave it a quick peek).

Would be nice to have the end result of the scm here on YouTube.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: GDL on May 20, 2011, 09:38:39 AM
cool  :P I'll try it one day. The last time I tried to make a script the cam was randomly rotating while going forward, I hope I wont have this problem with this tutorial  :)
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: NuclearDeath on May 20, 2011, 12:25:36 PM
Nice tuto dude, I remember when I used to do these script. I had issues when I wanted to script inside a house or something but still, cool tutorial.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Nauthiluz on May 20, 2011, 12:32:00 PM
Pretty nice tutorial there Petar gonna try ;)
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Winged on May 21, 2011, 02:20:35 AM
Great tutorial!!!   :wub:
BTW: How can I attach this scripted camera to a vehicle, so it would move together with the car?
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Labiloute on May 21, 2011, 02:29:52 AM
me is the tutorial

well done petar
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: VaNilla on May 21, 2011, 04:05:33 AM
Great tutorial, I can't see myself finding much use for scripting but it's definitely easy to understand and laid out in such a way that anyone who wants to get more advanced has a good groundwork :)
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Genyus on May 21, 2011, 04:10:58 AM
Neat stuff, I had no idea how scripting worked at first but this clears it up more. Perfect for anyone who wants to learn more about scripting and all that. Btw like Mugetsu said, it might be nice if you had recorded that basic script you just put up just to show us how it looks. ;)
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: PtRvY on May 21, 2011, 04:25:25 AM
BTW: How can I attach this scripted camera to a vehicle, so it would move together with the car?

I might explain that in another tutorial, this one focuses on the most basic aspects of camera movement.

Thanks everyone for the feedback, I'm considering to make some more scripting tuts.  :a-cheer:
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: A maid on May 21, 2011, 04:31:20 AM
Many say they were going to make more but then it were just 1 or 2. Hope you can explain a big part of what we want to know :P
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Winged on May 21, 2011, 08:56:11 AM
Thanks for tut, but today I've discovered something much easier and better than scripting in scm - MTA Stage. Look at this : MTA Stage: Camera Demo: Presidential Motorcade (http://www.youtube.com/watch?v=CPTJTDfji9I#) ;) No scripts, no problems ;)
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Cookie on May 21, 2011, 09:27:02 AM
^ What about the watermark in the corner?


Great tut, might give it a go sometime.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: PtRvY on May 21, 2011, 09:30:16 AM
Thanks for tut, but today I've discovered something much easier and better than scripting in scm - MTA Stage.
It looks nice, but I still prefer scripting as a way to get stuff done.
Maybe because I'm keen on programming and I like to make stuff myself instead a program making it for me. Oh well.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Ltab- on May 21, 2011, 03:43:58 PM
Grat tuto bro, you put a lot of effort on this as i see ;)
i'd like to see a vc one, if somebody have the link :P
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Nager on January 02, 2012, 08:09:39 AM
when i start the game, it's crashed why? please help me :)
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: PtRvY on January 02, 2012, 08:57:44 AM
when i start the game, it's crashed why? please help me :)
You'd have to show me your code.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Nager on January 02, 2012, 01:21:25 PM
okay i find the error by myself. But i have another problem. I have you in msn, can you help me there?
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: PtRvY on January 02, 2012, 01:24:50 PM
okay i find the error by myself. But i have another problem. I have you in msn, can you help me there?
Nope, can't log in right now. Won't be available for the rest of the day either. Send me a PM.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: AristoCracKeD on March 03, 2012, 09:53:45 PM
read my pm
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: eXe on May 16, 2013, 10:03:22 AM
ok, sorry for bumping that one, but, what "basic .scm" is? where can i find it? the link is broken.

also, how to copy all the text contained in the basic .scm into this new script?
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: PtRvY on September 11, 2013, 12:20:35 AM
I have reuploaded the basic .scm after a long time. I'm sorry that I neglected this for way too long.

If I get the time, I should probably make a tutorial about more advanced camera stuff soon.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: eXe on September 11, 2013, 04:10:56 AM
thank` you :jajaja:
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Omma! on November 26, 2013, 01:15:25 AM
Hei petar i just noticed a little mistake.

In the main you linked the firsts line looks like that

Quote
DEFINE OBJECTS 3
DEFINE OBJECT SANNY BUILDER 3.03
DEFINE OBJECT NULL2 // Object number -1
DEFINE OBJECT DYN_ROADBARRIER_6 // Object number -2 DEFINE MISSIONS 0
DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA script

While it should be like that  :cc_detective:

Quote
DEFINE OBJECTS 3
DEFINE OBJECT SANNY BUILDER 3.03
DEFINE OBJECT NULL2 // Object number -1
DEFINE OBJECT DYN_ROADBARRIER_6 // Object number -2
DEFINE MISSIONS 0
DEFINE EXTERNAL_SCRIPTS 0 // Use -1 in order not to compile AAA script
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: PtRvY on November 26, 2013, 04:58:48 AM
Good catch. When I transferred the file to my new computer in order to reupload it, all the newline characters disappeared, so I had to insert them back manually - and, as expected, missed that one. Thanks. The link is updated now.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Erney on November 26, 2013, 06:20:22 AM
Thanks for that tutorial man. I added this to my bookmark, for sure will be useful.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: вαℓυ on May 25, 2018, 10:56:11 AM
I realize this is a massive bump but is it realistic to expect anyone to still have the basic main.scm lmao

Edit: My bad for not looking hard enough, thanks for pointing it out below my guys :a-cheer:
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: Blaze on May 29, 2018, 04:37:40 AM
Maybe I'm being a dumb dumb but I'm pretty sure the second image of the first post is the entire basic main scm so you could probably just copy that out.
Title: Re: .scm Camera Scripting Tutorial - SA
Post by: MeatWagon on May 31, 2018, 07:22:22 PM
+ according to the second image it should be very similar to what a stripped main would be

the stripped scripts come with sanny builder
SimplePortal 2.3.7 © 2008-2024, SimplePortal