Author Topic: Introduction to SCM coding VC\LC  (Read 25691 times)

0 Members and 1 Guest are viewing this topic.

Offline Neo Anderson

  • ATS precision whore
  • Veteran Member
  • Posts: 5079
  • Registered on: April 16, 2004
    • View Profile
Introduction to SCM coding VC\LC
« on: May 28, 2007, 09:47:31 AM »
Ok gonna start with the very basics in hopes people will become interested to learn. This script is for VC ONLY and will NOT work in LC. The coding process is the same but scripts are not interchangable.
I know it's a long read but please feel free to ask any questions. I don't know it all but I'll help as much as I can.

Check this site out. It's where I picked up alot of information on what's what.
VC Webtools

First, these are the tools you'll need.

Vice Builder version 022.
(this program is for opening and creating .scm files in VC\LC)
Spoosh Demo or another tool that gives co-ords in game of your location
(this program shows on screen where you are in the game with 3(X,Y,Z) coordinates)
Ped Model Referance Guide
(Basically it's a bunch of pictures of each ped with thier names so you know who's who)
Fraps
(this program allows you to record your in game footage)
Camhack v3.0c
(this also allows you record game footage but allows you to move the camera around with your mouse, this is optional and not required)

When you install and open Mission Builder you'll need to have a 'stripped" script in the VC data folder so FIRST back up your main.scm file to some where safe. Then add this script, main.scm.txt(attached below).
Now in Mission Builder open file and find this main.scm.txt. It should open and should be able to read it. Click anywhere on the page and press F7. This will overwrite your main.scm. You can now start a new game in VC and this script is what you'll get. Remember each time you make any changes to a script you must press F7, exit the game and start a "new" game.

Now in the Mission Builder folder are some helpful .txt files for things like animations and weapons. They will list the animation, weapon, it's number and the action or particular weapon you'll get by using it. There are also opcodes(a list of codes that result in particular actions). These are useful to help find a code to make a ped, vehicle or the camera do something.

Here is a basic script I wrote up to get things started. This is for VC ONLY and will not work in LC. This is what's called a "stripped" script. Alot of things in game are missing, pickups, parked cars, interiors, peds, traffic etc.

The list below is color coded. The code or codes that cause the action to happen are that color in the script.

Spawns you at a given location
Sets the time and weather
Creates 2 vehicles, a car and a bike
Creates two peds, ARMY and BKA(a biker)
Places them each in one of the cars
Gives them each a weapon
Makes them drive to a given location
Has them get out of thier cars
Has them walk to a given location
Has them face eachother
Tells ARMY to kill BKA
Tells ARMY to crouch down in front of BKA
Has ARMY walk to the bike and drive away

Basically I want you guys to download this script and play around with it to get a feel of how things happen.
Just remember to back up your original main.scm. If you do something wrong the game will crash so just tab out and fix whatever it was you just changed.

I will continue these based on this script in the future adding different actions and camera moves.


-------------------------------------------------------------------------------------------------------------------------------


0002: jump ££Label008620
DEFINE MEMORY  34329

:Label008620
0002: jump ££Label008644
DEFINE OBJECTS  1
DEFINE OBJECT DOOR                        \\ This is an unused object. You can put anything here.

:Label008644
0002: jump ££Label008658
DEFINE MISSIONS  0

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


:Label008658
03A4: name_thread "MAIN"
016A: fade  0? ()  0? ms
01F0: set_max_wanted_level_to  0?
03AD: toggle_rubbish  0?
03DE: set_pedestrians_density_multiplier_to  0?
01EB: set_car_density_to  0?
0111: set_wasted_busted_check_to  0? (disabled)
00C0: set_current_time  10?  0?
04E4: unknown_refresh_game_renderer_at  380.60!  253.15!
03CB: set_camera  380.60!  253.15!  15.43!
0053: $PLAYER_CHAR = create_player #NULL at  380.60!  253.15!  15.43!
01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR
0330: set_player $PLAYER_CHAR infinite_run_to  1? (true)
0001: wait  0? ms
01B6: set_weather  0?
00D6: if  0?
8118:   NOT   actor $PLAYER_ACTOR dead
004D: jump_if_false ££Label0086EF
0352: set_actor $PLAYER_ACTOR skin_to "PLAYER"
038B: load_requested_models
0353: refresh_actor $PLAYER_ACTOR
0222: set_player  2228?? health_to  100!

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

:Label008700
0001: wait  1000& ms
0247: request_model #PCJ600
0247: request_model #INFERNUS
0247: request_model #UZI[/color]
0247: request_model #ARMY
0247: request_model #TEC9
0247: request_model #BKA
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #INFERNUS available

8248:   NOT   model #UZI available
8248:   NOT   model #ARMY available
8248:   NOT   model #TEC9 available
8248:   NOT   model #BKA available
004D: jump_if_false ££Label008706
0001: wait  1000& ms
0002: jump ££Label008700

:Label008706
038B: load_requested_models
0001: wait  1000& ms
0002: jump ££Label008711

:Label008711
0001: wait  1000& ms
00A5:  400?? = create_car #INFERNUS at 338.58!  239.19!  11.37!
0175: set_car  400?? z_angle_to  270!
00AE: unknown_set_car  400?? to_ignore_traffic_lights  1?
00AD: set_car  400?? max_speed_to  0!
02AC: set_car  400?? immunities  1?  1?  1?  1?  1?

0129:  28?? = create_actor  4? #ARMY in_car  400?? driverseat
01B2: give_actor  28?? weapon  22? ammo  100&
02E2: set_actor  28?? weapon_accuracy_to  99?

0350: unknown_actor  28?? not_scared_flag  1?
0002: jump ££Label008717

:Label008717
0001: wait  1000& ms
00A5:  404?? = create_car #PCJ600 at 408.77!  239.58!  10.88!
0175: set_car  404?? z_angle_to  90!
00AE: unknown_set_car  404?? to_ignore_traffic_lights  1?
00AD: set_car  404?? max_speed_to  0!
02AC: set_car  404?? immunities  1?  1?  1?  1?  1?

0129:  32?? = create_actor  4? #BKA in_car  404?? driverseat
01B2: give_actor  32?? weapon  23? ammo  100&
02E2: set_actor  32?? weapon_accuracy_to  29?

0350: unknown_actor  32?? not_scared_flag  1?
0002: jump ££Label008722

:Label008722
0001: wait  5000& ms
02C2: car  400?? drive_to_point 372.51!  238.48!  10.82!
00AD: set_car  400?? max_speed_to  10!

0001: wait  1000& ms
02C2: car  404?? drive_to_point 381.83!  241.16!  10.61!
00AD: set_car  404?? max_speed_to  10!

0002: jump ££Label008729

:Label008729
0001: wait  7000& ms
03E2: actor  28?? exit_car
03E2: actor  32?? exit_car

0001: wait  4000& ms
0211: actor  28?? walk_to 368.27! 242.45!
0211: actor  32?? walk_to 385.78! 236.38!

0001: wait  7000& ms
020E: actor  28?? look_at_actor  32??
020E: actor  32?? look_at_actor  28??

0002: jump ££Label008733

:Label008733
0001: wait  4000& ms
01C9: actor  28?? kill_actor  32??
0002: jump ££Label008738

:Label008738
0001: wait  6000& ms
0211: actor  28?? walk_to 384.03! 237.43!
0001: wait  14500& ms
04EB: 28?? make_actor_crouch  1? 5000& ms
0001: wait  6000& ms
01D5: actor  28?? go_to_and_drive_car  404??
00AD: set_car  404?? max_speed_to  0!

0001: wait  4500& ms
02C2: car  404?? drive_to_point 319.93!  244.77!  11.45!
00AD: set_car  404?? max_speed_to  30!

0002: jump ££Label008743

:Label008743
0001: wait  1000& ms
0002: jump ££Label008743
« Last Edit: June 11, 2010, 03:03:13 PM by Neo Anderson »

Offline Aeneon

  • Posts: 3724
    • View Profile
    • http://
Introduction to SCM coding VC\LC
« Reply #1 on: May 28, 2007, 09:49:24 AM »
WOW, Gonna read

-The attatched SCM Dont work >_<
« Last Edit: May 28, 2007, 09:57:14 AM by Blaze »

Offline Crazy

  • Veteran Member
  • Posts: 3053
  • boc
    • View Profile
Introduction to SCM coding VC\LC
« Reply #2 on: May 28, 2007, 10:15:19 AM »
Thanks, Neo! I needed this.

Offline JayFoxRox

  • Posts: 2221
    • View Profile
    • Homepage
Introduction to SCM coding VC\LC
« Reply #3 on: May 28, 2007, 10:19:09 AM »
Great tut BUT i still dont get it - WHY YOU TRY TO KILL NOOBS WITH OLD VERSIONS WHICH NEED MANUAL VARTYPE SYMBOLS

Offline Neo Anderson

  • ATS precision whore
  • Veteran Member
  • Posts: 5079
  • Registered on: April 16, 2004
    • View Profile
Introduction to SCM coding VC\LC
« Reply #4 on: May 28, 2007, 12:06:31 PM »
Quote from: Blaze
WOW, Gonna read

-The attatched SCM Dont work >_<
It's not a Main.scm, it's a main scm TXT. Read above


Quote from: Fox
Great tut BUT i still dont get it - WHY YOU TRY TO KILL NOOBS WITH OLD VERSIONS WHICH NEED MANUAL VARTYPE SYMBOLS
Are you gonna start this crap again?   This is what I use, this is what I learned on. Everyone needs to start somewhere. YOU are not new to this so why do you have to come in here and bust my balls when I'm tryin to help people who ARE new to this?

Offline Godfather

  • Veteran Member
  • Posts: 3487
    • View Profile
    • http://
Introduction to SCM coding VC\LC
« Reply #5 on: May 28, 2007, 12:45:06 PM »
Quote from: Fox
Great tut BUT i still dont get it - WHY YOU TRY TO KILL NOOBS WITH OLD VERSIONS WHICH NEED MANUAL VARTYPE SYMBOLS
Make a tut with whatever shit you do them with.

Offline Cody

  • Veteran Member
  • Posts: 5666
  • (stormlexer)
    • View Profile
Introduction to SCM coding VC\LC
« Reply #6 on: May 28, 2007, 04:33:53 PM »
Could somebody tell me where to get Vice Builder version 022 and Ped Model Referance Guide?

Offline Neo Anderson

  • ATS precision whore
  • Veteran Member
  • Posts: 5079
  • Registered on: April 16, 2004
    • View Profile
Introduction to SCM coding VC\LC
« Reply #7 on: May 28, 2007, 07:27:49 PM »
Quote from: storm_lexer
Could somebody tell me where to get Vice Builder version 022 and Ped Model Referance Guide?
I'm gonna take a wild guess and say in the GTA MODS for VC\LC\SA section?

Offline Cody

  • Veteran Member
  • Posts: 5666
  • (stormlexer)
    • View Profile
Introduction to SCM coding VC\LC
« Reply #8 on: May 28, 2007, 07:44:42 PM »
Oh yeah.. Forgot about that.  
I'll try this out once i'm finished converting GH songs for Frets on Fire.. Which'll prolly take till tomorrow.

Offline Tackleberry

  • Veteran Member
  • Posts: 7402
    • View Profile
Introduction to SCM coding VC\LC
« Reply #9 on: May 29, 2007, 09:12:05 AM »
Very nice, good job.

I think I can follow you, but it feels A BIT messy to me... I have some questions:

*What are all the?
"01F0:"
"03AD:"
"0256:"
What names them, how do you know what to name them and what do they?

*How do you get the coordinates for the exact places on the map?

*Any reason why you named the players and cars to weird numbers (e.g. "32??")?

*What did this do?
"00D6: if 0?
8248: NOT model #PCJ600 available
8248: NOT model #INFERNUS available
8248: NOT model #UZI available
8248: NOT model #ARMY available
8248: NOT model #TEC9 available
8248: NOT model #BKA available
004D: jump_if_false ££Label008706"
I think I understand what it means, but I don't understand why it's necessary.

*Also I can't seem to find the numbers for weather, immunities and stuff like that. Where do I find them?

Sorry for being a noob at this...

Offline morbidxxx

  • Veteran Member
  • Posts: 4093
    • View Profile
Introduction to SCM coding VC\LC
« Reply #10 on: May 29, 2007, 12:21:54 PM »
Great tutorial Neo  I really needed it

Offline Neo Anderson

  • ATS precision whore
  • Veteran Member
  • Posts: 5079
  • Registered on: April 16, 2004
    • View Profile
Introduction to SCM coding VC\LC
« Reply #11 on: May 29, 2007, 02:41:27 PM »
Quote from: Tackleberry
*What are all the?
"01F0:"
"03AD:"
"0256:"
What names them, how do you know what to name them and what do they?
Those are opcodes, numbers assigned to a specific action. Alot of what I know comes from looking through the original main.scm for VC. Also I'll add a link to a place specifically for opcodes for VC.

*How do you get the coordinates for the exact places on the map?
   oops, I added the program to the tutorial

*Any reason why you named the players and cars to weird numbers (e.g. "32??")?
Again from reading the original main.scm, all peds and cars must have a number assigned to them. They must be in increments of 4 (28, 32, 36, 40, 44, 48 etc.)

*What did this do?
"00D6: if 0?
8248: NOT model #PCJ600 available
8248: NOT model #INFERNUS available
8248: NOT model #UZI available
8248: NOT model #ARMY available
8248: NOT model #TEC9 available
8248: NOT model #BKA available
004D: jump_if_false ££Label008706"
I think I understand what it means, but I don't understand why it's necessary.
To tell ya the truth I don't know what everything means or why it's needed but it appears in the original main.scm and doesn't work without it.

*Also I can't seem to find the numbers for weather, immunities and stuff like that. Where do I find them?
The link I'm posting for all opcodes will have more on those. It's where I picked up alot of information on this.

Sorry for being a noob at this...
No, don't be sorry. The whole idea is for people to do just this, ASK questions  

Offline Dannye

  • Veteran Member
  • Posts: 3565
    • View Profile
Introduction to SCM coding VC\LC
« Reply #12 on: May 29, 2007, 03:38:24 PM »
Before I start, I too don't know everything, so much of what I say could quite possibly be wrong:

As Neo said, the four digit numbers prior to every function is called the opcode. Its a hex number. By default the first digit is always zero (so its always 0xxx), but in 'conditional opcodes' (ones used within "IF"s, eg. 0248 in Neo's example), you often want to check for the inverse of the function, and in that case you make the first digit an 8. For example: 0248: model #PCJ600 available (checks if the model is available), but 8248: NOT model #PCJ600 available (checks if the model isn't available). The opcodes and the parameters (things starting or ending in #'s, ?'s, !'s etc) are the most important part of each line of code, the words in the line, such as "available" aren't even necessary, but they do make the code easier to follow, so its worth including. Since there are many different scm compilers (and many different versions of each), once you find an opcode you want to use, its often worth doing a search for it in the original scm (which you have decompiled into a text file using whichever program you use), and copying it, changing the parameters for your use.

Another decent place to look for code is at GTAForums - Editing Discussion, its a big place, but it can be handy. There are pinned threads there for VC opcodes and SA opcodes. Some of that stuff is more recent than the stuff on the database website, but nevertheless, the database site is very well designed, and its always worth looking there first. They also have a bunch of tutorials there too.

Everything between a 00D6 and a 004D are conditions for "IF"s. The ones you were asking about Tack, they are there because they are necessary, I think. Whenever you have a "load" model function, before you use the model, you first need a check to make sure its finished loading, because if it hasnt, then you would be refering to something that doesnt exist yet.

There should be some more handy info in Kaneda's mission coding tutorial. EDIT: And Nitzkit's tutes too
« Last Edit: May 29, 2007, 03:44:40 PM by Dannye »

Offline Nitzkit

  • Moderator
  • Posts: 7181
    • View Profile
Introduction to SCM coding VC\LC
« Reply #13 on: May 29, 2007, 03:43:34 PM »
HOW DARE YOU NEO, HOW DARE YOU TRY TO TAKE THE AUDIENCE FROM MY DUMMY'S GUIDE!!















 ... Nice tut
« Last Edit: May 29, 2007, 03:51:17 PM by Nitzkit »

Offline VenomX

  • Veteran Member
  • Posts: 4294
    • View Profile
Introduction to SCM coding VC\LC
« Reply #14 on: May 29, 2007, 03:53:24 PM »
Brilliant guide, there's only one thing I'm a bit confused about.  The car immunities, where it says 1? 1? 1? 1? 1?...is that bulletproof, fireproof etc.?  And in which order?  Thanks a lot .

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal