Quantcast

Jump to content

» «
Photo

YeTi's SA Coding Tutorial Part One

  • This topic is locked This topic is locked
38 replies to this topic
YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#1

Posted 04 September 2005 - 11:41 AM Edited by YeTi, 26 October 2005 - 12:28 PM.

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.

BW's San Andreas Mission Builder 0.33
San Andreas Place Manager
San Andreas (Iíve used version 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:

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

user posted image

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:

CODE
DEFINE OBJECT BRIBE


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

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

CODE
0213:


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

CODE
$3345


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


CODE
=create_pickup


this is what the code does it is creating pickup.

CODE
#BRIBE


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

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

CODE
type 15


should be a free pickup and

CODE
type 1


should be a buyable pickup.

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

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

CODE
$mybribe1=


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

so now our code should look like this

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


You need to leave

CODE
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

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

user posted image

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:

user posted image

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

user posted image

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

user posted image

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

So my code would be

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

user posted image

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.

Here are links to my two previous coding tutorials they may help you. Also is a link to part two of my sa coding tutorial.

YeTi's VC Coding Tutorial Part One

YeTi's VC Coding Tutorial Part Two

YeTi's SA Coding Tutorial Part Two

YeTi

alexrw
  • alexrw

    Peon

  • Members
  • Joined: 10 Feb 2005

#2

Posted 04 September 2005 - 06:18 PM

great tutorial ty

TIP:when you press okay to start decompiling the main.scm DON'T TOUCH SA mission builder, if you don't then you will be able to see its progress in the top-left corner of the screen

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#3

Posted 04 September 2005 - 06:27 PM

Thanks.

And as for the tip it is good i had noticed it before but i am seriously impatient tounge.gif .

51L3N7 4554551N
  • 51L3N7 4554551N

    Feel the Wrath of Pingu!

  • BUSTED!
  • Joined: 30 Mar 2005

#4

Posted 04 September 2005 - 08:29 PM

I believe some pinnage is in order here YeTi, this guide looks great smile.gif

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#5

Posted 05 September 2005 - 09:05 AM

QUOTE (51L3N7 4554551N @ Sep 4 2005, 21:29)
I believe some pinnage is in order here YeTi, this guide looks great smile.gif

Thanks but they won't pin it they will just add it to the tutorial archive like my last two.

Vercetti Gangsta
  • Vercetti Gangsta

    Li'l G Loc

  • Members
  • Joined: 12 Jan 2004

#6

Posted 05 September 2005 - 04:08 PM

Nice tutorial, blah, blah, compliments, compliments. ph34r.gif
Oh yes, could be a good idea to add a link to your two previous coding tutorials and vice versa. smile.gif

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#7

Posted 05 September 2005 - 04:17 PM

QUOTE (Vercetti Gangsta @ Sep 5 2005, 17:08)
Oh yes, could be a good idea to add a link to your two previous coding tutorials and vice versa. smile.gif

Yeah that is a good idea. Thanks i've done it now.

Knife
  • Knife

    Tits.

  • Zaibatsu
  • Joined: 11 Jul 2004
  • None

#8

Posted 05 September 2005 - 04:27 PM

Nice tutorial, I will point people here when thay ask n00b questions.

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#9

Posted 05 September 2005 - 04:29 PM

Thanks. I think i'll start work on part two soon.

K-Dawgg007
  • K-Dawgg007

    Player Hater

  • Members
  • Joined: 20 Nov 2005

#10

Posted 20 November 2005 - 11:10 PM Edited by K-Dawgg007, 20 November 2005 - 11:14 PM.

confused.gif I followed the instructions on decompiling .SCM's to the letter, but I still keep getting this angry.gif STUPID angry.gif error message:

Opcode out of range: 3004h
Address: 0000DAC6h

WTF!!!

PLEASE HELP!

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#11

Posted 21 November 2005 - 02:37 PM

QUOTE (K-Dawgg007 @ Nov 20 2005, 23:10)
confused.gif I followed the instructions on decompiling .SCM's to the letter, but I still keep getting this angry.gif STUPID angry.gif error message:

Opcode out of range: 3004h
Address: 0000DAC6h

WTF!!!

PLEASE HELP!

I used to get that message i can't remember how i solved it try using a fresh download of SA:MB and a fresh install of SA. If that doesnt work then im out of ideas.

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#12

Posted 21 November 2005 - 02:38 PM Edited by YeTi, 21 November 2005 - 02:38 PM.

Whoops sorry DP blush.gif .

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#13

Posted 21 November 2005 - 06:48 PM

QUOTE (YeTi @ Nov 21 2005, 14:37)
QUOTE (K-Dawgg007 @ Nov 20 2005, 23:10)
confused.gif I followed the instructions on decompiling .SCM's to the letter, but I still keep getting this  angry.gif STUPID angry.gif   error message:

Opcode out of range: 3004h
Address: 0000DAC6h

WTF!!!

PLEASE HELP!

I used to get that message i can't remember how i solved it try using a fresh download of SA:MB and a fresh install of SA. If that doesnt work then im out of ideas.

Its caused by having an out of date ini with your builder, you can get the latest builder (and ini) somewhere, can't remember where (useful) but I know Craig and Dem both host a copy, I should too really.

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#14

Posted 21 November 2005 - 06:49 PM

Sorry, also a double post, odd.

lupin3
  • lupin3

    Player Hater

  • Members
  • Joined: 03 Feb 2006

#15

Posted 05 February 2006 - 10:20 AM

Hy guys i have a problem with gta san andreas mission builder...i have puted in speedmeter in and when i want to open main.scm and put another mod, the mod speedmeter it isn't anymore... WHY...??? please help me...

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#16

Posted 05 February 2006 - 03:55 PM

QUOTE (lupin3 @ Feb 5 2006, 10:20)
Hy guys i have a problem with gta san andreas mission builder...i have puted in speedmeter in and when i want to open main.scm and put another mod, the mod speedmeter it isn't anymore... WHY...??? please help me...

Why did you post this in a tutorial? This tutorial isn't a Troubleshooting topic.

As far as i'm aware the only Speedometer mods aren't scm mods they are DirectX Hooks contained within a .dll file. You copy and paste the .dll file into your game directory to use it.

ARMax
  • ARMax

    AKA, ARMaxMods

  • Members
  • Joined: 16 Jan 2006

#17

Posted 10 February 2006 - 01:22 PM Edited by ARMax, 10 February 2006 - 01:51 PM.

QUOTE (lupin3 @ Feb 5 2006, 10:20)
Hy guys i have a problem with gta san andreas mission builder...i have puted in speedmeter in and when i want to open main.scm and put another mod, the mod speedmeter it isn't anymore... WHY...??? please help me...

yeh, it happens to me, it renames itself to be something else, mostly the script before with another number on it confused.gif

Also, i lost SAMB, can u send a new link, that one has died

EDIT: its a bug, doesnt like links from external webs, go here http://yetigamemods....g.com/gta/tools and click SAMB

YeTi
  • YeTi

    S'up Bitches?

  • Andolini Mafia Family
  • Joined: 28 Mar 2005

#18

Posted 10 February 2006 - 03:53 PM

QUOTE (ARMax @ Feb 10 2006, 13:22)
Also, i lost SAMB, can u send a new link, that one has died

EDIT: its a bug, doesnt like links from external webs, go here http://yetigamemods....g.com/gta/tools and click SAMB

It's a problem with my host, it doesn't like clicks you can get it by right clicking the link and clicking Save Target As or Save Link As.

I'll be switching hosts soon so that problem should be sorted out then.

mrfish
  • mrfish

    Player Hater

  • Members
  • Joined: 01 Aug 2006

#19

Posted 02 August 2006 - 12:25 PM

great, it helps a looooooot !! thanks!

Dan001
  • Dan001

    Hello

  • Members
  • Joined: 28 Jun 2007

#20

Posted 16 August 2007 - 07:33 PM

Thank you YeTi, I found this post to be very useful and easy to understand...good job icon14.gif

string227
  • string227

    Punk-ass Bitch

  • BUSTED!
  • Joined: 20 Jun 2007

#21

Posted 17 August 2007 - 04:49 PM

Wait,if you edit the main.scm wouldint you have to start a new game.Even when you load a existing game?

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007
  • None

#22

Posted 17 August 2007 - 05:41 PM

QUOTE (string227 @ Aug 17 2007, 16:49)
Wait,if you edit the main.scm wouldint you have to start a new game.Even when you load a existing game?

Yeah.

giddyup
  • giddyup

    Player Hater

  • Members
  • Joined: 03 Oct 2007

#23

Posted 05 October 2007 - 02:08 AM

if you use 'type 1' to make it buyable how do you set the price? Great tutorial by the way icon14.gif

GTAPlay4fun
  • GTAPlay4fun

    Crackhead

  • Members
  • Joined: 05 Mar 2007

#24

Posted 01 November 2007 - 04:34 PM

Help! Followed all step by step and decided to add the bribe right in front of CJ where he spawns when starting a new game. When starting a new game, the game crashes to desktop after running for about half a second(enough to see that the bribe IS in place). Any1 tell me what could I have done wrong? suicidal.gif

[MenaceMovies]
  • [MenaceMovies]

    Foot Soldier

  • Members
  • Joined: 05 Feb 2008

#25

Posted 19 March 2008 - 04:10 PM Edited by [MenaceMovies], 19 March 2008 - 04:32 PM.

Hi,

I encountered some problems when using Sanny Builder 3 to compile the main.txt file.

"Not enough actual parameters, expected 6 params."

Here's my code.

CODE
$mybribel = Pickup.Create(#BRIBE, 15, 422.7573, 422.7573, 422.7573)


Help would be greatly appretiated, thanks.

EDIT: I fixed it, I forgot to add the 15 before my coordinates tounge2.gif

 

EDIT: Another problem now. The pickup doesn't appear. The coordinates are correct because when I teleport to them (via Place manager) they work correctly. Just the pickup doesn't appear. Does any one know the reason for this?

PreciousWall
  • PreciousWall

    Diva

  • Members
  • Joined: 12 Jan 2008
  • Indonesia

#26

Posted 21 March 2008 - 10:09 AM

thanks very much! biggrin.gif

Bad~Boy#17
  • Bad~Boy#17

    duh

  • Members
  • Joined: 29 Aug 2007

#27

Posted 24 April 2008 - 06:24 PM

I was wondering, could anyone post a list of objects that can be placed with this code.
I don't want to add more bribes suicidal.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#28

Posted 01 May 2008 - 06:46 PM Edited by Deji, 01 May 2008 - 07:11 PM.

I've been asking alot lately but im no good at modding!!! >.<

Anyway I compiled my newest mod and it showed up with no problems... BUT after it compiled it said something about there not being enough memory...

QUOTE
error...

Memory beyond the defined range has been accessed. Use

DEFINE MEMORY 47249

or higher to allocate enough memore. Then recompile
--- Then after it says success...

I believe this would mean that the thing wouldn't of compiled properly and missed out some things? It came up with the message during the 'Jumps' or something process...

So how do I allocate enough memory? Do I have to edit a file? And If so, which one and where in the file do I put this 'DEFINE MEMORY 47259' (Or higher)?

Big thanks to anyone who helps... Im creating something good...



UPDATE: Figured It""" cool.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#29

Posted 01 May 2008 - 07:24 PM

QUOTE ([MenaceMovies] @ Mar 19 2008, 16:10)
Hi,

I encountered some problems when using Sanny Builder 3 to compile the main.txt file.

"Not enough actual parameters, expected 6 params."

Here's my code.

CODE
$mybribel = Pickup.Create(#BRIBE, 15, 422.7573, 422.7573, 422.7573)


Help would be greatly appretiated, thanks.

EDIT: I fixed it, I forgot to add the 15 before my coordinates tounge2.gif

 

EDIT: Another problem now. The pickup doesn't appear. The coordinates are correct because when I teleport to them (via Place manager) they work correctly. Just the pickup doesn't appear. Does any one know the reason for this?

That code is 100% wrong... (Well, more like 60% wrong...)

EXAMPLE OF WORKING CODE:

CODE
0213: $NAME = create_pickup #BRIBE type  15 at  2442.840  -1720.8540  13.770340


Just change the co ords and name per code... Hope this helps!

PreciousWall
  • PreciousWall

    Diva

  • Members
  • Joined: 12 Jan 2008
  • Indonesia

#30

Posted 18 May 2008 - 01:00 PM Edited by darkdude, 18 May 2008 - 01:23 PM.

i use this code and its working tounge2.gif

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

user posted image




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users