Author Topic: .scm Camera Scripting Tutorial - SA  (Read 20777 times)

0 Members and 1 Guest are viewing this topic.

Offline PtRvY

  • WH Crew
  • Veteran Member
  • Posts: 4153
  • Wasteland Hero / BT Member
    • View Profile
.scm Camera Scripting Tutorial - SA
« 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:



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:



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:



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:



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:


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:



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).



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:



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.
« Last Edit: November 26, 2013, 04:57:39 AM by 行きます PtRvY! »

Offline A maid

  • Creator of Worlds
  • Senior Member
  • Posts: 9033
  • Defenestration penetration.
    • View Profile
Re: .scm Camera Scripting Tutorial - SA
« Reply #1 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.

Offline GDL

  • Veteran Member
  • Posts: 2125
    • View Profile
Re: .scm Camera Scripting Tutorial - SA
« Reply #2 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  :)

Offline NuclearDeath

  • TMS Member
  • Veteran Member
  • Posts: 4194
    • View Profile
Re: .scm Camera Scripting Tutorial - SA
« Reply #3 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.

Offline Nauthiluz

  • SSU Crew
  • *
  • Posts: 1053
  • Cuck my sock
    • View Profile
    • My YouTube
Re: .scm Camera Scripting Tutorial - SA
« Reply #4 on: May 20, 2011, 12:32:00 PM »
Pretty nice tutorial there Petar gonna try ;)

Offline Winged

  • Posts: 142
  • Member of Virtual Limit
    • View Profile
    • My youtube's channel.
Re: .scm Camera Scripting Tutorial - SA
« Reply #5 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?

Offline Labiloute

  • Veteran Member
  • Posts: 2502
    • View Profile
    • YouTube Channel
Re: .scm Camera Scripting Tutorial - SA
« Reply #6 on: May 21, 2011, 02:29:52 AM »
me is the tutorial

well done petar

Offline VaNilla

  • next week m9
  • Veteran Member
  • Posts: 3809
    • View Profile
    • YouTube
Re: .scm Camera Scripting Tutorial - SA
« Reply #7 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 :)

Offline Genyus

  • Veteran Member
  • Posts: 6149
    • View Profile
Re: .scm Camera Scripting Tutorial - SA
« Reply #8 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. ;)

Offline PtRvY

  • WH Crew
  • Veteran Member
  • Posts: 4153
  • Wasteland Hero / BT Member
    • View Profile
Re: .scm Camera Scripting Tutorial - SA
« Reply #9 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:

Offline A maid

  • Creator of Worlds
  • Senior Member
  • Posts: 9033
  • Defenestration penetration.
    • View Profile
Re: .scm Camera Scripting Tutorial - SA
« Reply #10 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

Offline Winged

  • Posts: 142
  • Member of Virtual Limit
    • View Profile
    • My youtube's channel.
Re: .scm Camera Scripting Tutorial - SA
« Reply #11 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 ;) No scripts, no problems ;)

Offline Cookie

  • Veteran Member
  • Posts: 3133
  • om nom nom
    • View Profile
    • My YouTube Channel
Re: .scm Camera Scripting Tutorial - SA
« Reply #12 on: May 21, 2011, 09:27:02 AM »
^ What about the watermark in the corner?


Great tut, might give it a go sometime.

Offline PtRvY

  • WH Crew
  • Veteran Member
  • Posts: 4153
  • Wasteland Hero / BT Member
    • View Profile
Re: .scm Camera Scripting Tutorial - SA
« Reply #13 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.
« Last Edit: May 21, 2011, 09:34:50 AM by PtRvY »

Offline Ltab-

  • WH Crew
  • Senior Member
  • Posts: 6776
  • escrachado
    • View Profile
    • Soundcloud
Re: .scm Camera Scripting Tutorial - SA
« Reply #14 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

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal