GTAStunting
GTA Series => GTA Modding => Tutorials => Topic started 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.
-
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.
-
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 :)
-
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.
-
Pretty nice tutorial there Petar gonna try ;)
-
Great tutorial!!! :wub:
BTW: How can I attach this scripted camera to a vehicle, so it would move together with the car?
-
me is the tutorial
well done petar
-
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 :)
-
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. ;)
-
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:
-
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
-
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 ;)
-
^ What about the watermark in the corner?
Great tut, might give it a go sometime.
-
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.
-
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
-
when i start the game, it's crashed why? please help me :)
-
when i start the game, it's crashed why? please help me :)
You'd have to show me your code.
-
okay i find the error by myself. But i have another problem. I have you in msn, can you help me there?
-
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.
-
read my pm
-
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?
-
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.
-
thank` you :jajaja:
-
Hei petar i just noticed a little mistake.
In the main you linked the firsts line looks like that
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:
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
-
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.
-
Thanks for that tutorial man. I added this to my bookmark, for sure will be useful.
-
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:
-
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.
-
+ according to the second image it should be very similar to what a stripped main would be
the stripped scripts come with sanny builder