YeTi's VC Coding Tutorial Part TwoIntroductionRight so before i start this tutorail will be picking up were i left off in part one so i'd advise you to read that first.
AimWhat i aim to teach you in this tutorial is:
How to place weapons.
How to place vehicles.
How to understand the codes for each of these.
BackupI cannot stress enough how important it is to backup your files. Just remember what i said in part 1 "copy it and paste it into a folder in my documents call this folder what ever you want just remember were it is".
WeaponsNote melee weapons follow a different code i will not be explaining this.
First I will explain the code.
Open up BW's Vice City Mission Builder.
Then click file, open file and then just look for your main.scm NOT the one that you copied to a different location but the one that is in the vice city install folder.
Wait for it to open it does take a while so don't worry if it looks as if its screwing up its not. It will then give you a report just click ok. Now click edit/find and type in colt. It should just highlight the word colt and scroll down a bit, this is not the one that you want so press F3 twice. It should now scroll down the screen and highlight the word colt in a different line:
| CODE |
| 032B: $7D0 = create_weapon_pickup #COLT45 15 ammo 34 at -228.4 -1318.2 9.1 |
This line its a weapon pick up code. Right so now I will explain each of the bits of this code bear in mind that i explained all of the bits of a basic code in detail in part 1:
Is the opcode.
Is the name that rockstar has given to that line of code.
| CODE |
| = create_weapon_pickup |
this is what the code does it is creating weapon pickup.
this is what weapon pickup the code is creating it is creating a colt45 weapon pickup.
this is just if the code makes the pickup free or not
I THINK that 15 is free and 1 is not free so:
should be a free pickup and
should be a buyable pickup.
Is how much ammo the weapon has. This weapon has got 34 ammo.
| CODE |
| at -228.4 -1318.2 9.1 |
-228.4 is the x position in the game
-1318.2 is the y position in the game
9.1 is the z position in the game
Right so that is all of that code explained I hope you understood it?
Now lets put our own weapon pickup in the game ok?
Copy all of the code line and then just add a new line underneath the original code (you can do this by pressing enter but make sure that none of the code is highlighted), then paste your copied code into your newly created space. It should just fill in the line and not add another but it sometimes does if it does just go to the end of your added line and press delete.
Right so now lets edit our code.
You need to leave the opcode as it is because as I said before its unique to pickups and is needed in the game.
this bit we will change as I said before it is the name that rockstar has given to this line of code so lets give our new line of code its own name. Lets call it
ok you need to leave the $ sign in front of the name.
so now our code should look like this
| CODE |
| 032B: $myweapon1 = create_weapon_pickup #COLT45 15 ammo 34 at -228.4 -1318.2 9.1 |
You need to leave
| CODE |
| create_weapon_pickup |
but this bit we will change we don't want a colt 45 we want a m4.
There should be a full list of weapon names in your version of BW's mission builder.
so our new code should now look like this
| CODE |
| 032B: $myweapon1 = create_weapon_pickup #m4 15 ammo 34 at -228.4 -1318.2 9.1 |
This bit we will leave the same
because if you remember this tells the game to give us a free weapon and we don't want to pay for it.
this bit we will alter
we dont want 34 ammo with our weapon we want 500 ammo with our weapon so we will type
so our new code should so far look like this
| CODE |
| 032B: $myweapon1 = create_weapon_pickup #m4 15 ammo 500 at -228.4 -1318.2 9.1 |
now the final bit we will alter is this
| CODE |
| at -228.4 -1318.2 9.1 |
if you remember this is the position in the game so because we are adding our own weapon pickup we don't want it in the same place as the proper one do we?
No of course not so this is where steve-m's player position comes in handy. Just minimize everything and open up Steve-m's player position and play vice city. I have chosen a position for my bribe I will place it here

Now the coordinates that Steve-m's player position gives me is 214.793, -1275.360, 11.112. So my code would be
| CODE |
| 032B: $myweapon1 = create_weapon_pickup #m4 15 ammo 500 at 214.793 -1275.360 11.112 |
Now your own added code should look like mine if you used my coordinates if not then the same but with different coordinates.
Now go to Run-Compile Copy&Run GTA Vice. It will take a while but be patient it will give you some sort of error message I cant remember it exactly but its something to do with something not matching and you have to change some thing just change it so that all of the something's must match.
Remember to start a new game. You have to start a new game after every bit of editing in the main.scm file.
As you can see is wrong but if you remember we had the same problem in part one. And if you remember we solved the problem by raising the z position up by 0.5.

But as you can see it doesn't work in this case so we will try raising our position by another 0.5 on the z position.

Which as you can see works.
CarsFirst I will explain each bit of the code.
Open up BW's Vice City Mission Builder.
Then click file, open file and then just look for your main.scm NOT the one that you copied to a different location but the one that is in the vice city install folder.
Wait for it to open it does take a while so don't worry if it looks as if its screwing up its not. It will then give you a report just click ok. Now click edit/find and type in admiral. It should just highlight the word admiral scrolling down a bit this is the one that you want.
| CODE |
014B: $7C8 = init_parked_car_generator #ADMIRAL 8 8 0 alarm 50 door_lock 0 0 10000 at -401.2715 -534.6655 11.7534 angle 149.2032 014C: set_parked_car_generator $7C8 cars_to_generate_to 101 |
this line its a vehicle spawn code. Right so now I will explain each of the bits of this code:
These are both opcodes they are both needed.
this is basically just a name that rockstar has given to that line of code.
| CODE |
| init_parked_car_generator |
This tells the game to start the car generator.
| CODE |
| set_parked_car_generator |
This tells the game to generate the car and close the car generator
This tells the game which car to generate.
| CODE |
| 8 8 0 alarm 50 door_lock 0 0 10000 |
So now this bit is a little more complicated.
the 8 8 bit is the colour of the car.
im not sure what the 0 is.
alarm 50 is the chance in percentage how likely the alarm is to go off, in this case its a 50% chance it will go off and a 50% chance it will not go off.
door_lock 0 is the chance in percentage how likely the door is to be locked, in this case its a 0% chance it will will be locked.
im not sure what the 0 is.
10000 is the cars health NEVER PLAY ABOUT WITH THIS BECAUSE I DON'T THINK ANYBODY UNDERSTANDS HOW TO MAKE IT WORK.
| CODE |
| at -401.2715 -534.6655 11.7534 angle 149.2032 |
Is the position with an angle bit this time. The angle bit just tells the car which angle to face 0 is north, 180 is south etc.
| CODE |
| $7C8 cars_to_generate_to 101 |
$7C8 is the car you are telling it to generate
cars_to_generate_to 101 tells the game how often to spawn a car there. 101 is always and 0 is never.
Right so i think thats all the code explained.
Lets make our own now.
Copy all of the code line and then just add a new line underneath the original code (you can do this by pressing enter but make sure that none of the code is highlighted), then paste your copied code into your newly created space. It should just fill in the line and not add another but it sometimes does if it does just go to the end of your added line and press delete.
Right so now lets edit our code.
You need to leave the opcodes as it is because as I said before its unique to that particular process and is needed in the game.
this bit we will change as I said before it is the name that rockstar has given to this line of code so lets give our new line of code its own name. Lets call it
ok you need to leave the $ sign in front of the name.
so now our code should look like this
| CODE |
014B: $mycar = init_parked_car_generator #ADMIRAL 8 8 0 alarm 50 door_lock 0 0 10000 at -401.2715 -534.6655 11.7534 angle 149.2032 014C: set_parked_car_generator $mycar cars_to_generate_to 101 |
Remember you have to change the name everywere in the code.
You need to leave
| CODE |
| init_parked_car_generator |
But this bit we will change
If we are making our own code we dont want a crap admiral we want a cool vehicle like the infernus so we will change this to
so now our code should look like this
| CODE |
014B: $mycar = init_parked_car_generator #INFERNUS 8 8 0 alarm 50 door_lock 0 0 10000 at -401.2715 -534.6655 11.7534 angle 149.2032 014C: set_parked_car_generator $mycar cars_to_generate_to 101 |
| CODE |
| 8 8 0 alarm 50 door_lock 0 0 10000 |
Some of this we will change.
8 8 we will leave the same as this is the colour.
0 alarm 50 we will change this to 0 alarm 0 this will deactivate the alarm so it will never go off.
door lock 0 0 we will leave as it is because it means that the door will never be locked.
10000 remember what i said you always leave this.
| CODE |
| at -401.2715 -534.6655 11.7534 angle 149.2032 |
if you remember this is the position in the game so because we are adding our own car we don't want it in the same place as the proper one do we?
No of course not so this is where steve-m's player position comes in handy. Just minimize everything and open up Steve-m's player position and play vice city. I have chosen a position for my car I will place it at the top of ocean beach mall near the shotgun.
Now the coordinates that Steve-m's player position gives me is 58.481, -939.647, 23.150 I will use angle 0. So my code so far would be:
| CODE |
014B: $mycar = init_parked_car_generator #INFERNUS 8 8 0 alarm 50 door_lock 0 0 10000 at 58.481 -939.647 23.150 angle 0 014C: set_parked_car_generator $mycar cars_to_generate_to 101 |
We will leave all of this line.
| CODE |
| 014C: set_parked_car_generator $mycar cars_to_generate_to 101 |
Now your own added code should look like mine if you used my coordinates if not then the same but with different coordinates.
Now go to Run-Compile Copy&Run GTA Vice. It will take a while but be patient it will give you some sort of error message I cant remember it exactly but its something to do with something not matching and you have to change some thing just change it so that all of the something's must match.
Remember to start a new game. You have to start a new game after every bit of editing in the main.scm file.
| CODE |
014B: $mycar = init_parked_car_generator #INFERNUS 8 8 0 alarm 50 door_lock 0 0 10000 at 58.481 -939.647 23.150 angle 0 014C: set_parked_car_generator $mycar cars_to_generate_to 101 |
Which as you can see works.
That's it for this tutorial I have covered what I said I would I may write more later if I get bored.
Please don't flame me for this I know some bits are crap and there is likely spelling mistakes I have admitted that so please no flaming.
I have also done another VC Coding tutorial. Heres a link.
YeTi's VC Coding Tutorial Part OneSince writing this i have wrote another two tutorials on SA Coding. Here is a link to them.
YeTi's SA Coding Tutorial Part OneYeTi's SA Coding Tutorial Part TwoYeTi
This post has been edited by Suction Testicle Man on Sep 13 2005, 12:38