GTAStunting

GTA Series => GTA Modding => Tutorials => Topic started by: Fugitive on July 30, 2006, 09:17:54 AM

Title: [VC] Camera Moves Tutorial
Post by: Fugitive on July 30, 2006, 09:17:54 AM
[VC] Camera Moves Tutorial
Do you want to do an intro or a themed vid, but CamHack isn't enough?
Now you will learn how to code camera moves!



First of all make sure you make a backup of the original "main.scm" file, which is located in the "...\GTA Vice City\data" folder.
- this will help you if you won't code the scm propertly, and if the game will crash.

Second, you will need BW's GTA VC Mission Builder version v1.1 - you can download it HERE (http://grandtheftauto.filefront.com/file/BWs_Vice_Mission_Builder;53981).
- this will help you to open and view the main.scm file.
- extract the "mission_builder_barton_waterduck.zip" file that you have just downloaded, somewhere in your computer.
- after the extraction completes, you should see a folder named "Stripped scripts". Open it, and copy-paste the "Totally_stripped.txt" file, in your "...\GTA Vice City\data" folder and rename it to "main.scm" - be sure to have the same txt extension! This will remove all scripted features available, like missions, saving and loading saved games, pay-n-sprays etc.

Third, you must have GTA Vice Ultimate Trainer By LithJoe - you can download it HERE (http://grandtheftauto.filefront.com/file/Vice_City_Ultimate_Trainer_20;44460).
- you will need a jetpack for your camera settings.

The third thing is to get Player Pos 1.3 - you can download it HERE (http://www.gtasajten.com/gtavc/filer/playerpos.zip).
- this will show you the world coordinates of the player (Tommy) in the game. There are more tools like this one, but this one is simple and very easy to use.

And if you want to learn something more, visit kaneda's "Basic Mission Scripting Tutorial" - click HERE (http://www.gtastunting.com/forums/index.php?showtopic=9033).



After you have done all the steps above, the fun part will come.
Open the "ViceBuilder11.exe" file, and a window will appear. Select your GTA Vice City folder.
Now, go to 'File' -> 'Open file', and open the main.scm txt file that you copy-pasted some minutes ago.
Your camera moves code will be between those two lines.
Code: [Select]
; Put your create_thread commands here

:LabelMAIN3



This is how mine looks (I will explain step by step how to make it):
Code: [Select]
; Best for testing purposes, like MAP modding.
; No scripted features available, like no garages set up, saving and loading saved games not possible,
; no interiours, no doors on buildings, no pay-n-spray, no AmmuNations, no shops, no missions, no parked
; cars, no busses at bus stops, no securety.

; This file has been modified from a file I found somewhere. I don't know who's the original writer.

DEFINE VERSION VICE 1.1

0002: jump ££SecondSegment
DEFINE MEMORY 34329

:SecondSegment
0002: jump ££ThirdSegment
DEFINE OBJECTS 1
DEFINE OBJECT (no name)      \\ This is an unused object. You can put anything here.

:ThirdSegment
0002: jump ££LabelMAIN
DEFINE MISSIONS 0

;-------------MAIN---------------

:LabelMAIN
03A4: name_thread "MAIN"
016A: fade 0  0 ms
01F0: set_max_wanted_level_to 6
0111: set_wasted_busted_check_to 0 (disabled)  
00C0: set_current_time 12 0
04E4: unknown_refresh_game_renderer_at 83.0 -849.8
03CB: set_camera 83.0 -849.8 9.3
0053: $PLAYER_CHAR = create_player #NULL at 80.0 -849.8 9.3
01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR
0001: wait 0 ms
01B6: set_weather 0
00D6: if 0
8118:   NOT   actor $PLAYER_ACTOR dead
004D: jump_if_false ££LabelMAIN2
0352: set_actor $PLAYER_ACTOR skin_to "PLAYER"
038B: load_requested_models
0353: refresh_actor $PLAYER_ACTOR

:LabelMAIN2
016A: fade 1 (back)  1000 ms
00D6: if 0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££LabelMAIN3
04BB: select_interiour 0  \\ select render area
01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)  
01B7: release_weather

; Put your create_thread commands here





; -------------------- CAMERA MOVES CODE STARTS HERE --------------------
 
  
; --- Init scene ---                      
01B4: set_player $PLAYER_CHAR frozen_state  0 (frozen)
02A3: toggle widescreen  1 (on)
016A: fade  0 ()  1000 ms
0001: wait  1000 ms
016A: fade  1 ()  1000 ms
0460: set_camera_pointing_time  0.0  3000  
    
              
              
; --- Part 1 ---
015F: set camera position  507.909 -96.571 9.655  0.0  0.0  0.0
0160: point camera  502.396 -90.854 11.109  2
0001: wait  7000 ms
015F: set camera position  542.440 -103.905 23.590  0.0  0.0  0.0
0160: point camera  568.199 -93.754 30.975  1
    
            
            
; --- Part 2 ---
015F: set camera position  542.440 -103.905 23.590  0.0  0.0  0.0
0160: point camera  568.199 -93.754 30.975  1
0001: wait  4000 ms
015F: set camera position  364.927 -184.847 54.475  0.0  0.0  0.0
0160: point camera  341.394 -234.935 35.997  1
        
                
                
; --- Part 3 ---
015F: set camera position  356.038 -178.472 48.471  0.0  0.0  0.0
0160: point camera  342.037 -218.214 34.900  1
0001: wait  4000 ms
015F: set camera position  119.070 -293.952 34.477  0.0  0.0  0.0
0160: point camera  107.932 -299.516 30.977  1
    
              
                  
; --- Back to normal game ---
0001: wait  5000 ms
016A: fade  0 ()  1000 ms
0001: wait  1000 ms
02A3: toggle widescreen  0 (off)
01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
02EB: restore_camera_with_jumpcut
016A: fade  1 ()  1000 ms



; -------------------- CAMERA MOVES CODE ENDS HERE --------------------





:LabelMAIN3
0001: wait 2500 ms
0002: jump ££LabelMAIN3

; Put your mission mods here



Now you must read carefully, because any letter or any digit that you add in the incorrect place, will make the game to crash. However, if you want to add some notes in the script, use ";" before the line, so that line won't be red or executed by the game. Example:
Code: [Select]
0053: $PLAYER_CHAR = create_player #NULL at 80.0 -849.8 9.3;; this is the player's spawn coordinatesSo the "this is the player's spawn coordinates" text won't be read by the game.






Code: [Select]
; --- Init scene ---                      
01B4: set_player $PLAYER_CHAR frozen_state  0 (frozen)
02A3: toggle widescreen  1 (on)
016A: fade  0 ()  1000 ms
0001: wait  1000 ms
016A: fade  1 ()  1000 ms
01B4: set_player $PLAYER_CHAR frozen_state  0 (frozen) - This will freeze the player (Tommy), so you can't control him until an opcode to unfreeze it is wrote. 0 = frozen, 1 = unfrozen.
02A3: toggle widescreen  1 (on) - I think you already know what this opcode is doing. It switches to widescreen, and it won't be deactivated until you write an opcode to deactivate it. 0 = off, 1 = on
016A: fade  0 ()  1000 ms - This will start a fade out. 1000 is the fading's time in miliseconds. 1000 ms = 1 second. 0 = fade out, 1 = fade in.
0001: wait  1000 ms - This is the time till the fade in starts.
016A: fade  1 ()  1000 ms - This will start the fade in. 1000 is the fading's time in miliseconds. 1000 ms = 1 second. 0 = fade out, 1 = fade in.
0460: set_camera_pointing_time  0.0  3000 -  This is the time that the camera will need. 1500 = default. I added 3000 because I want slower camera moves.





Code: [Select]
; --- Part 1 ---
015F: set camera position  507.909 -96.571 9.655  0.0  0.0  0.0
0160: point camera  502.396 -90.854 11.109  2
0001: wait  7000 ms
015F: set camera position  542.440 -103.905 23.590  0.0  0.0  0.0
0160: point camera  568.199 -93.754 30.975  1
015F: set camera position  507.909 -96.571 9.655  0.0  0.0  0.0 - This will tell from where is watching. All you need to do is just to add your coordonaties (X,Y,Z) in the first three float numbers.
0160: point camera  502.396 -90.854 11.109  2 - Where is watching before the camera move starts.  Replace the coordonaties. DO NOT delete the "2" at the end of the line.
0001: wait  10000 ms - The time until the camera move starts. I've added 10s, so there will be enough time for the textures to load.
015F: set camera position  542.440 -103.905 23.590  0.0  0.0  0.0 - This will tell the camera where to go to watch from. Just replace the coordonaties with yours.
0160: point camera  568.199 -93.754 30.975  1 - This will tell the camera where to watch. The "1" at the end will tell the camera to do the move. If it was 0 instead of 1, the camera would instantly jump to the coordonaties.





Code: [Select]
; --- Part 2 ---
015F: set camera position  542.440 -103.905 23.590  0.0  0.0  0.0
0160: point camera  568.199 -93.754 30.975  1
0001: wait  4000 ms
015F: set camera position  364.927 -184.847 54.475  0.0  0.0  0.0
0160: point camera  341.394 -234.935 35.997  1
015F: set camera position  542.440 -103.905 23.590  0.0  0.0  0.0 - From where is watching...copy-pasted from above. (the last but one coordonaties set of 'Part 1')  
0160: point camera  568.199 -93.754 30.975  1 - Where is watching before the second camera move start...copy-pasted from above. (the last coordonaties set of 'Part 1')  
0001: wait  4000 ms - The waiting time before the camera move starts. It must be equal or greater with the camera pointing time. I've added 4s to have a better result.
015F: set camera position  364.927 -184.847 54.475  0.0  0.0  0.0 - This will tell the camera where to go to watch from. Just replace the coordonaties with yours.
0160: point camera  341.394 -234.935 35.997  1 - This will tell the camera where to watch.





Code: [Select]
; --- Part 3 ---
015F: set camera position  356.038 -178.472 48.471  0.0  0.0  0.0
0160: point camera  342.037 -218.214 34.900  1
0001: wait  4000 ms
015F: set camera position  119.070 -293.952 34.477  0.0  0.0  0.0
0160: point camera  107.932 -299.516 30.977  1
015F: set camera position  356.038 -178.472 48.471  0.0  0.0  0.0 - From where is watching...copy-pasted from above. (the last but one coordonaties set of 'Part 2')  
0160: point camera  342.037 -218.214 34.900  1 - Where is watching before the second camera move start...copy-pasted from above. (the last coordonaties set of 'Part 2')  
0001: wait  4000 ms - The waiting time before the camera move starts. It must be equal or greater with the camera pointing time. I've added 4s to have a better result.
015F: set camera position  119.070 -293.952 34.477  0.0  0.0  0.0 - This will tell the camera where to go to watch from. Just replace th
0160: point camera  107.932 -299.516 30.977  1 - This will tell the camera where to watch.





Code: [Select]
; --- Back to normal game ---
0001: wait  5000 ms
016A: fade  0 ()  1000 ms
0001: wait  1000 ms
02A3: toggle widescreen  0 (off)
01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
02EB: restore_camera_with_jumpcut
016A: fade  1 ()  1000 ms
0001: wait  5000 ms - The time till the fade start. It must be equal or greater than the fading time.
016A: fade  0 ()  1000 ms - This will start a fade out.
0001: wait  1000 ms - This is the time till the fade in starts.
02A3: toggle widescreen  0 (off) - This will swich back to normal screen mode.
01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen) - This will unfreeze the player (Tommy), so now you will be able to control him.
02EB: restore_camera_with_jumpcut - This will restore the camera, right behind the player (normal camera).
016A: fade  1 ()  1000 ms -  This will start the fade in.



After you have finished your scripting, press F7 to compile in the main.scm
That's all, I tried to explain it as well as I could. I hope this will help you, and if you followed this guide carefully, you will succes in your scripting.
Now go and play with it, and remember: scripting needs alot of writing, so you must have patience.
Feel free to post your camera moves here if you want.
Shoutout to Fox for teaching me all that I know about scripting in SCM. Thanks again man.
Title: [VC] Camera Moves Tutorial
Post by: Brulla on July 30, 2006, 09:20:32 AM
Dude this is a interesting tutorial, now im off to read it  
Title: [VC] Camera Moves Tutorial
Post by: JayFoxRox on July 30, 2006, 09:20:35 AM
Nice tut man

Its kinda the work of us both. But you typed alll the clean stuff again. Thx for showing this to every1... Will come usefull to every1 1 day. =)
Title: [VC] Camera Moves Tutorial
Post by: Greendead on July 30, 2006, 09:21:16 AM
That's a lot to read...*reading*
Title: [VC] Camera Moves Tutorial
Post by: NuclearDeath on July 30, 2006, 09:21:46 AM
Awesome tut man,but i'm not really on vc
Title: [VC] Camera Moves Tutorial
Post by: Greendead on July 30, 2006, 09:22:57 AM
I'm lost in this codes  But do you have any example or somethin...
Title: [VC] Camera Moves Tutorial
Post by: Fugitive on July 30, 2006, 09:26:21 AM
Quote from: greendead
I'm lost in this codes  But do you have any example or somethin...
Yeah, you can just copy-paste my code that I posted there in your main.scm... read all to find it... meh.
Title: [VC] Camera Moves Tutorial
Post by: BurnoutLS13 on July 30, 2006, 09:32:51 AM
sweet man, im the jebus of camhack, lets see what i can do with this
Title: [VC] Camera Moves Tutorial
Post by: Fugitive on July 30, 2006, 09:45:19 AM
Scripting is harder than using CamHack, but scripting gives much better results.

For some examples of camera moves, watch "GVT-ZS: Opposide" and "VH DevetoriX" intros.

Please try my tutorial, and post your outcome if you want!
Title: [VC] Camera Moves Tutorial
Post by: Tackleberry on July 30, 2006, 10:12:33 AM
Great tut, now I just wait for the SA version...
Title: [VC] Camera Moves Tutorial
Post by: Xtramus on July 30, 2006, 10:16:08 AM
After reading that, I have one question: How do you set camera moving speed? I already understood most of that (partly due to the fact I've read about every coding FAQ at GTAF(which didn't help that much )), but the speed thing always remains uncovered
Title: [VC] Camera Moves Tutorial
Post by: JayFoxRox on July 30, 2006, 10:25:55 AM
Speed in SA can be controlled by 2 special opcodes (move camera from to and rotate camera from to)

But in VC its a bit tricky... I used an thread loop all the time for this until fugitive made me looking more into cam stuff. Set camera pointing time seems to control spin and vel ammount of camera. But yesterday i used another opcode in GUS. I will look for it later and will mention it in my basic SCM tutorial
Title: [VC] Camera Moves Tutorial
Post by: Kingjad on July 30, 2006, 10:26:40 AM
With Fugitive's help I made a short camera-work thingy with scripting, and he also told me about putting actors and vehicles in too!  Awesome tut fungi.

EDIT: Post edited with attached clip!  I altered the opening shot from what fungi had given me (just switched the cam position and the direction it faced), and also added a completely new bit where I go off and view the lighthouse.  I'm vewy pwoud  thanks fungi!  This guide is very helpful for newbies like me.

[attachmentid=2421]
Title: [VC] Camera Moves Tutorial
Post by: Fugitive on July 30, 2006, 10:26:50 AM
Quote from: Xtramus
After reading that, I have one question: How do you set camera moving speed? I already understood most of that (partly due to the fact I've read about every coding FAQ at GTAF(which didn't help that much )), but the speed thing always remains uncovered
0460: set_camera_pointing_time 0.0 3000 - This is the time that the camera will need. 1500 = default. I added 3000 because I want slower camera moves.

I thought you red it all.
Title: [VC] Camera Moves Tutorial
Post by: Kingjad on July 30, 2006, 10:40:10 AM
I edited my last post with a video attachment!
Title: [VC] Camera Moves Tutorial
Post by: Psycho on July 30, 2006, 11:00:47 AM
dude thats awesome, i wish i could understand it cause my camhack doesnt work
Title: [VC] Camera Moves Tutorial
Post by: Brainkiller on July 30, 2006, 11:11:49 AM
Awsome, it was a struggle but after i while i got it to work

Title: [VC] Camera Moves Tutorial
Post by: Fugitive on July 30, 2006, 11:19:54 AM
Quote from: Psycho
dude thats awesome, i wish i could understand it cause my camhack doesnt work
Why you don't understand it?
Title: [VC] Camera Moves Tutorial
Post by: Brainkiller on July 30, 2006, 11:26:10 AM
Here's what i made up to now

http://media.putfile.com/scripting (http://media.putfile.com/scripting)

I've sorted out  the angle of which way Tommy stands
Title: [VC] Camera Moves Tutorial
Post by: Neo Anderson on July 30, 2006, 11:28:35 AM
Great tut there dude.  
Title: [VC] Camera Moves Tutorial
Post by: JayFoxRox on July 30, 2006, 11:32:59 AM
lol nice BK. Maybe you could add a bike jumping down that small thing when the camera is pointing at it?

//Edit: Wow the stuff by Kingjad is lookin gd. This community seems to be much more skilled in coding than i thought first
Title: [VC] Camera Moves Tutorial
Post by: Glen1992 on July 30, 2006, 12:43:15 PM
nice tut im deffently trying this out
Title: [VC] Camera Moves Tutorial
Post by: Link on July 30, 2006, 01:13:27 PM
Fucking nice Fug !
Title: [VC] Camera Moves Tutorial
Post by: Kingjad on July 30, 2006, 03:22:14 PM
Quote from: Psycho
Quote from: Fugitive
Quote from: Psycho
dude thats awesome, i wish i could understand it cause my camhack doesnt work
Why you don't understand it?
cause i got partway through it and just scanned the rest

Lazy bugger.  Go read it!
Title: [VC] Camera Moves Tutorial
Post by: Liviu on July 30, 2006, 09:24:30 PM
Quote from: Fugitive

Code: [Select]
; --- Innit scene ---                      


 

really cool tut, i wonder if this can be done in SA somehow
Title: [VC] Camera Moves Tutorial
Post by: Xtramus on July 31, 2006, 01:44:35 AM
OK I have another question

How do you make it so that if you stand somewhere (i.e. a mission marker) that the cam coding starts working? Like they do with the missions, you walk into a marker and the camera fades out, and a cutscene starts.
Title: [VC] Camera Moves Tutorial
Post by: Dannye on July 31, 2006, 01:50:12 AM
Very nice tut dude. While I have had some scm experience, I have not gone into much depth with camera-scripting, so some of this is handy to me too  . Cheers dude.

If those who asked about SA were serious, then yes it can be done, in a similar way, you want to use SA Mission Builder 0.33 (well, thats what I got) instead of Vice City Mission Buildier, then you are set to go (note: they operate a little differently so i suggest reading the readme).

@X: there are a few ways, one would be doing a check for keypresses. Ie. If user presses a certain button then  move to a certain part of the code. An alternative would be to just take the code from a mission, delete it all, and replace it with your stuff. I suggest the 1st method, i find it simpler (someone with more experience may think differently).

An example for the keypresses suggestion would be as follows:

Code: [Select]
:CameraPan  
0001: wait 0? ms
00D6: if  0?                                                      
80E1:   NOT key_pressed  0?  17?           \\ Press Shoot To Begin Camera Panning
004D: jump_if_false ££CameraPanDown
0002: jump ££CameraPan

The thread keeps running (probably not too efficient, but who cares  ) and checks till you press a certain button, when you do, it goes and does something (it moves to the section of your code with the label "CameraPanDown" and runs it). Note if you got the version of MB that was said in the first post, the syntax here IS NOT THE SAME (it is similar, but with minor differences), because I use v022.
Title: [VC] Camera Moves Tutorial
Post by: Psycho on July 31, 2006, 04:53:49 AM
Quote from: Kingjad
Quote from: Psycho
Quote from: Fugitive
Quote from: Psycho
dude thats awesome, i wish i could understand it cause my camhack doesnt work
Why you don't understand it?
cause i got partway through it and just scanned the rest

Lazy bugger.  Go read it!
unfortunately the part i scanned was the orange part that tells you what everything means
Title: [VC] Camera Moves Tutorial
Post by: JayFoxRox on July 31, 2006, 05:33:30 AM
Quote from: Dannye
Very nice tut dude. While I have had some scm experience, I have not gone into much depth with camera-scripting, so some of this is handy to me too  . Cheers dude.

If those who asked about SA were serious, then yes it can be done, in a similar way, you want to use SA Mission Builder 0.33 (well, thats what I got) instead of Vice City Mission Buildier, then you are set to go (note: they operate a little differently so i suggest reading the readme).

@X: there are a few ways, one would be doing a check for keypresses. Ie. If user presses a certain button then  move to a certain part of the code. An alternative would be to just take the code from a mission, delete it all, and replace it with your stuff. I suggest the 1st method, i find it simpler (someone with more experience may think differently).

An example for the keypresses suggestion would be as follows:

Code: [Select]
:CameraPan  
0001: wait 0? ms
00D6: if  0?                                                      
80E1:   NOT key_pressed  0?  17?           \\ Press Shoot To Begin Camera Panning
004D: jump_if_false ££CameraPanDown
0002: jump ££CameraPan

The thread keeps running (probably not too efficient, but who cares  ) and checks till you press a certain button, when you do, it goes and does something (it moves to the section of your code with the label "CameraPanDown" and runs it). Note if you got the version of MB that was said in the first post, the syntax here IS NOT THE SAME (it is similar, but with minor differences), because I use v022.

You builder seems to be outdated  ? < for int n stuff...

Also this code would be more helpfull

Code: [Select]

create_thread ££CameraPan

:Loop;;Your mainloop
0001: wait 5000 ms
0002: jump ££Loop

:CameraPan  
0001: wait 10 ms
00D6: if  0                                                      
;; 80E1:   NOT key_pressed  0  17          ;; Press Shoot To Begin Camera Panning - ignore this
if_player_in_cube -5.0 -5.0 -5.0 5.0 5.0 5.0
004D: jump_if_false ££CameraPan
0002: jump ££CameraPan

To get the opcodes of the lines without press F1 in the builder while a keyword in that line is marked or go to

http://vc-db.webtools4you.net/ (http://vc-db.webtools4you.net/)
http://sa-db.webtools4you.net/ (http://sa-db.webtools4you.net/)
Title: [VC] Camera Moves Tutorial
Post by: Dannye on July 31, 2006, 07:01:11 AM
^ Yeah I know, v022 was the first one I got and I was too lazy to change  .

EDIT: Question, so with the use of the coords (in your last post), its kinda like checking if the player stands in a certain spot, rather than pressing a button, yes?
Title: [VC] Camera Moves Tutorial
Post by: marklund on July 31, 2006, 07:26:28 AM
Dude, this is awesome! Thanks alot and really good tutorial. I'll use this.
Title: [VC] Camera Moves Tutorial
Post by: JayFoxRox on July 31, 2006, 07:30:19 AM
Dannye: Exactly. You can check if teh player is in a certain radius and then make him do sthin. Could come usefull when doing a check if a car will hit the player soon for a story as sample. So you use create_coordinate_from_car xx yy zz and then you check if the player is in that area. so when the player is in front of it make him jump and play roll anim so he rolls freekin nice over the car
Title: [VC] Camera Moves Tutorial
Post by: bj070893 on August 02, 2006, 04:57:41 AM
Here's my result

http://files.filefront.com/omgiactuallyman...;/fileinfo.html (http://files.filefront.com/omgiactuallymanagedtocodesomethingwmv/;5342080;;/fileinfo.html)
Title: [VC] Camera Moves Tutorial
Post by: JayFoxRox on August 02, 2006, 05:16:43 AM
Looks good so far bj. Maybe you can add some script for the actor as well..
Title: [VC] Camera Moves Tutorial
Post by: bj070893 on August 02, 2006, 05:32:43 AM
Quote from: Fox
Looks good so far bj. Maybe you can add some script for the actor as well..

Thanks. I wanna make him get on the PCJ and drive off.
SimplePortal 2.3.7 © 2008-2024, SimplePortal