GTAStunting

GTA Series => GTA Modding => Tutorials => Topic started by: Neo Anderson on May 28, 2007, 09:47:31 AM

Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson 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 (http://vc-db.webtools4you.net/?show=all)

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
Title: Introduction to SCM coding VC\LC
Post by: Aeneon on May 28, 2007, 09:49:24 AM
WOW, Gonna read

-The attatched SCM Dont work >_<
Title: Introduction to SCM coding VC\LC
Post by: Crazy on May 28, 2007, 10:15:19 AM
Thanks, Neo! I needed this.
Title: Introduction to SCM coding VC\LC
Post by: JayFoxRox 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
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson 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?
Title: Introduction to SCM coding VC\LC
Post by: Godfather 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.
Title: Introduction to SCM coding VC\LC
Post by: Cody on May 28, 2007, 04:33:53 PM
Could somebody tell me where to get Vice Builder version 022 and Ped Model Referance Guide?
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson 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?
Title: Introduction to SCM coding VC\LC
Post by: Cody 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.
Title: Introduction to SCM coding VC\LC
Post by: Tackleberry 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...
Title: Introduction to SCM coding VC\LC
Post by: morbidxxx on May 29, 2007, 12:21:54 PM
Great tutorial Neo  I really needed it
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson 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  
Title: Introduction to SCM coding VC\LC
Post by: Dannye 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
Title: Introduction to SCM coding VC\LC
Post by: Nitzkit 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
Title: Introduction to SCM coding VC\LC
Post by: VenomX 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 .
Title: Introduction to SCM coding VC\LC
Post by: Master_Yayo on May 29, 2007, 05:17:25 PM
Just wondering is it possible to take an animation file like "insert name".ifp in the cutscene.img and script it so peds you choose act out the animation in given coordinates?
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on May 29, 2007, 06:35:33 PM
First I wanna thank Dannye    man you know waaaay more about this stuff than me.

Kan has played with just this idea Master_Yayo. Not sure how well it works though as I have not tried it myself.
Title: Introduction to SCM coding VC\LC
Post by: Dark Rebel on May 29, 2007, 06:38:10 PM
Very nice tut
Title: Introduction to SCM coding VC\LC
Post by: Cody on May 29, 2007, 08:01:12 PM
Quote from: Neo Anderson
First I wanna thank Dannye    man you know waaaay more about this stuff than me.

Kan has played with just this idea Master_Yayo. Not sure how well it works though as I have not tried it myself.
He wants to make a CF porno.
Title: Introduction to SCM coding VC\LC
Post by: n0ah on May 30, 2007, 10:27:59 AM
Thank you very much Neo, I always wanted to learn this.
Title: Introduction to SCM coding VC\LC
Post by: deVon on May 31, 2007, 12:31:45 AM
This helped a LOT. Thanks!
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 02, 2007, 05:31:10 PM
"ERROR: Expected the DEFINE VERSION command before DEFINE OBJECTS.
Command: OBJECTS 1"

Help please anyone?   This is my first few lines:

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
Title: Introduction to SCM coding VC\LC
Post by: Dannye on June 02, 2007, 05:36:56 PM
Quote from: VenomX
0002: jump ££Label008620
DEFINE MEMORY 34329

That should be your second/third line of code.

The first line of code should be something along the lines of:

DEFINE VERSION VICE 0.22

(Where the number may be different based on which compiler you use. To check exactly what number you need, just de-compile the game's standard scm, and look at the first line, then copy that into yours).
Title: Introduction to SCM coding VC\LC
Post by: Jason on June 03, 2007, 03:47:27 AM
requesting opcode to make set_car to ignore road-paths
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 03, 2007, 08:08:22 AM
Quote from: Haywire
requesting opcode to make set_car to ignore road-paths


00AF: set_car_driver_behaviour  400??  x?


- use following bits for behavior (simply add the second values together) -
. - go nowhere
1 - follow road, drive back if way is blocked
2 - kill the player
4 - drive to player and stop
8 - ignore road-paths
Title: Introduction to SCM coding VC\LC
Post by: Aeneon on June 03, 2007, 12:55:02 PM
Neo, If you know how, Could you make a tut that spawns peds at certain locations? Thx.
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 03, 2007, 01:21:23 PM
Thanks Dannye!

Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 04, 2007, 04:32:28 AM
Quote from: Blaze
Neo, If you know how, Could you make a tut that spawns peds at certain locations? Thx.

This tut does that
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 16, 2007, 04:50:24 AM
Hi, i find it very hard to find the tools to make my own main.scm. Could you maybe post some links in the first post Neo XD
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 16, 2007, 05:20:22 AM
I believe that everything you need is on the GTAS Filefront account, check there .
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 16, 2007, 05:26:36 AM
Link for that
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 16, 2007, 05:34:20 AM
Camhack: http://files.filefront.com/vc_camhack30zip...;/fileinfo.html (http://files.filefront.com/vc_camhack30zip/;6247030;/fileinfo.html)

Mission builder 0.22: http://www.gtagaming.com/pafiledb.php?acti...load&id=175 (http://www.gtagaming.com/pafiledb.php?action=download&id=175)

Player position 1.3: http://files.steve-m.com/playerpos-1.3.zip (http://files.steve-m.com/playerpos-1.3.zip)  (I find this easier to use to find co-ordinates)
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 17, 2007, 06:11:26 AM
There is something else i need, that thing to tell me everythings ids and names
And how would i get lots of diffrent tommy characters in it?

EDIT: i think if found it
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 17, 2007, 06:18:26 AM
Replace a pedestrian model and texture with your players, then spawn loads of that ped .
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 17, 2007, 06:26:57 AM
now i just need to find the ped textures XD
()
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 17, 2007, 12:15:09 PM
Quick question to anyone that knows, even with lonely mod and the driver's behaviour set to 8?, why does the car still attempt to drive on the correct side of the road?  Any help would be appreciated, thank you.
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 17, 2007, 02:12:13 PM
/me has a new problem . Ive spent half of my day making this it was going well but it just dont work no more   . Any help would be nice. The game just freezes after the bikes are spawned

DEFINE VERSION VICE 0.22

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  12?  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 -538.780! 695.463! 10.104!
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  250!

: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 #PCJ600
0247: request_model #VICE1
0247: request_model #VICE2

00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE1 available
8248:   NOT   model #VICE2 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 #PCJ600 at -528.136!  732.589!  10.094!
0175: set_car  400?? z_angle_to  90!
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? #VICE2 in_car  400?? driverseat
0350: unknown_actor  28?? not_scared_flag  1?
009A:  32?? = create actor  4? #VICE1 at -560.087! 705.578! 19.534!
00A5:  404?? = create_car #PCJ600 at -525.472!  698.483!  10.075!
0175: set_car  404?? z_angle_to  180!
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?
0002: jump ££Label008722

:Label008722
0001: wait  7000& ms
02C2: car  400?? drive_to_point -528.225!  689.647!  9.706!
00AD: set_car  400?? max_speed_to  40!
0001: wait  1000& ms
0383: actor  28?? car horn activated == true
0122: actor  28?? pressing horn
0383: actor  28?? car horn activated == false
0002: jump ££Label100862

:label100862
0239: actor  28?? run to  -545.219! 694.679! 19.553!
0239: actor  28?? run to  -526.854! 695.999! 10.101!
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 17, 2007, 02:30:59 PM
Opcode 0383 doesn't work for actors, its a player specific code.  Just search for a horn midi on google, and put that into your film instead .
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 17, 2007, 02:49:51 PM
Quote from: VenomX
Quick question to anyone that knows, even with lonely mod and the driver's behaviour set to 8?, why does the car still attempt to drive on the correct side of the road?  Any help would be appreciated, thank you.
could you post your script that given you troubles?

Title: Introduction to SCM coding VC\LC
Post by: DJS on June 18, 2007, 11:35:24 AM
Is there an opcode that makes the cars/ bikes go in a strait line?. The bikes keep going left and right on the road

Strait -   ______________
................................._________
Left to right - \____/................... \_______

Crappy drawings but i think you know what i mean
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 18, 2007, 02:17:02 PM
It all depends on the opcodes you have used. Post the SCM.txt and I'll take a look.
Title: Introduction to SCM coding VC\LC
Post by: morbidxxx on June 20, 2007, 10:36:37 AM
I was trying to make a script were on guy try to kill me but in the end I got this http://www.youtube.com/watch?v=6W5vEfBq-Dg (http://www.youtube.com/watch?v=6W5vEfBq-Dg)
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 20, 2007, 11:00:39 AM
Hehe, looks like you spawend a load of players instead of actors .
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 20, 2007, 12:02:18 PM
ok fixed the other problem thanks to VenomX over msn but i have a new problem. One bike dont spawn in the proper position and sometimes it spawned weird :/ and antoeher bike dont move when itsmeant to :/. Take a look see what you can finds wrong
DEFINE VERSION VICE 0.22

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  12?  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 -471.144! 689.531! 9.611!
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  250!

: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 #PCJ600
0247: request_model #PCJ600
0247: request_model #VICE1
0247: request_model #VICE2
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #PCJ600 available
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE1 available
8248:   NOT   model #VICE2 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 #PCJ600 at -661.025! 624.178! 9.438!
0175: set_car  400?? z_angle_to  000!
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? #VICE2 in_car  400?? driverseat
0350: unknown_actor  28?? not_scared_flag  1?
009A:  32?? = create actor  4? #VICE1 at -560.087! 705.578! 19.534!
00A5:  404?? = create_car #PCJ600 at -523.926! 698.151! 9.930!
0175: set_car  404?? z_angle_to  003!
00AE: unknown_set_car  404?? to_ignore_traffic_lights  0?
00AD: set_car  404?? max_speed_to  0!
02AC: set_car  404?? immunities  1?  1?  1?  1?  1?
00A5:  396?? = create_car #PCJ600 at -471.130! 689.531! 9.611!
0175: set_car  396?? z_angle_to  180!
00AE: unknown_set_car  404?? to_ignore_traffic_lights  0?
00AD: set_car  396?? max_speed_to  0!
02AC: set_car  396?? immunities  1?  1?  1?  1?  1?
0002: jump ££Label008722

:Label008722
0001: wait 2000& ms
00AF: set car  400?? driver behaviour to  1?
02C2: car 400?? drive_to_point -530.410! 686.076! 9.931!
00AD: set_car  400?? max_speed_to  20!
0001: wait  12000& ms
0002: jump ££Label100862

:label100862
0239: actor 32?? run to  -546.182! 697.452! 19.534!
0001: wait  3000& ms
0239: actor 32?? run to  -526.121! 697.891! 10.090
0001: wait  3000& ms
01D5: actor  32?? go_to_and_drive_car  404??
0002: jump ££Label100863

:Label100863
0001: wait  2000& ms
00AF: set car  404?? driver behaviour to  1?
00AD: set_car  400?? max_speed_to  30!
00AD: set_car  404?? max_speed_to  30!
02C2: car 400?? drive_to_point  -418.192! 947.754! 9.930!
02C2: car 404?? drive_to_point  -417.036! 950.396! 9.930!
0002: jump ££Label00864

:Label00864
0247: request_model #PCJ600
0247: request_model #VICE3
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE3 available

004D: jump_if_false ££Label008706
0001: wait  1000& ms
0002: jump ££Label00865

:Label00865
038B: load_requested_models
0001: wait  1000& ms
0002: jump ££Label00866

:Label00866
00A5:  408?? = create_car #PCJ600 at -459.632! 934.121! 10.104!
0175: set_car  408?? z_angle_to  270!
00AE: unknown_set_car  408?? to_ignore_traffic_lights  0?
00AD: set_car  408?? max_speed_to  0!
02AC: set_car  408?? immunities  1?  1?  1?  1?  1?
0129:  36?? = create_actor  4? #VICE3 in_car  408?? driverseat
0002: jump ££Label00867                          

:Label00867
0001: wait  14000& ms
00AD: set_car  408?? max_speed_to  30!
02C2: car 408?? drive_to_point  -448.334! 939.505! 9.624!
0001: wait  5000& ms
0002: jump ££Label00868      

:Label00868
00AD: set_car  408?? max_speed_to  30!
02C2: car 408?? drive_to_point  -430.978! 1340.765! 10.141!
0001: wait  1500& ms
02C2: car 404?? drive_to_point  -459.343! 1338.092! 10.136!
02C2: car 400?? drive_to_point  -445.244! 1339.422! 10.141!
0002: jump ££Label00869

:Label00869
0247: request_model #PCJ600
0247: request_model #VICE4
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE4 available

004D: jump_if_false ££Label008706
0001: wait  1000& ms
0002: jump ££Label00870

:Label00870
038B: load_requested_models
0001: wait  1000& ms
0002: jump ££Label00871

:Label00871
00A5:  412?? = create_car #PCJ600 at -757.976! 1318.754! 10.139!
0175: set_car  412?? z_angle_to  0!
00AE: unknown_set_car  412?? to_ignore_traffic_lights  0?
00AD: set_car  412?? max_speed_to  0!
02AC: set_car  412?? immunities  1?  1?  1?  1?  1?
0129:  40?? = create_actor  4? #VICE4 in_car  412?? driverseat
0002: jump ££Label00872

:Label00872
0001: wait  25000& ms
00AD: set_car  412?? max_speed_to  30!
02C2: car 412?? drive_to_point  -447.721! 1317.101! 9.440!
0001: wait  3000& ms
02C2: car 404?? drive_to_point  -781.834! 1366.931! 10.136!
02C2: car 400?? drive_to_point  -781.229! 1361.648! 10.141!
02C2: car 408?? drive_to_point  -780.703! 1357.062! 10.141!
0001: wait  500& ms
02C2: car 412?? drive to point  -780.203! 1352.705! 10.141!
0002: jump ££Label00873

:Label00873
0247: request_model #PCJ600
0247: request_model #VICE5
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE5 available
0002: jump ££Label00874

:Label00874
038B: load_requested_models
0001: wait  1000& ms
0002: jump ££Label00875

:Label00875
00A5:  416?? = create_car #PCJ600 at -761.869! 1318.161! 10.136!
0175: set_car  416?? z_angle_to  90!
00AE: unknown_set_car  412?? to_ignore_traffic_lights  0?
00AD: set_car  416?? max_speed_to  0!
02AC: set_car  416?? immunities  1?  1?  1?  1?  1?
009A:  44?? = create actor  4? #VICE5 at -753.534! 1343.057! 10.786!
0002: jump ££Label00876

:Label00876
0001: wait  10000& ms
00AD: set_car  400?? max_speed_to  20!
00AD: set_car  404?? max_speed_to  20!
00AD: set_car  408?? max_speed_to  20!
00AD: set_car  412?? max_speed_to  20!
0239: actor 44?? run to  -761.699! 1319.437! 10.784!
0001: wait  5000& ms
01D5: actor  44?? go_to_and_drive_car  416??
0001: wait  1000& ms
00AD: set_car  416?? max_speed_to  20!
02C2: car 416?? drive to point  -779.600! 1347.445! 10.141!
0002: jump ££Label008743



:Label008743
0001: wait 1000& ms
0002: jump ££Label008743



Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 20, 2007, 01:42:45 PM
Quote from: DJS
ok fixed the other problem thanks to VenomX over msn but i have a new problem. One bike dont spawn in the proper position and sometimes it spawned weird :/ and antoeher bike dont move when itsmeant to :/. Take a look see what you can finds wrong
DEFINE VERSION VICE 0.22

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  12?  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 -471.144! 689.531! 9.611!
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  250!

: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 #PCJ600
0247: request_model #PCJ600
0247: request_model #VICE1
0247: request_model #VICE2
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #PCJ600 available
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE1 available
8248:   NOT   model #VICE2 available
                                                     <---------------- why the space?
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 #PCJ600 at -661.025! 624.178! 9.438!
0175: set_car  400?? z_angle_to  000!
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? #VICE2 in_car  400?? driverseat
0350: unknown_actor  28?? not_scared_flag  1?
009A:  32?? = create actor  4? #VICE1 at -560.087! 705.578! 19.534!
00A5:  404?? = create_car #PCJ600 at -523.926! 698.151! 9.930!
0175: set_car  404?? z_angle_to  003!
00AE: unknown_set_car  404?? to_ignore_traffic_lights  0?
00AD: set_car  404?? max_speed_to  0!
02AC: set_car  404?? immunities  1?  1?  1?  1?  1?
00A5:  396?? = create_car #PCJ600 at -471.130! 689.531! 9.611!
0175: set_car  396?? z_angle_to  180!
00AE: unknown_set_car  404?? to_ignore_traffic_lights  0?
00AD: set_car  396?? max_speed_to  0!
02AC: set_car  396?? immunities  1?  1?  1?  1?  1?
0002: jump ££Label008722

:Label008722
0001: wait 2000& ms
00AF: set car  400?? driver behaviour to  1?
02C2: car 400?? drive_to_point -530.410! 686.076! 9.931!
00AD: set_car  400?? max_speed_to  20!
0001: wait  12000& ms
0002: jump ££Label100862 <---------- bad label number, you go from 008722 to 100862?

:label100862
0239: actor 32?? run to  -546.182! 697.452! 19.534!
0001: wait  3000& ms
0239: actor 32?? run to  -526.121! 697.891! 10.090
0001: wait  3000& ms
01D5: actor  32?? go_to_and_drive_car  404??
0002: jump ££Label100863

:Label100863
0001: wait  2000& ms
00AF: set car  404?? driver behaviour to  1?
00AD: set_car  400?? max_speed_to  30!
00AD: set_car  404?? max_speed_to  30!
02C2: car 400?? drive_to_point  -418.192! 947.754! 9.930!
02C2: car 404?? drive_to_point  -417.036! 950.396! 9.930!
0002: jump ££Label00864

:Label00864
0247: request_model #PCJ600
0247: request_model #VICE3
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE3 available
                                                     <--------------- again a space?
004D: jump_if_false ££Label008706
0001: wait  1000& ms
0002: jump ££Label00865

:Label00865
038B: load_requested_models
0001: wait  1000& ms
0002: jump ££Label00866

:Label00866
00A5:  408?? = create_car #PCJ600 at -459.632! 934.121! 10.104!
0175: set_car  408?? z_angle_to  270!
00AE: unknown_set_car  408?? to_ignore_traffic_lights  0?
00AD: set_car  408?? max_speed_to  0!
02AC: set_car  408?? immunities  1?  1?  1?  1?  1?
0129:  36?? = create_actor  4? #VICE3 in_car  408?? driverseat
0002: jump ££Label00867                          

:Label00867
0001: wait  14000& ms
00AD: set_car  408?? max_speed_to  30!
02C2: car 408?? drive_to_point  -448.334! 939.505! 9.624!
0001: wait  5000& ms
0002: jump ££Label00868      

:Label00868
00AD: set_car  408?? max_speed_to  30!
02C2: car 408?? drive_to_point  -430.978! 1340.765! 10.141!
0001: wait  1500& ms
02C2: car 404?? drive_to_point  -459.343! 1338.092! 10.136!
02C2: car 400?? drive_to_point  -445.244! 1339.422! 10.141!
0002: jump ££Label00869

:Label00869
0247: request_model #PCJ600
0247: request_model #VICE4
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE4 available
                                                    <------------ space again?
004D: jump_if_false ££Label008706
0001: wait  1000& ms
0002: jump ££Label00870

:Label00870
038B: load_requested_models
0001: wait  1000& ms
0002: jump ££Label00871

:Label00871
00A5:  412?? = create_car #PCJ600 at -757.976! 1318.754! 10.139!
0175: set_car  412?? z_angle_to  0!
00AE: unknown_set_car  412?? to_ignore_traffic_lights  0?
00AD: set_car  412?? max_speed_to  0!
02AC: set_car  412?? immunities  1?  1?  1?  1?  1?
0129:  40?? = create_actor  4? #VICE4 in_car  412?? driverseat
0002: jump ££Label00872

:Label00872
0001: wait  25000& ms
00AD: set_car  412?? max_speed_to  30!
02C2: car 412?? drive_to_point  -447.721! 1317.101! 9.440!
0001: wait  3000& ms
02C2: car 404?? drive_to_point  -781.834! 1366.931! 10.136!
02C2: car 400?? drive_to_point  -781.229! 1361.648! 10.141!
02C2: car 408?? drive_to_point  -780.703! 1357.062! 10.141!
0001: wait  500& ms
02C2: car 412?? drive to point  -780.203! 1352.705! 10.141!
0002: jump ££Label00873

:Label00873
0247: request_model #PCJ600
0247: request_model #VICE5
00D6: if  0?
8248:   NOT   model #PCJ600 available
8248:   NOT   model #VICE5 available <--------- missing a 004D: jump_if_false ££Label
0002: jump ££Label00874

:Label00874
038B: load_requested_models
0001: wait  1000& ms
0002: jump ££Label00875

:Label00875
00A5:  416?? = create_car #PCJ600 at -761.869! 1318.161! 10.136!
0175: set_car  416?? z_angle_to  90!
00AE: unknown_set_car  412?? to_ignore_traffic_lights  0?
00AD: set_car  416?? max_speed_to  0!
02AC: set_car  416?? immunities  1?  1?  1?  1?  1?
009A:  44?? = create actor  4? #VICE5 at -753.534! 1343.057! 10.786!
0002: jump ££Label00876

:Label00876 <---------------- bad label numbers run all the way down to here
0001: wait  10000& ms
00AD: set_car  400?? max_speed_to  20!
00AD: set_car  404?? max_speed_to  20!
00AD: set_car  408?? max_speed_to  20!
00AD: set_car  412?? max_speed_to  20!
0239: actor 44?? run to  -761.699! 1319.437! 10.784!
0001: wait  5000& ms
01D5: actor  44?? go_to_and_drive_car  416??
0001: wait  1000& ms
00AD: set_car  416?? max_speed_to  20!
02C2: car 416?? drive to point  -779.600! 1347.445! 10.141!
0002: jump ££Label008743



:Label008743
0001: wait 1000& ms
0002: jump ££Label008743



Check your old scm ^ up there. I added in red what I found.
Here's your scm with the obvious errors i found now fixed.
Title: Introduction to SCM coding VC\LC
Post by: Dannye on June 20, 2007, 04:58:30 PM
This has nothing to do with the problems in the code, its just a few helpful hints.

When you create your own threads/labels, you can call them whatever the hell you want, it doesn't need to be "LabelXXXXXetc", you can make it words/letters, it makes the code much easier to read. Then when its compiled the compiler will handle the conversion from words into numbers for ya and you don't have to worry about it.

Also, when you are creating objects, you don't need to give them memory addresses like xxxx??, because again it just makes things harder to read, its much easier just to name them whatever the hell you want, as long as you start it with a "$". Again, the compiler will handle converting it to the next available memory address for ya. Sure, there are a few cases where you might choose to use the memory address method, but with most cases here using words would be easiest.

Here are a couple examples of what I mean:

Type of labels I use, see, just words are fine too, and as you can probably imagine from this, it makes code much easier to work with
00D6: if  0?
80E0:   NOT player $PLAYER_CHAR driving
004D: jump_if_false ££LABEL_CAR

Another example of word labels
00D6: if  21?                                    
80E1:   NOT key_pressed  0?  18?
80E1:   NOT key_pressed  0?  4?
004D: jump_if_false ££LABEL_GHOSTTOWN

You don't need to use xxxx??, you can use a normal word with a dollar sign in front ($Curr_Car). Its handy because if you use it alot in your code (as I obviously do for current car) its easy to remember, and makes the code easier to read
03C1: $Curr_Car = player $PLAYER_CHAR car

A different situation, here I need to store something which I will use in the next line, but never again afterwards, so instead of bothering using a handle like above, I just use a local variable (thats what the x@'s are)
04C4: create_coordinate  1@  2@  3@ from_actor $PLAYER_ACTOR offset -4!  3!  0!
00A5: 4@ = create_car #TAXI at  1@  2@  3@
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 21, 2007, 07:52:24 AM
Dannye just confused me , i think its easier using numbers for some reason. You i see i put the numbers  +4 each time, do i need to do that because i seen neo put something about that in the first post :S. Thanks for fixing the script neo, hope it works

EDIT:   it didnt fix  . did the script work with you neo?

EDIT 2: i got the last guy moving (a lampost blocked him ) but the third guy to spawn still spawns weird [and he my guy also which is kinda bad ]
Title: Introduction to SCM coding VC\LC
Post by: JayFoxRox on June 21, 2007, 08:51:55 AM
Dannye you can also have full text labels. Also the # are predefined symbols

00D6: if 0?
80E0: NOT player $PLAYER_CHAR driving
004D: jump_if_false ££CAR_noticethatthelabeltextisnothere // This labelname might be too long for the compiler

Another example of word labels
00D6: if 21?
80E1: NOT key_pressed 0? 18?
80E1: NOT key_pressed 0? 4?
004D: jump_if_false ££GHOSTTOWN


For the # -> If you enter #PCJ600, the compiler checks what #PCJ600 stands for and dynamicly replaces them with the text found in the files you gave it. This means you haev the following choises too:

#PCJ600

OR

191

OR

0004: $MODELID = 191
and then use $MODELID instead of 191 or #PCJ600 - this is clever when you want to have a dynamic code or when you want to have the ability to change something easily. Sample (Without opcodes ):

$model = #PCJ600 // Enter model id here
:carspawner
if 0
model $model available
jif carspawnermodel
:carspawnerspawn
$car = create_car $model x y z
release model $model
jump carspawnerdone
:carspawnermodel
request model $model
load requested models
:carspawnerdone

//Edit:
Oh and dannye, try getting away from the local vars, they can be tricky in multithreaded scm sometimes.
each thread has 16 local variables (0 to 15). These can only be reached from the own thread and are deleted when the thread is CLOSED - not when you jump out!
You can use them to create functions:

create thread MylabelBlub 191 1 3 3 7

Now the 191 is in @0, 1 in @1, 3 in @2, 3 @3 and 7 in @4
You can create cool stuff with this. For a spawner for example:

:carspawner
if 0
model @0 available
jif carspawnermodel
:carspawnerspawn
$car = create_car @0 @1 @2 @3
set car $car z_angle to @4
set car $car color to @5 @6
release model @0
jump carspawnerdone
:carspawnermodel
request model @0
load requested models
:carspawnerdone
end_thread

and now to spawn a car you use:

create_thread <modelid> <x> <y> <z> <a> <c1> <c2>
 
since gta only looks at the opcode i would rename it to

create_car_with_model #PCJ600 at 100.0 150.0 14.0 with_angle 0.0 and_color 1 1

which would spawn a white PCJ. Now this is usefull to spawn alot of cars with only a few lines:

create_car_with_model #PCJ600 at 100.0 150.0 14.0 with_angle 0.0 and_color 1 1
create_car_with_model #FAGGIO at 110.0 150.0 14.0 with_angle 0.0 and_color 1 1
create_car_with_model #TAXI at 120.0 150.0 14.0 with_angle 0.0 and_color 1 1
create_car_with_model #INFERNUS at 130.0 150.0 14.0 with_angle 0.0 and_color 1 1

Also take note that my thread will load the model if its not loaded so far!
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 21, 2007, 09:42:02 AM
0211: actor 32?? exit car 404??   :S something wrong here it dont work  :/
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 21, 2007, 09:45:23 AM
^ Wrong opcode .

03E2: actor 32?? exit_car

You don't need to say which car they should exit, because there shouldn't be too much of a choice...unless you've done it VERY wrong .
Title: Introduction to SCM coding VC\LC
Post by: JayFoxRox on June 21, 2007, 12:16:58 PM
DJS: you syntax is wrong. the actor handle should be stored in a variable (starting with an $)

Like:

$blub = create_actor
make_actor $blub leave_car

an actor as a number is weird

//Edit: Wrong info.. Sry my bad, the old var namings confused me..
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 21, 2007, 02:10:27 PM
Quote from: DJS
Dannye just confused me , i think its easier using numbers for some reason. You i see i put the numbers  +4 each time, do i need to do that because i seen neo put something about that in the first post :S. Thanks for fixing the script neo, hope it works

EDIT:   it didnt fix  . did the script work with you neo?

EDIT 2: i got the last guy moving (a lampost blocked him ) but the third guy to spawn still spawns weird [and he my guy also which is kinda bad ]

The label numbers can be anything,(though they do have to stay in order or your script will jump all over the place) I just try to jump a few numbers each time I make a new label is all.
I never ran your script because I'm not sure what things your not getting to happen right.
Tell me exactly what your tryin to do with your script and I'll check into it further for you.

Dannye and Fox, you guys are confusin even me with this stuff.   Like DJS said, numbers are just to simple to keep in order so I use those.
Title: Introduction to SCM coding VC\LC
Post by: Dannye on June 21, 2007, 04:35:21 PM
Haha fair enough then. To put it simply I was just saying that you didn't have to use numbers if you didn't want to, but seeing as you guys prefer it, you can ignore all the crap I wrote
Title: Introduction to SCM coding VC\LC
Post by: DJS on June 22, 2007, 08:08:36 AM
Its ok Neo i fixed the problem i think  it works properly if my character is near him when he spawns for some reason . so im basicly dont except camera angles XD. Ill add you neo and venomx to the "thanks to" part at the end of the film. not sure to add dannye XD he just confused me ^^
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 22, 2007, 02:27:25 PM
Quote from: Dannye
Haha fair enough then. To put it simply I was just saying that you didn't have to use numbers if you didn't want to, but seeing as you guys prefer it, you can ignore all the crap I wrote

I'm not sayin it's "crap" man. But if it confused me, imagine how confusing it would be to someone who's just startin to learn. I'm just tryin to keep it as simple as possible for everyone. Any comments or suggestion you have for this tut are always welcome.  
Title: Introduction to SCM coding VC\LC
Post by: deVon on June 26, 2007, 05:42:09 AM
Can anyone tell me what's wrong with this code ?
Because after the explosions, it starts over again.
DEFINE VERSION VICE 0.22

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 12? 0?
04E4: unknown_refresh_game_renderer_at 385.00! 239.00!
03CB: set_camera 385.00! 239.00! 11.43!
0053: $PLAYER_CHAR = create_player #NULL at 385.00! 239.00! 11.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 5?
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 0? (frozen)
01B7: release_weather

:Label008700
0001: wait 0& ms
0247: request_model #FREEWAY
0247: request_model #PCJ600
0247: request_model #UZI
0247: request_model #BFYBE
0247: request_model #TEC9
0247: request_model #BKA
0247: request_model #CHEETAH
0247: request_model #ARMY
00D6: if 0?
8248: NOT model #FREEWAY available
8248: NOT model #PCJ600 available
8248: NOT model #UZI available
8248: NOT model #BFYBE available
8248: NOT model #TEC9 available
8248: NOT model #BKA available
8248: NOT model #CHEETAH available
8248: NOT model #ARMY available
004D: jump_if_false ££Label008706
0001: wait 1000& ms
0002: jump ££Label008700

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

:Label008711
0001: wait 0& ms
00A5: 400?? = create_car #PCJ600 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? #BFYBE 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 0& ms
00A5: 404?? = create_car #FREEWAY 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 ££Label008745

:Label008745
0001: wait 0& ms
00A5: 4000?? = create_car #CHEETAH at 360.00! 239.30! 11.37!
0175: set_car 4000?? z_angle_to 90!
00AE: unknown_set_car 4000?? to_ignore_traffic_lights 1?
00AD: set_car 4000?? max_speed_to 0!
02AC: set_car 4000?? immunities 1? 1? 1? 1? 1?
0129: 9172?? = create_actor 4? #ARMY in_car 4000?? driverseat
01B2: give_actor 9172?? weapon 23? ammo 100&
02E2: set_actor 9172?? weapon_accuracy_to 99?
0350: unknown_actor 9172?? not_scared_flag 1?
0002: jump ££Label008722

:Label008722
0001: wait 2000& ms
0158: camera_on_vehicle 400?? 3? 2?
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!
0001: wait 1000& ms
02C2: car 4000?? drive_to_point 360.00! 240.00! 11.00!
00AD: set_car 4000?? max_speed_to 10!
0002: jump ££Label008729

:Label008729
0001: wait 7000& ms
015F: set_camera_position 372.51! 244.48! 10.82! 0! 0! 0!
0160: point_camera 372.51! 238.48! 10.82! 1?
0460: set_camera_pointing_time 0! 5000&
0001: wait 5000& ms
03E2: actor 28?? exit_car
03E2: actor 32?? exit_car
03E2: actor 9172?? exit_car
0001: wait 3500& ms
0211: actor 28?? walk_to 368.27! 242.45!
0211: actor 32?? walk_to 385.78! 236.38!
015F: set_camera_position 372.51! 244.48! 10.82! 0! 0! 0!
0160: point_camera 385.78! 236.38! 10.82! 1?
0460: set_camera_pointing_time 0! 5000&
0001: wait 8000& ms
020E: actor 28?? look_at_actor 32??
020E: actor 32?? look_at_actor 28??
020E: actor 9172?? look_at_actor 28??
015F: set_camera_position 370.27! 241.45! 11.32! 0! 0! 0!
0160: point_camera 368.27! 242.45! 11.32! 2?
0460: set_camera_pointing_time 0! 2000&
0001: wait 2000& ms
015F: set_camera_position 384.08! 237.38! 10.82! 0! 0! 0!
0160: point_camera 385.78! 236.38! 10.82! 2?
0460: set_camera_pointing_time 0! 2000&
0001: wait 2000& ms
0002: jump ££Label008733

:Label008733
015F: set_camera_position 382.60! 252.15! 14.43! 0! 0! 0!
0160: point_camera 378.80! 243.15! 10.82! 2?
0460: set_camera_pointing_time 0! 5000&
0001: wait 4000& ms
01C9: actor 28?? kill_actor 32??
01C9: actor 9172?? kill_actor 28??
0002: jump ££Label008738

:Label008738
0001: wait 5000& ms
0159: camera_on_ped 9172?? 4? 2?
0001: wait 4000& ms
015F: set_camera_position 385.43! 237.43! 10.82! 0! 0! 0!
0160: point_camera 382.93! 237.43! 10.82! 2?
0460: set_camera_pointing_time 0! 5000&
0001: wait 4000& ms
015F: set_camera_position 385.43! 237.43! 10.82! 0! 0! 0!
0160: point_camera 382.93! 237.43! 9.82! 1?
0460: set_camera_pointing_time 0! 500&
0001: wait 2000& ms
0239: actor 9172?? run_to 372.51! 238.48!
0001: wait 1000& ms
01D5: actor 9172?? go_to_and_drive_car 400??
00AD: set_car 400?? max_speed_to 0!
0158: camera_on_vehicle 400?? 3? 2?
0001: wait 4500& ms
02C2: car 400?? drive_to_point 323.93! 240.77! 11.45!
00AD: set_car 400?? max_speed_to 30!
0001: wait 2000& ms
03E2: actor 9172?? exit_car
0159: camera_on_ped  9172??  4?  2?
0239: actor 9172?? run_to 375.00! 239.00!
0001: wait 1000& ms
020F: actor 9172?? look_at_player $PLAYER_CHAR
0002: jump ££Label008743

:Label008743
0001: wait 1000& ms
020B: explode_car 400??
020B: explode_car 404??
020B: explode_car 4000??
0321: kill_actor 9172??
0002: jump ££Label008744

:Label008744
0157: camera_on_player $PLAYER_CHAR  4?  2?
01B4: set_player $PLAYER_CHAR frozen_state 1? (unfrozen)
0002: jump ££Label008745

:Label008745
0001: wait 1000& ms
0002: jump ££Label008745
Title: Introduction to SCM coding VC\LC
Post by: VenomX on June 26, 2007, 05:55:50 AM
You have two different versions of Label008745 .  Change the last four lines to:

0002: jump ££Label008746

:Label008746
0001: wait 1000& ms
0002: jump ££Label008746

Then it should work.
Title: Introduction to SCM coding VC\LC
Post by: bogeymaster on June 28, 2007, 07:02:20 AM
How to make an actor dance? I couldn't find it in opcodes. Can anyone help please?    
Title: Introduction to SCM coding VC\LC
Post by: Cody on June 30, 2007, 03:11:52 AM
Can somebody PLEASE tell me why I keep getting this gay ass error? >=\

(http://img141.imageshack.us/img141/8367/faggotej9.jpg)
It happens every time I try to compile a SCM.. Is there something i'm screwing up? =/
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 30, 2007, 04:00:59 AM
2 things come to mind right away, is the SCM checked as "read only" or if your using a different version of Mission builder than the SCM is. Say 1.5 and your tryin to compile a script thats version 0.22?
Title: Introduction to SCM coding VC\LC
Post by: Cody on June 30, 2007, 05:32:00 AM
Quote from: Neo Anderson
2 things come to mind right away, is the SCM checked as "read only" or if your using a different version of Mission builder than the SCM is. Say 1.5 and your tryin to compile a script thats version 0.22?
Nope, not read only. I turned off read only a long time ago, plus I checked when I first got this error.

And i'm using ViceBuilder 0.22.
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 30, 2007, 12:48:23 PM
There's a chance, for whatever reason, the MAIN.SCM is corrupt somehow. I've tried altering mine several ways to get the error but I can't seem to get it to do that. Could you send me the MAIN.SCM and I'll see if I can complie it on mine?
Title: Introduction to SCM coding VC\LC
Post by: Cody on June 30, 2007, 01:21:54 PM
Quote from: Neo Anderson
There's a chance, for whatever reason, the MAIN.SCM is corrupt somehow. I've tried altering mine several ways to get the error but I can't seem to get it to do that. Could you send me the MAIN.SCM and I'll see if I can complie it on mine?
No. lol. I deleted it. It was basicly yours only edited.
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on July 04, 2007, 03:10:58 AM
As much as I hate to say it, GTAForums may have more info on Mission Builder but I so hate tryin to get ANY help from those tards. Maybe Fox or Dannye may know why this is happening to you.
Title: Introduction to SCM coding VC\LC
Post by: JayFoxRox on July 04, 2007, 06:21:06 AM
1. try launching vsettings.exe in your mission builder dir. (Re-set the directory)
2. keep the main source code on the same partition as the compiled code (if you want to compile to drive C: you should have your source on C: too)
3. You should have an gta-vc.exe
4. Make sure you have read-only off (Re-check)
5. Try renaming your current scm and try compiling again
6. Try normal "Compile"
7. Try "Compile & Copy"

After all that steps tell me / us what happened. If you cant get it to work talk to me on msn. I m able to recreate this problem but i can simply fix by various things i kinda described in the above steps.
Title: Introduction to SCM coding VC\LC
Post by: Psycho on September 05, 2007, 06:40:58 AM
Do you have a command list or something that lists all the possible commands you can give? That would be extremely helpful, but I'm guessing if one isn't already made, a lot of work too.

I'm trying to make an intro that involves driving on curvy roads. Is there a way to make the cars follow the path of the road, or do i need to constantly give a command to drive a little to the left every time?
Title: Introduction to SCM coding VC\LC
Post by: VenomX on September 05, 2007, 07:55:08 AM
They usually automatically follow the roads if you tell them to drive from point A to B.  At least, I had that problem when I tried to make them drive in a straight line .

Use this for opcodes: http://vc-db.webtools4you.net/?show=all (http://vc-db.webtools4you.net/?show=all)

Then after you've found the command you want to use, copy > find > paste the opcode followed by a : into Dannye's decompiled main.scm, then follow the format used there.  Its fairly easy once you've actually found the opcode you need to use .
Title: Introduction to SCM coding VC\LC
Post by: Dannye on September 05, 2007, 03:37:05 PM
Other sources worth checking:

* The opcodes discussion threads over at GTAF (both SA and VC).
* Your VICESCM.ini/SASCM.ini (may actually be more helpful that the opcodes db website [it isnt updated much anymore], but you'd need to make sure you have the most recent version).
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on September 05, 2007, 05:14:49 PM
Curvey roads,    I think I know what your talkin about and would be something to do with "paths". I know when ya ask for a vehicle to drive to a given point it will follow a straight line there so you'd need a path editor I'm guessing. I for one know nothing about altering those.
Title: Introduction to SCM coding VC\LC
Post by: Psycho on September 06, 2007, 06:23:37 AM
and if I want to request/create a Sabre Turbo or a Zebra Cab in LC, would I have to switch other files besides the dff's and txd's?

Edit: is there a version of spoosh compatible with LC?
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on September 06, 2007, 04:29:46 PM
Nope

Are you kiddin'?  spoosh works fine in LC, it's just a map mod for VC really ya know.
Title: Introduction to SCM coding VC\LC
Post by: Psycho on September 06, 2007, 05:16:05 PM
I copied my spoosh.exe from the VC folder over to the LC folder, and opened it, and it had the LC screens but the VC savegames (they didn't load) and then I tried opening the gta-vc in the LC folder and the same thing happened, so now I have to use the LC launcher instead, and also I can't use spoosh.

is there a stripped scm for LC?
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on January 21, 2008, 05:09:06 AM
That site is called VC webtools. The page I linked to are known opcodes for the game used in coding. There's nothing to download. It's just a referance to the codes and what they're for. Your more than welcome to post questions here on anything to do with SCM coding for VC and I'll try to answer them.
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on March 24, 2008, 03:36:36 PM
First off model #FSFA would be concidered a "special" actor so you have 2 choices. Either request the special actor to load.........

:Label008723
023C: load_special_actor  16? "FSFA"
00D6: if  0?
823D:   NOT   special_actor  16? loaded
004D: jump_if_false ££Label008755
0001: wait  1000& ms
038B: load_requested_models
0002: jump ££Label008723

or you can grab FSFA's TXD and DFF and rename them both to say, BKA.txd and BKA.dff, then replace them in your IMG file. Then you could request model BKA and get the model you want.

I also noticed in your first block of code.......

:army1
0247: request_model #FSFA
00D6: if  0?
8248:   NOT   model #FSFA available
004D: jump_if_false ££army2
0001: wait  0& ms
0002: jump ££army2

The line in red should be.....

0002: jump ££army1

Don't use the.........

0249: release_model #FSFA

anymore. It caused so many problems when i first started. Instead use the....

038B: load_requested_models

Like I did in the first block of code I wrote. It's so much easier and a hell of lot less buggy about crashing.

0053: $PLAYER_CHAR = create_player #NULL at  -1108.57! -710.57!  11.33!

This line appears at the beginning of every script. It pretains to YOU in game and probably will only work in conjunction with the other lines of code that are written around it. Here is the block of code I'm speaking of. The line your tryin to use by itself is in red......

: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  23?  0?
04E4: unknown_refresh_game_renderer_at  -1108.57! -710.57!
03CB: set_camera  -1108.57! -710.57!  11.33!
0053: $PLAYER_CHAR = create_player #NULL at  -1108.57! -710.57!  11.33!
0171: set_player $PLAYER_CHAR z_angle_to  180!
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 ££Label0086F6
0352: set_actor $PLAYER_ACTOR skin_to "PLAYER"
038B: load_requested_models
0353: refresh_actor $PLAYER_ACTOR
0222: set_player  2228?? health_to  100!
Title: Introduction to SCM coding VC\LC
Post by: VenomX on March 25, 2008, 11:11:29 AM
Try putting black inside the brackets.
Title: Introduction to SCM coding VC\LC
Post by: VenomX on March 25, 2008, 12:40:51 PM
016A: fade  0? ()  1000& ms

I think you need to specify a time.
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on March 25, 2008, 01:13:30 PM
016A: fade 0? 1000& ms
Title: Introduction to SCM coding VC\LC
Post by: вαℓυ on June 14, 2008, 07:13:18 AM
I press F7 and i get this after that it deletes the MAIN.SCM, is that normal lol?
(http://i248.photobucket.com/albums/gg173/Killerstunter/error.jpg)
Title: Introduction to SCM coding VC\LC
Post by: Neo Anderson on June 14, 2008, 10:49:12 AM
Quote from: Killerstunter
I press F7 and i get this after that it deletes the MAIN.SCM, is that normal lol?
(http://i248.photobucket.com/albums/gg173/Killerstunter/error.jpg)
Nope, attach your scm and I'll take a looksie
Title: Introduction to SCM coding VC\LC
Post by: вαℓυ on June 14, 2008, 02:09:44 PM
Ok here's the MAIN.SCM.
Clicky (http://www.sendspace.com/file/kgqcn3)
Title: Introduction to SCM coding VC\LC
Post by: Dannye on June 15, 2008, 06:01:12 AM
They should be pound signs ('££'), not question marks ('??'), no?
Title: Introduction to SCM coding VC\LC
Post by: вαℓυ on June 15, 2008, 06:09:15 AM
Quote from: Dannye
They should be pound signs ('££'), not question marks ('??'), no?
I thought that too, somehow pound signs don't show up for me.
Title: Introduction to SCM coding VC\LC
Post by: Dannye on June 15, 2008, 05:29:12 PM
Can you copy and paste them from another part of the scm?
(One of the jump opcodes from the original code, for example)
Title: Introduction to SCM coding VC\LC
Post by: вαℓυ on June 15, 2008, 11:23:35 PM
I'm very new to this lol, i went through the tutorial and did everything how it was written, i just pressed F7 and got this error, i didn't add anything or something. Just did like the tutorial said.
Quote
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.
Is that supposed to happen? Oh and sorry Dannye, i don't understand what you're saying.
Title: Introduction to SCM coding VC\LC
Post by: morbidxxx on September 28, 2008, 04:25:06 AM
What do I need to change so this would work in LC?
Title: Re: Introduction to SCM coding VC\LC
Post by: FloW on September 06, 2010, 08:58:41 AM
I have the same problem as KS, when i try to copy "££" into this program, it changes in "??", any ideas why?
Title: Re: Introduction to SCM coding VC\LC
Post by: Lexi on November 05, 2014, 02:44:17 AM
How to use it? :)
Title: Re: Introduction to SCM coding VC\LC
Post by: GodRa6420 on May 15, 2015, 03:52:09 AM
I am not good at English so I learn it so hard!
can't understand at all
SimplePortal 2.3.7 © 2008-2024, SimplePortal