Jump to content

[tutorial] YeTi's SA Coding Tutorial Part One


Oskar

Recommended Posts

Again, I am only representing. ALL CREDITS GO TO YeTi!

YeTi's n00b San Andreas Coding Tutorial

I have decided to write a coding tutorial for San Andreas mainly because there aren’t many out there and the ones that are out there don’t explain the code very well. I hope to clear that up in this tutorial. I would just like to point out I have mainly edited my original Vice City coding tutorial so some buts of it might not make sense if you can just point them out I will correct the mistake.

The Tools.

Just click the tool name to download.

I've uploaded BW's San Andreas Mission Builder 0.33 and San Andreas Place Manager onto my site because in this tutorial I will be using the versions on my site and it will be easier to understand using these versions.

Barton Waterduck's San Andreas Mission Builder 0.33.

San Andreas Place Manager.

San Andreas (1.0)

Notepad ( is sometimes handy.)

Aim.

What I aim to teach you in this tutorial is how to:

Place Pickups (bribes, health etc.)

How To Understand How The Basic Code.

Step 1, backup.

Right now you have downloaded all of the required tools I strongly recommend that you back up a couple of files. The files I suggest you back up are:

main.scm

script.img

default.ide

peds.ide

vehicles.ide

If you used the default San Andreas install directory it will be:

C:\Program Files\Rockstar Games\Grand Theft Auto San Andreas\data

Now default.ide peds.ide vehicles.ide can all be found in here by scrolling down the page.

But main.scm and script.img will be in a separate folder in the data directory called “script”.

C:\Program Files\Rockstar Games\Grand Theft Auto San Andreas\data\script

if you have installed San Andreas somewhere different just follow the directory’s from Grand Theft Auto San Andreas.

Create a folder in My Documents called “Original San Andreas Files”. Now copy all of the listed files into there. Now remember where that is because if you f*ck a file up you will be glad you have made the backup it will save you from having to reinstall the game.

Step 2,Configuring San Andreas Mission Builder 0.33

Before we can use San Andreas Mission Builder 0.33 we need to configure it a bit and set it up ready for use.

Firstly download San Andreas Mission Builder 0.33 then unzip it into My Documents. I suggest renaming it to San Andreas Mission Builder 0.33 but it is not required it just makes things easier to understand.

Now you have unzipped it the first thing we will do is configure a file called SASCM.INI It will be in the newly unzipped folder. Open it with notepad. To do this right click it then select Open With then in the window that pops up select notepad. Now scroll right down to the bottom of the file and press enter to start a new line. Now copy and paste this into the new line:

0A4A=2,%1h% %2h%
0A4B=0,

Then save and exit the file.

Now we need to copy and paste a few files into the San Andreas Mission Builder 0.33 go into your San Andreas data folder:

C:\Program Files\Rockstar Games\Grand Theft Auto San Andreas\data

And copy the following files into San Andreas Mission Builder 0.33’s folder:

default.ide

peds.ide

vehicles.ide

Now while we are in the data folder we also need to copy and paste another folder that is in there. Look for a folder called “script”. You guessed it copy and paste that into San Andreas Mission Builder 0.33’s folder.

That’s all the configuring done.

Step 3 Decompiling The Mission Script

Now this is a little more complicated than in previous versions of Mission Builders.

Firstly run SABuilder03.exe which can be found in the San Andreas Mission Builder 0.33’s folder. Wait for it to load and then select File in the top left corner of the program. Select Open File from the list that drops down.

Now you are greeted with an Open File window this involves a little explaining on how to open the file correctly so here I go.

First of all in the bottom left corner of the Open File window you should see a drop down box which allows you to select a file type to open at the minute it should be set to:

Text Document (*.txt)

Just click the little downward facing arrow and select:

All Files (*.*)

From the list. Now you need to look at the window on he right you’ll see a folder directory listing and on the left a file directory listing. Now we want to open the file main.scm so select the folder script from the folder directory. This will now update the file directory with the latest files available in that folder. As you can see there are two files:

main.scm and

script.img

Select main.scm and click Ok.

Now a new window pops up.

user posted image

Look towards the bottom of the new window and you will see the text <new folder> click here delete any text in the text box and type

Original SCM

Make sure the folder directory is selected on San Andreas Mission Builder 0.33 and click Create Folder.

Now you’ll notice that a new folder has been added called Original SCM. Select this in the folder directory and click Ok.

This will now begin decompiling the main.scm file. Don’t worry about the time it takes it does take a long time to complete and it may even go white as though it has crashed but do not worry it has not just leave it and when it is done it will display a little report. Just click ok on this report and close San Andreas Mission Builder 0.33.

Step 4 Pickups

Right so we will start with pickups as you know a pickup is bribes, health etc.

First we will find and open our decompiled mission script. Go into My Documents and open the San Andreas Mission Builder 0.33 folder scroll down and look for a folder called Original SCM. Open it. When you do you will see a folder called Tables and a text file called Main. Leave the Tables folder alone (it contains files that are required to recompile you’re main.scm file when you have added your code) but the file Main is a decompiled main.scm. So open it in any word processing program.

Right so now we will find the code for creating pickups and edit it to place our own pickups in-game. Click Edit then scroll down and click Find and type in bribe. It should highlight the word bribe in this sentence:

DEFINE OBJECT BRIBE

This is not what you want so click find next. It should highlight this line now:

0213: $3345 = create_pickup #BRIBE type  15 at  2743.0  1316.0  8.0

This is the right code.

Right so now I will explain each of the bits of this code:

0213:

bhis bit is called and opcode. Basically an opcode is a name type. 0213: is a unique code name for the bribe pickup. Every thing has got a unique opcode. There should be a full list of opcodes in San Andreas Mission Builder 0.33’s folder.

$3345

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

=create_pickup

This is what the code does it is creating pickup.

#BRIBE

This is what pickup the code is creating it is creating a bribe pickup.

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

type 15

Should be a free pickup and

type 1

Should be a buyable pickup.

at  2743.0  1316.0  8.0

Is the position in the game

2743.0 is the x position in the game

1316.0 is the y position in the game

8.0 is the z position in the game.

Right so that is all of that code explained I hope you understood it?

Now let’s put our own bribe 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 let’s edit our code.

You need to leave the opcode as it is because as I said before it’s unique to pickups and is needed in the game.

$3345 =

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. Let’s call it

$mybribe1=

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

So now our code should look like this,

0213: $mybribe1 = create_pickup #BRIBE type  15 at  2743.0  1316.0  8.0

You need to leave

create_pickup #BRIBE type  15

This bit as it is because if you remember it is telling the game to create a bribe pickup and make it free.

But this bit we will alter,

at  2743.0  1316.0  8.0

If you remember this is the position in the game so because we are adding our own pickup we don’t want it in the same place as the proper one do we?

No of course not.

This is were SA Place Manager comes in handy. Load it up and you should be greeted with a screen like this:

sapm5sj.th.jpg

Now load up San Andreas with SA Place Manager running in the background. Roam around SA until you get to the required location. I chose here:

ingamescreenie1lk.th.jpg

Then ALT+TAB out of the game and in SA Place Manager click add place. You will then be greeted with this window.

sapmadding0gx.jpg

You then need to click “Click here to insert your current in-game location”. That will then import your location like this:

sapmaddingcoords6ht.jpg

Now as you can see me co-ordinates are 2510.345 -1687.322 13.57044.

So my code would be

0213: $mybribe1 = create_pickup #BRIBE type  15 at  2510.345 -1687.322 13.57044

Now your own added code should look like mine if you used my coordinates if not then the same but with different coordinates.

Now we make sure the code is inserted correctly. We now need to test it. This will require recompiling the main.scm.

To do this you need to open the main txt file. Then you click Run then Compile wait for it to finish. Then go into the Original SCM folder and copy main.scm and script.img. You then go into the directory and paste them over their originals in the script folder. Now go in-game and test.

Remember to start a new game. You have to start a new game after every bit of editing in the main.scm file.

ingamescreeniebribe3eb.th.jpg

Now as you can see it’s good.

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.

Related Links:

YeTi's VC coding tutorial part one.

YeTi's VC coding tutorial part two.

YeTi's SA coding tutorial part two.

Full topic.

Edited by chris82
Link to comment
Share on other sites

  • 5 months later...
  • 2 weeks later...
  • 6 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...