Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

YeTi's Coding Tutorial Part Two


YeTi
 Share

Recommended Posts

YeTi's VC Coding Tutorial Part Two

 

Introduction

 

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

 

Aim

 

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

 

Backup

 

I 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".

 

Weapons

 

Note 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:

 

 

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:

 

 

032B:

 

 

Is the opcode.

 

 

$7D0

 

 

Is the name that rockstar has given to that line of code.

 

 

= create_weapon_pickup

 

 

this is what the code does it is creating weapon pickup.

 

 

#COLT45

 

 

this is what weapon pickup the code is creating it is creating a colt45 weapon pickup.

 

 

15

 

 

this is just if the code makes the pickup free or not I THINK that 15 is free and 1 is not free so:

 

 

15

 

 

 

should be a free pickup and

 

 

1

 

 

 

should be a buyable pickup.

 

 

ammo  34

 

 

Is how much ammo the weapon has. This weapon has got 34 ammo.

 

 

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.

 

 

$7D0

 

 

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

 

 

$myweapon1

 

 

ok you need to leave the $ sign in front of the name.

 

so now our code should look like this

 

 

032B: $myweapon1 = create_weapon_pickup #COLT45  15 ammo  34 at -228.4 -1318.2  9.1

 

 

You need to leave

 

 

create_weapon_pickup

 

 

but this bit we will change we don't want a colt 45 we want a m4.

 

 

#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

 

 

032B: $myweapon1 = create_weapon_pickup #m4  15 ammo  34 at -228.4 -1318.2  9.1

 

 

This bit we will leave the same

 

 

15

 

 

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

 

 

ammo  34

 

 

we dont want 34 ammo with our weapon we want 500 ammo with our weapon so we will type

 

 

ammo 500

 

 

so our new code should so far look like this

 

 

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

 

 

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

 

user posted image

 

Now the coordinates that Steve-m's player position gives me is 214.793, -1275.360, 11.112. So my code would be

 

 

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.

 

user posted image

 

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.

 

user posted image

 

Which as you can see works.

 

Cars

 

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

 

 

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.2032014C: 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:

 

 

014B:

 

 

014C:

 

 

These are both opcodes they are both needed.

 

 

$7C8

 

 

this is basically just a name that rockstar has given to that line of code.

 

 

init_parked_car_generator

 

 

This tells the game to start the car generator.

 

 

set_parked_car_generator

 

 

This tells the game to generate the car and close the car generator

 

 

#ADMIRAL

 

 

This tells the game which car to generate.

 

 

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.

 

 

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.

 

 

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

 

 

$7C8

 

 

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

 

 

$mycar

 

 

ok you need to leave the $ sign in front of the name.

 

so now our code should look like this

 

 

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.2032014C: 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

 

 

init_parked_car_generator

 

 

But this bit we will change

 

 

#ADMIRAL

 

 

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

 

 

#INFERNUS

 

 

so now our code should look like this

 

 

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.2032014C: set_parked_car_generator $mycar cars_to_generate_to  101

 

 

 

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.

 

 

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.

 

user posted image

 

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:

 

 

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 0014C: set_parked_car_generator $mycar cars_to_generate_to  101

 

 

We will leave all of this line.

 

 

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.

 

 

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 0014C: set_parked_car_generator $mycar cars_to_generate_to  101

 

 

Which as you can see works.

 

user posted image

 

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 One

 

Since writing this i have wrote another two tutorials on SA Coding. Here is a link to them.

 

YeTi's SA Coding Tutorial Part One

 

 

YeTi's SA Coding Tutorial Part Two

 

YeTi

Edited by Suction Testicle Man

user posted image
user posted image
R.I.P. Chi Shingi Meiyo

 

21/09/2005 - 07/03/2007

Andolini Mafia Family

 

16/08/2008 - Current

Link to comment
Share on other sites

Thanks man. I love credit.

user posted image
user posted image
R.I.P. Chi Shingi Meiyo

 

21/09/2005 - 07/03/2007

Andolini Mafia Family

 

16/08/2008 - Current

Link to comment
Share on other sites

  • 4 weeks later...

Nice for Newbs, although here is an error in it:

 

I have chosen a position for my bribe I will place it here

What bribe? Oh, that one from part 1 of th tut? tounge.gif

Link to comment
Share on other sites

Nice for Newbs, although here is an error in it:

 

I have chosen a position for my bribe I will place it here

What bribe? Oh, that one from part 1 of th tut? tounge.gif

I'll admit i did basically copy my first tut for a outline on this but after reading through it i cannot find that particular quote. Can you point out approxamatly were it is.

user posted image
user posted image
R.I.P. Chi Shingi Meiyo

 

21/09/2005 - 07/03/2007

Andolini Mafia Family

 

16/08/2008 - Current

Link to comment
Share on other sites

  • 4 weeks later...

Dude, you have no idea how much that helped me, I shall recomend you for a karma star.

Link to comment
Share on other sites

I hadn't thought about it to be honest. Sure i'll start writing it later. I'll aim to release it on the weekend.

user posted image
user posted image
R.I.P. Chi Shingi Meiyo

 

21/09/2005 - 07/03/2007

Andolini Mafia Family

 

16/08/2008 - Current

Link to comment
Share on other sites

Thank you because I am a newb at modding and coding and I want to learn. Also is there a player position thing for GTA3 and SA?
Link to comment
Share on other sites

Thank you because I am a newb at modding and coding and I want to learn. Also is there a player position thing for GTA3 and SA?

There is for GTA3 check Steve-M.com then go to downloads i think.

 

I don't think one has been made for sa yet.

user posted image
user posted image
R.I.P. Chi Shingi Meiyo

 

21/09/2005 - 07/03/2007

Andolini Mafia Family

 

16/08/2008 - Current

Link to comment
Share on other sites

  • 2 weeks later...

Yeti, i would really love to see a tutorial for SA.

I want to know how to add items, weapons and so on in certian locations.

Link to comment
Share on other sites

  • 1 month later...

edit: I was wrong. But the Archive has this linked as the SA tut.

Link to comment
Share on other sites

 

edit: I was wrong.  But the Archive has this linked as the SA tut.

Yeah your right.

 

Anyway i've PM'd STM about it hopefully he'll fix it for me.

 

EDIT: STM has fixed it.

Edited by YeTi

user posted image
user posted image
R.I.P. Chi Shingi Meiyo

 

21/09/2005 - 07/03/2007

Andolini Mafia Family

 

16/08/2008 - Current

Link to comment
Share on other sites

  • 2 years later...
smallcombe

nice tut helped me alot thnx... colgate.gif

Edited by smallcombe
Link to comment
Share on other sites

  • 8 months later...
  • 8 months later...
  • 8 months later...
  • 5 months later...
  • 1 year later...
  • 6 years later...
On 9/23/2019 at 5:24 PM, parvez said:

please make a tutorial on 

"place an actor at a place and put him in the car of player_actor"

please

{$CLEO .cs}
:PutActorinPlayercar
thread 'A2PLAYC'

while true
    wait 0
    if
        0256: player $PLAYER_CHAR defined
    then
        if  and
            00DF:   actor $PLAYER_ACTOR driving
            0AB0:   key_pressed 8//-----------------------press Backspace
        then
            03C0: 0@ = actor $PLAYER_ACTOR car
            0376: 1@ = create_random_actor_at 0.0 0.0 100.0
            036A: put_actor 1@ in_car 0@
            wait 2000
            01C2: remove_references_to_actor 0@
        end
    end
end

 

Link to comment
Share on other sites

17 hours ago, ZAZ said:
{$CLEO .cs}
:PutActorinPlayercar
thread 'A2PLAYC'

while true
    wait 0
    if
        0256: player $PLAYER_CHAR defined
    then
        if  and
            00DF:   actor $PLAYER_ACTOR driving
            0AB0:   key_pressed 8//-----------------------press Backspace
        then
            03C0: 0@ = actor $PLAYER_ACTOR car
            0376: 1@ = create_random_actor_at 0.0 0.0 100.0
            036A: put_actor 1@ in_car 0@
            wait 2000
            01C2: remove_references_to_actor 0@
        end
    end
end

 

thanks bro

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.