Quantcast

Jump to content

» «
Photo

Tutorial Links and Mission Coding Information

  • This topic is locked This topic is locked
112 replies to this topic
sleeper777
  • sleeper777

    Mission Coder | Help Guru | Tech Ninja

  • Members
  • Joined: 28 Mar 2003

#1

Posted 28 May 2004 - 06:16 AM Edited by spaceeinstein, 10 April 2009 - 10:05 AM.

"Topic is somewhat outdated so here's a link for the latest info on the best tools and tutorials to use"

You will need either one of Barton's Mission Builders(GTA3, VC, SA) , the gtama + the ide + disasm, or Sanny Builder in order to decompile the main.scm file and see it in script format.

Script format is viewed as follows:
CODE


;MB Format
02AC: set_car 0@ immunities 1 1 1 1 1

| or |

;gtaMA Format
set_car_immunities      $my_currcar, 1, 1, 1, 0, 1

| or |

;Sanny Builder Format
02AC: set_car 0@ immunities BP 1 FP 1 EP 1 DP 1 SP 1



As you can See here that the formats are only slightly different and understanding of basic programming logic should be your main concern. You should be able to read and understand thoroughly the readme of the tools you use and the documentation collected here and many other places hosted by the members here. And by all means when you really want to know how to approach a thread idea refer to the original code. Decompile your main.scm and save this text file somewhere all by itself open it and search whenever you want to find how a particular thread was accomplished. never modify this backup of the oriiginal code it will help you tremendously to have a backup of the un-modded source code for missions.

Basic understanding of IF THEN ELSE, FOR, WHILE, DO UNTIL, Incrementing, and Decrementing, basic algebra and geometry are helpful, and of course the ability to logic out problems, all are base requirements before getting into Main.SCM Modding a.k.a Mission Scripting, or Mission Coding. If you really want to understand the flow of the game logic you should read as much information as you can find on Programming Logic. Yes, While some things like new pickups, parked cars, and some basic stat modifications are easily accomplished with one or two opcodes, the majority of the the best tools a mission scripter can build require some knowledge of basic programmer's skills.

Basically if you can understand one scripting language or programming language, then your chances of survival as a Mission Scripter are greatly Improved.


CODE

For (X = 0;While X < Number_of_Repeated_Questions_by_Noobs; X++)
{
     Write "Read, Read, Read ......"
}
Write "The Readme";

If
 (WannabeCoder == Understands.This)
Then
 Message = "You may have Hope";
Else
 Message = "You must travel another Path";
End;

Write Message;


Tutorials List from this thread.

JasonB, PatrickW, Y_less 1, Y_less 2, Y_less 3, Y_less 4, Craig Kostelecky, timmy2004, IF(s) ,AND(s), & OR(s),

From Other Areas of the Forums


Tutorial on spookie's SCM/D3D hook for Vice City

and for those of you who need a primer on san andreas coding specifically, Yeti has written a nice tutorial on the basics. (More Links and updates soon !)
YeTi's SA Coding Tutorial Part One,
YeTi's SA Coding Tutorial Part Two ,
DarkPact SA - Demarest,

Be sure to read back here for updates and check the other pinned topics in the mission coding forum.

In Barton's editor it begins with the opcode number followed usually by some descriptive text about what the opcode does, this is also true of most of the script in Sanny Builder with some minor differences in the format of some code. The other text or numbers you see is usually parameters for the opcode, these are identified by the parameter data type symbols: Edit: these do not apply to the current version 1.4 of Vice Builder except the $, @, "quotes", : , #, ££
global variable identifier $,
Float parameter identifier used for world coordinates ! (-2048 to 2047.9375 x -2048 to 2047.9375 in GTA 3) (
Little Integer parameter identifier ?(-128 to 127)
Memory Location identifier ?? (avoid these like the plague when modding an already built scm) 0-65535 in increments of 4
Big Integer parameter identifier &(-32768 to 32767) or $ in the more recent versions of VC SA and Sanny
Really Big Integer parameter identifier && (theoretically any size - or +)
Local variable identifier @
string variable "quotes"
model identifier #
thread label marker :
thread prefix Marker ££ or @ in Sanny builder

In gtaMa/VCME it usually just a description of the opcode's function, followed by comma seperated parameters or variables.
The symbols used are:
the uniquely named global variable identifier $
the label marker @
the local variable identifier !
the string variable "quotes"
the model identifier %

More InformationAny one interested in coding should read all of the Above information. Search these forums for all the descriptions, parameters, and examples they can find. Only after you have read all this information and tried to develop some code will you be bale to understand some of the short answers that you will get from those of us who have spent the time to learn it and have answered the basic questions hundreds of times. The development of Mods is time better spent than answering questions that have already been answered.

For Questions about most versions of Syntax for Sanny Builder:

SA.OpSearch+
SCM Dojo
Op-Search+ Topic

Using the following link will answer more questions than any posting will give you be sure to set the date feature of the search to the "Any Date" setting and also be sure to set the 'Search Where' to 'Mission Coding' Only this will tighten your Search and give you results pertaining to mission coding only.

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002

#2

Posted 28 May 2004 - 06:27 AM

You might also want to give this a read, its a little old but hey what the hell. I may update it soon though

GTA3\Vice City Modding Tutorial #1:
Author: JasonB

Topics:
1) Intro
2) Basics
3) Your first addition
4) New Thread
5) Conclusion

1: Intro
OK, to start off in mission coding for either GTA3 or Vice City you DO NOT need to know anything about programming. Maybe a little logic and maths skills but that’s about it. This tutorial assumes that you have a copy of Bartons mission builder, either for GTA3 or VC. Some of the stuff in here may apply to other builders but I use Bartons, so I will not write tutorials for other builders.

2: Basics
OK heres your first lesson in coding. Open up the MAIN.SCM in Bartons builder, make a backup of main.scm as well. Look at all the code, theres a lot but most of it you wont ever touch, so don’t worry.
Opcodes:
Look at the lines, they all have four number-letter combos before them, that’s an opcode, depending on what opcode it is determines what it will do. There are a lot of opcodes, most of them are useful.
Variables & Data Types:
There are several different data types. A brief explanation follows:
CODE
 
? – Short Integer: Can values up to 255 eg 1@ = 5?
& - Long Integer: Can hold values up to 65535 (I think) eg $TEST = 500&
! – Float (Real value) eg 8?? = 0.25!
$ - Global variable eg $TEST = 500&
@ - Local Variable eg 1@ = 25?
?? – Global Number variable eg 8?? = 0.25!

Threads:
A thread is a section of code that runs independently of the main program. For example a speedometer has to always be running even if you are in a mission.

3: Time for your first addition
Your first addition to the game should always be simple, don’t try to make an uber-leet mad ass never before done mod on your first attempt, that will get you nowhere. Instead the first thing you will add is a new pickup. (Note: the following code and examples was written with Vice City code as a basis, the same principles apply to GTA3 but the code is different, also this code may be out of date, I might be getting references from an older version, but still, the same principles apply)
Search in the code for opcodes that match these numbers 0213. In Vice city the first matches you should get are bribes, so we are going to make a new bribe in a new location. Copy and paste one of the lines.
CODE
 
0213:  440?? = create_pickup -4? (BRIBE) type  15? at  393.9! -60.2!  11.5!

0213 is the opcode. The 440?? Is its identifier. -4? Is the model of the pickup. And the last three numbers are the XYZ coordinates.
Lets change it too:
CODE

0213:  $BRIBE1 = create_pickup -4? (BRIBE) type  15? at  229.69! -1263.40!  20.11!

Save it and compile it, put the updated Main.SCM in your DATA folder and run the game. GO to the ocean view hotel and there should be a bribe in your room.
Did it work, if so good, now your next lesson:
New parked cars:
Look for OpCodes 014B and 014C, copy a 014B and 014C line.
CODE

014B:  7972?? = init_parked_car_generator #MAVERICK -1? -1?  0? alarm  0? door_lock  0?  0?  10000& at -853.6609!  1353.785!  68.6104! angle  0!
014C: set_parked_car_generator  7972?? cars_to_generate_to  101?

That’s something like what it should look like. Now lets change it a bit, first the 014B line:
CODE
 
014B:  $KENCAR = init_parked_car_generator #ROMERO -1? -1?  0? alarm  50? door_lock  0?  0?  10000& at 112.018!  -804.531!  10.4193! angle  30!

OK, once again, theres the opcode and the indentifier, I cant remember which value is which but the other values are, cars colour 1, cars colour 2, Belongs TO Player (no starts for stealing), alarm (value out of 100, 0 means no car alarm, 100 means always), Door Lock (same rules apply to door lock as they did to alarm), car value and the XYZ co-ords and the angle.
Now for the 014C opcode:
CODE

014C: set_parked_car_generator  $KENCAR cars_to_generate_to  101?

Basicallay it tells the game to always spawn a hearse near Kens place. Compile and place in data directory, and there you go.

4: New Thread
OK now you are going to make a new thread that does something. In this case makes it rain until you complete the Phnom Penh mission (The Hurricane).
CODE
 
:LabelSunny
0001: wait 500& ms
00D6: if 0?
0038: $PASSED_COK2_PHNOM_PENH_86 == 1?
004D: jump if false ££LabelRainy
01B6: weather 0?
0002: jump ££LabelSunny

:LabelRainy
0001: wait 500& ms
01B6: weather 2?
0002: jump ££LabelSunny


ok :LabelSunny and LabelRainy are parts of this thread. The wait command makes it so Vice or GTA3 doesn’t freeze and eat up your system resources, since this doesn’t need to be checked very often, it only checks it twice every second. The if 0? Command is an if statement, the 0? Is how many things have to be right to make it continue or jump, if you add 20 to it becomes an OR statement. The $PASSED_COK2_PHNOM_PENH_86 == 1? Line only checks to see whether you have passed a mission or not. The jump_if_false says, if you haven’t passed it, jump to the rainy section. Weather 0? Is a state of the game sweather, 0? Means its fine. The jump statement means it jumps to the start of the thread to check again. The same principles apply to LabelRainy. Just so you know you put this all before the Mission 0 part of the code. SO to find Mission zero look for Mission 0- and put this code ABOVE it. Now to make the game check for the code you require a create thread command. Go to the top of the code and look for 004F opcodes, there should be quite a few of the, copy and paste one of them and then change the jumble of numbers and letters at the end to be Sunny, so it should say 004F: create thread ££LabelSunny. Compile and run the game, It should be raining, if so good, if not, try again.

5: Conclusion
You have now made a mini-mod for either GTA3 or VC. Congratulations . Just so you know there is a high chance that I will write more tutorials, so more learning . But don’t wait, expand on the code and make more cars, pickups and threads, make VC or GTA3 how you want it, and remember, have fun.

sleeper777
  • sleeper777

    Mission Coder | Help Guru | Tech Ninja

  • Members
  • Joined: 28 Mar 2003

#3

Posted 28 May 2004 - 06:50 AM Edited by sleeper777, 20 October 2004 - 09:47 AM.

...

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#4

Posted 28 May 2004 - 02:09 PM

Finally! I wish I weren't so lazy; I would've written something like myself once upon a time.

Pinned.

TwoZero
  • TwoZero

    Ghetto Star

  • The Connection
  • Joined: 15 Apr 2003

#5

Posted 29 May 2004 - 11:17 PM

Erm a link to the mission builder would be nice for people to start with...

or do you just assume they have it?

JasonB
  • JasonB

    GTA-SA/GTA-VC/GTA3 Modder Extraordinaire

  • Members
  • Joined: 24 Aug 2002

#6

Posted 30 May 2004 - 12:41 AM

one would assume that if you want to start coding you would atleast have the basic tool required.
@Sleeper: Hey! I remember posting that tutorial on your site, that was several months ago I believe.

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#7

Posted 30 May 2004 - 07:41 PM

Mission Builder 4.7 for GTA3
Mission Builder 0.22 for VC

These are outdated versions, but the last versions of both prior to the changeover.

ModelingMan
  • ModelingMan

    Crackalacking!

  • Members
  • Joined: 23 Jan 2004

#8

Posted 03 June 2004 - 09:43 AM

Does anyone know a link to gtaMA_IDE?, all the links that I have found are dead including http://www.gtascripts.org

TbM2k
  • TbM2k

    playing/modding gta:SA

  • Members
  • Joined: 25 Feb 2003

#9

Posted 03 June 2004 - 11:49 AM

I put it on my homepage, but it's not the actual version of the IDE, it's an older version that has some problems... (it won't compile on some systems) ...I made a batch file so it compiles here (anyway I'm using a text-editor to write the script)

But the compiler (gtaMA) should work, it's the vice-version that also does gta3 script with no problems, only one bug is known, it can't handle two labels following each other without any command between them... (so just put a "nop" there and it should work)

Thesord
  • Thesord

    Lacking time

  • Members
  • Joined: 12 Aug 2003

#10

Posted 09 June 2004 - 07:26 PM

Just wanted to tell you that some of the links don't go to where it's supposed to,they go to advertisement sites.

TbM2k
  • TbM2k

    playing/modding gta:SA

  • Members
  • Joined: 25 Feb 2003

#11

Posted 09 June 2004 - 09:42 PM

QUOTE (Thesord @ Jun 9 2004, 21:26)
Just wanted to tell you that some of the links don't go to where it's supposed to,they go to advertisement sites.

It's a known problem of web1000 that they redirect all non-US traffic to porn and dialer sites... (that's how they earn money without having ads on their servers)

just try some anonymizer-service like http://www.anonymouse.ws to access the site and it should work... (this even works if your provider locked some domains... i tried it at a school that doesnt allowed me to surf on ebay...)

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#12

Posted 17 June 2004 - 12:10 PM Edited by Y_Less, 09 July 2004 - 08:13 AM.

Alex "Y_Less" Cole's n00b guide to coding.

I know a coding n00b writing a tutorial on coding may seem a bit odd at first, but there is method in my madness. I am just starting coding, as I know alot of other people are or would like to, so I am putting things here as I find them out, in n00b terms, from the point of a n00b, so that hopefully other n00bs will be able to follow it. Its all well and good going "how do I do this?" and the experienced people go "using OpCodes bla bla bla with some variable doing this", nut I don't know about you, but I would much rather know how to figure all this stuff out myself, as, I am sure, everyone else (including experienced coders - whose time would be freed up by not having to tell 5 different people how to do an OR cos they can't find the command) would.

If anyone with more experience would like to contribute, please fell free to, but remember that we don't know what OpCode 04AE or 02A7, for example, do off by heart and would need to be explained.

I am hoping that eventually, as I get more experienced, and other people do, I will be able to make this into a full blown tutorial on coding for beginners, easy to understand for them, and others.

Anyway, enough about all that, on to Part 1: Placing Items.

There are a couple of items I am going to cover in this, pickups, vehicles, weapons, marker points and other models, this is probably the best place to start as without these, you can't do anything else.

1. Pickups.

The easiest way to find out how to do things is to search the code for existing examples of it. When you first power up the editor, you see a long list of object definitions, one of which looks like this:

CODE
DEFINE OBJECT BODYARMOUR                  \\ Object number -18


We know what the object is called, so it we want to place one, just go to search and search for BODYARMOUR. Whats the first result that somes up, besides the object definiton we just looked at? this line:

CODE
0107:  3572?? = create_object -18? (BODYARMOUR) at -66.629! -1488!  12.113!


Unfortunately, we are looking for the body armour pickup, that is just an object, so keep searching until you find this line:

CODE
0213:  5272?? = create_pickup -18? (BODYARMOUR) type  15? at -314.7! -551.2!  10.3!


0213 is the create_pickup OpCode, used for item pickups (except weapons except mele weapons). If you look below the line you are on, you will se the line:

CODE
0213:  5276?? = create_pickup #CHNSAW type  15? at -310.7! -551.2!  10.3!
- the 0213 OpCode

And then a bit further down, the line:

CODE
032B:  5280?? = create_weapon_pickup #PYTHON  15? ammo  24? at -306.7! -551.2!  10.3!
- not the 0213 OpCode - it has ammo values as well.

Back to our armour pickup, you can see after the OpCode a variable, this is what stores the armour, if we want to add our own, we need to change this to an unused variable, you can either find out what the lowest unused variable number is, or you can use a string variable, e.g:

CODE
0213:  $my1starmour = create_pickup -18? (BODYARMOUR) type  15? at -314.7! -551.2!  10.3!


Now to where to put it, fire up Code Creator and VC and walk to where you want it, I'm going to put it at:

108.0565! -839.6693! 10.46322! - by the front door of Ken's next door neighbours, so change the co-ordinates at the end to those, and you get:

CODE
0213:  $my1starmour = create_pickup -18? (BODYARMOUR) type  15? at 108.0565! -839.6693! 10.46322!


Now you can't put this line into the code where you got it from because that was in the middle of a thread, so continue searching through the code until you find a long list of pickups next to each other (at around line 28430) and insert in in there. Now save, compile and run.

user posted image

2. Vehicles

We will use the tequniques used in the previous part to find how to make vehicles, if you are still on the part with the armour, scroll up a little bit and you will find the code for the vehicles. I am going to place a packer (the car transporter) outside the Malibu to jump over it, find the line for the packer in the Vice Port and copy it:

CODE
014B:  7516?? = init_parked_car_generator #PACKER -1? -1?  0? alarm  0? door_lock  0?  0?  10000& at -946.3! -1379.5!  11.5! angle  69!
014C: set_parked_car_generator  7516?? cars_to_generate_to  101?


The co-ordinates I got were:

470.9084! -121.0596! 10.36153! and the rotation is 0 as I am looking North (rotation is done in degrees anti-clockwise from North). There is also another variable in these 2 lines, so replace them both with a new one (they are the same, so leave them the same).

CODE
014B:  $my1stcar = init_parked_car_generator #PACKER -1? -1?  0? alarm  0? door_lock  0?  0?  10000& at 470.9084! -121.0596! 10.36153! angle  0!
014C: set_parked_car_generator  $my1stcar cars_to_generate_to  101?


We want it unlocked and unalarmed, so leave those as 0, and we want it to appear, so leave the cars_to_generate_to as 101?

Save, compile and run again. Remember that you need to start a new game after every little tiny mod.

user posted image

3. Weapons

We have already covered the OpCode for weapons, most weapons are directly under the cars, so go down to them and copy the line for an M4

CODE
032B:  8096?? = create_weapon_pickup #M4  15? ammo  60? at -1221! -641.6!  11.7!


Then decide where you want it and and how much ammo you want to give it and put them in (?'s are interger values and !'s are floating point values). Finally, change the variable at the beginning again (you always need to do this), save, compile and test.

CODE
032B:  $my1stgun = create_weapon_pickup #M4  15? ammo  100? at 5.266161! -939.0254! 16.116!


user posted image

4. Marker points

I don't know what the code for this is, but thankfully, the people who find these things out give them sensible names, so, as we want to create a marker, search for create_marker, and what do we get? - a bit of marker code! The second one I came accross I know is a small round pink one as it is the marker from the 'The Party' mission outside Rafael's, so copy this and edit it.

CODE
02A8:  236?? = create_marker  28? at  396??  400??  404??


Note on this one, unlike the others, the co-ordinates are stored as variables instead, these will have been defined earlier in the mission as the actual co-ordinates and just used here.

CODE
02A8:  $my1stblob = create_marker  28? at  556.2355! -3.073752! 14.3036!


I have made mine by the front door of the WK Chariot, insert this code somewhere sensible, e.g. with all the other pickups in Mission 0, this will mean it is there from the start. And now, of course, test.

If you have been following, you will have discovered that testing is very important, as that is infact the wrong OpCode! That just creates a marker on the radar that looks like a T-shirt (the Rafael marker). After a bit more searching through the code, I found these markers to test:

CODE
02A7:  892?? = create_icon_marker_and_sphere  1668?? at  1824??  1828??  1832??
018A:  76?? = create_checkpoint_at  8452??  8456??  8460??


But when I tested it, I found the first was the Lawyer radar marker and the second was just the pink marker on the radar that shows whether something is below, level with or above you. So after alot more searching, I found this:

CODE
0189:  264?? = unknown_create_checkpoint_at  240.4! -1280.2!  10!


In the end I just searched for instances where I know it existed, i.e. the hotel marker at the very beginning an searched for those. But this does show you how easy it is to get it wrong and how important testing is (I did consider re-writing this part, but I decided to leave my blunder in just to show you how to sort things like this). So after editing it, and removing the t-shirt marker (I kept in the height marker for show), I ended up with code that looked like this:

CODE
018A:  $my1stblob = create_checkpoint_at  556.2355! -3.073752! 14.3036!
0189:  $my2ndblob = unknown_create_checkpoint_at  556.2355! -3.073752! 14.3036!


Which, after testing, does work.

user posted image

5. Other models

From what I have read, alot of people consider this quite advanced as it allows you to do map manipulation, which is supposedly hard, but I think its quite fundamental.

The first thing you need to do for this is define the model, if you have Moo Mapper, this is probably the easiest way to find a model. For this, I am going to put a security box outside 1102 Washington Street - not exciting, but it can be expanded on.

First, you need to find add the model. At the top, where we first got the body armour info, to the bottom of the list, add this line:

CODE
DEFINE OBJECT bar_gatebox01             \\ Object number -204


And increase the number of models at the top by one. This has now defined the model in the code.

Now you need to find the code to put the model into the world, simply scrolling down a few lines reveals these lines:

CODE
029B: $ARENA_DOOR_1 = init_object -1? (DTN_STADDOORA) at -1109.615!  1330.097!  20.372!
01C7: spawn_object $ARENA_DOOR_1


Using these co-ordinates:

103.192! -812.6703! 10.46329!

We can modify the code to add our model. Note - the model number in the above example is above -128, so it can be a short integer variable, as ours is -204 - much less that -128 we need to use the & variable type.

CODE
029B: $my1stobject = init_object -204& (bar_gatebox01) at 103.192! -812.6703! 10.46329!
01C7: spawn_object $my1stobject


This will spawn a random box outside 1102 Washington Street - it is above the ground and flies off when you touch it, but it is a start and this can easilly be rectified later.

user posted image

Practice activites:

1. Put a police bribe in the room at the top of the lighthouse.

2. Add a marker to the radar to show you where it is.

3. Spawn a motorbike inside the grocery store down the road from El Swanko Casa, and turn its alarm on.

4. Find the OpCode for the large, racing checkpoint circles and put one on the bridge to Starfish Island.

5. Find the weapon number for the camera as used in Marthas Mugshot and give the player it.

I hope this is a useful introduction to coding, if so I will continue and try to write more as I find more, please add any comments you like below (except flames for the maker mess up - I think I deserve to not get flamed for owning up to it).

note: Edited for new hosting.

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#13

Posted 17 June 2004 - 12:55 PM

Merged Y_Less's thread with pinned tutorial thread.

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#14

Posted 17 June 2004 - 06:01 PM Edited by Y_Less, 17 June 2004 - 06:07 PM.

OK, phew - you had me worried for a bit then when I came on and it wasn't there, I thought you had deleted it.

Barton Waterduck
  • Barton Waterduck

    retired modder

  • Members
  • Joined: 12 Feb 2002

#15

Posted 18 June 2004 - 12:28 PM Edited by Barton Waterduck, 18 June 2004 - 01:02 PM.

Posting old links to old files should be against the forum rules. It's not a secret that the newest mission builder is version 1.3 for Vice and 5.0 for GTA 3. The links are in my signature.

New users: I'm sorry you have to read crap like this. Some people think they own this forum, so they post what their egos dictate. Just read the readme included with the latest versions and forget you ever heard about this forum.

Oh, and since this topic is pinned, the 0.22 version of the Vice mission builder doesn't work at all with some of the newer opcodes because the number of parameters are wrong. Your game WILL CRASH if you use them.

If somebody were to build a wodden hammer, label it "PRE ALPHA TEST VERSION" and hit you in the head with it, would it hurt ? If it does, keep it to yourself please.

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#16

Posted 18 June 2004 - 03:14 PM

QUOTE (Barton Waterduck @ Jun 18 2004, 07:28)
Posting old links to old files should be against the forum rules.
Why? You expressly gave everybody permission to use all of your work however they see fit. And I secured your permission to continue to update the scm.ini for MB4.7.

QUOTE (Barton Waterduck @ Jun 18 2004, 07:28)
Some people think they own this forum, so they post what their egos dictate.
Actually, people were using those versions of MB before you released the newer versions. So it has nothing to do with me. Besides, since when is having a CHOICE a bad thing?? (except when it means not everybody will be doing EXACTLY as you tell them)

QUOTE (Barton Waterduck @ Jun 18 2004, 07:28)
Oh, and since this topic is pinned, the 0.22 version of the Vice mission builder doesn't work at all with some of the newer opcodes because the number of parameters are wrong. Your game WILL CRASH if you use them.
So. The INI can be updated. No big deal.

sleeper777
  • sleeper777

    Mission Coder | Help Guru | Tech Ninja

  • Members
  • Joined: 28 Mar 2003

#17

Posted 21 June 2004 - 08:35 PM Edited by sleeper777, 21 June 2004 - 08:38 PM.

You know i do not understand all the hostility by the waterduck i mean all the praise and support we offer not to mention the hours spent defending him against the gtama users in the past just doesn't pay off. The reason we have continued to use the older versions is because it is what we were comfortable with. I think it is a proprietary thing like microsoft or something he thinks we have to upgrade because he doesn't support them anymore ....well IMHO that is crap .... too many software makers want us to constantly upgrade to the newest versions ... if i want to use Vice Builder version 0.14, or 0.21, or 0.22 with an updated .ini then that is my perogative. why should you come over here and crap on my thread just for an added post to your post count .... angry.gif

Any way for those of you that really want to continue using these 'older' versions i will continue to support them

And for any of you who want to use the newer versions i will be making newer tutorials to add to this very same thread besides the readmes for the mission builders don't change that much from version to version... and if you don't know where it started sometimes it is hard to catch up with the current way of doing things this is why the links i have tried to provide go all the way back to before the gta3 builder was even finished.....

alot of the information on modding gta was found even before gta3 came out slight changes to the understanding of mission building opcodes and of course the development of new tools is always a plus but you still need to to understand the history behind this to really get it ph34r.gif

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#18

Posted 22 June 2004 - 09:56 AM

My hosting seems to have gone AWOL, it won't show pictures anywhere that i've put them, I'll try and sort it out before part 2.

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#19

Posted 22 June 2004 - 01:19 PM

QUOTE (sleeper777 @ Jun 21 2004, 15:35)
Any way for those of you that really want to continue using these 'older' versions i will continue to support them

Me too as best as I can smile.gif

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#20

Posted 22 June 2004 - 01:49 PM

I prefer using 0.22 as it is the one I started with and alot of the stuff I've done with it for some reason won't complie in later versions.

Also - I don't know if you've noticed but thisa topic is entitled "infROmation" (and the rest obviously).

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#21

Posted 22 June 2004 - 02:19 PM

Not any more wink.gif

I use .22 for that reason amongst others. Though you don't have to worry about your work not compiling. Newer versions have the code converter feature.

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#22

Posted 22 June 2004 - 02:34 PM

I tried changing to the newest one, but I opened my stuff in it and when I tried to compile, it complained about incorrect numbers of terms in my if command, it was if 0?, but I ahd a commented out line from an eariler method that I wanted for reference, but it took it as being part of it anyway even if it wouldn't have complied it (there should be an ignore button on if statement checker error dialogues or something).

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#23

Posted 22 June 2004 - 02:46 PM

Yep. My biggest complaint with the new one. Plus, I PREFER the datatypes being there. Makes searching the code for certain things much easier.

brokenfish
  • brokenfish

    Homie

  • Members
  • Joined: 11 Jul 2003

#24

Posted 23 June 2004 - 02:57 AM

i personally couldnt care less. im not a full-time programmer, so i just use stuff as they are. i do have a 0.22 backed up just in case, though. however, i cant seem to find my 0.13 (for REALLY old things).

i just recently found my old brokenMod from february. its time to dust things off a bit. i cant find some stuff. i think an addition to this topic could be reference items like lists of particles, objects, or wait states with full descriptions or things like that.

im also trying out gtama but so far i havent gotten anything to work. sad.gif

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#25

Posted 29 June 2004 - 10:26 AM

I have sorted out new hosting (www.y-less.com (plug, plug)) but it is not up yet, when it is though, I will sort out those pics and edit the post so they actually show up.

Craig Kostelecky
  • Craig Kostelecky

    GTA:LC Team Leader

  • The Connection
  • Joined: 28 Jan 2004

#26

Posted 08 July 2004 - 05:34 AM

I thought I'd add a little tut for adding threads (or code snippets) since I didn't see one in this thread. Also, that's what most people want to do when they modify their main.scm.

So what is a thread? A thread is a section of code that runs independent of the mission code. Something like unique jumps are coded in threads.

This tutorial will show you how to add a snippet of code that's already written. Writing your own threads will be saved for a later day. And this only requires copying and pasting, so you do not need to be a coding expert to do it. The only tool required for this job is Barton's Mission Builder (the code I'm using here is written for version 0.22, but the same rules apply for any version)

First thing you do is find a code snippet from somewhere. I'll use the car spawning code that's in our GTA:LC script. Here's what that code looks like:
CODE
:LabelCARSPAWN
0001: wait  500& ms
00D6: if  0?
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££LabelCARSPAWN
00D6: if  0?
80E0:   NOT   player $PLAYER_CHAR driving
004D: jump_if_false ££LabelCARSPAWN
00D6: if  1?
00E1:   key_pressed  0?  16?
00E1:   key_pressed  0?  6?
004D: jump_if_false ££LabelCARSPAWN
018C: play_sound  1? at  0!  0!  0!
0172:  0@ = actor $PLAYER_ACTOR z_angle
04C4: create_coordinate  1@  2@  3@ from_actor $PLAYER_ACTOR offset -4!  0!  0!
04C4: create_coordinate  4@  5@  6@ from_actor $PLAYER_ACTOR offset  4!  0!  0!
0247: request_model #PCJ600
0247: request_model #HUNTER
038B: load_requested_models

:LabelCARSPAWN2
0001: wait  0? ms
00D6: if  1?
0248:   model #HUNTER available
0248:   model #PCJ600 available
004D: jump_if_false ££LabelCARSPAWN2
00A5:  7@ = create_car #PCJ600 at  1@  2@  3@
00A5:  8@ = create_car #HUNTER at  4@  5@  6@
0175: set_car  7@ z_angle_to  0@
0175: set_car  8@ z_angle_to  0@
0249: release_model #HUNTER
0249: release_model #PCJ600
01C3: remove_references_to_car  7@  \\ Like turning a car into any random car
01C3: remove_references_to_car  8@  \\ Like turning a car into any random car
0002: jump ££LabelCARSPAWN

Now to put it in with the rest of the code, open up the main.scm (or a main.scm.txt if one's available) with Barton's Builder. Then search (ctrl-F) for "create_thread" You will see a bunch of lines that look like this:
CODE
004F: create_thread ££Label01002E

You need to add one of those lines for your code. Before we do that, let's take a quick look at the code snippet we found earlier. Look at the first line, you'll see this:
CODE
:LabelCARSPAWN

So the line you want to add will look like this:
CODE
create_thread ££LabelCARSPAWN

All together, it would look like this:
CODE
004F: create_thread ££Label0320EB
004F: create_thread ££Label0321A8
004F: create_thread ££Label032243
004F: create_thread ££LabelCARSPAWN

Then you need to add the code itself. To do this, search again with the builder. This time look for "mission 0" You will be taken to a section of code that looks like this:
CODE
;-------------Mission 0---------------
; Originally: (no description)


:Label0322ED
03A4: name_thread "INITIAL"
0004: $DEFAULT_WAIT_TIME =  250&  \\ integer values

You want to add your section of code just before the mission 0 code starts. So the code will now look like this:
CODE
:LabelCARSPAWN
0001: wait  500& ms
00D6: if  0?
0256:   player $PLAYER_CHAR defined
004D: jump_if_false ££LabelCARSPAWN
00D6: if  0?
80E0:   NOT   player $PLAYER_CHAR driving
004D: jump_if_false ££LabelCARSPAWN
00D6: if  1?
00E1:   key_pressed  0?  16?
00E1:   key_pressed  0?  6?
004D: jump_if_false ££LabelCARSPAWN
018C: play_sound  1? at  0!  0!  0!
0172:  0@ = actor $PLAYER_ACTOR z_angle
04C4: create_coordinate  1@  2@  3@ from_actor $PLAYER_ACTOR offset -4!  0!  0!
04C4: create_coordinate  4@  5@  6@ from_actor $PLAYER_ACTOR offset  4!  0!  0!
0247: request_model #PCJ600
0247: request_model #HUNTER
038B: load_requested_models

:LabelCARSPAWN2
0001: wait  0? ms
00D6: if  1?
0248:   model #HUNTER available
0248:   model #PCJ600 available
004D: jump_if_false ££LabelCARSPAWN2
00A5:  7@ = create_car #PCJ600 at  1@  2@  3@
00A5:  8@ = create_car #HUNTER at  4@  5@  6@
0175: set_car  7@ z_angle_to  0@
0175: set_car  8@ z_angle_to  0@
0249: release_model #HUNTER
0249: release_model #PCJ600
01C3: remove_references_to_car  7@  \\ Like turning a car into any random car
01C3: remove_references_to_car  8@  \\ Like turning a car into any random car
0002: jump ££LabelCARSPAWN


;-------------Mission 0---------------
; Originally: (no description)


:Label0322ED
03A4: name_thread "INITIAL"
0004: $DEFAULT_WAIT_TIME =  250&  \\ integer values

After you do that, you're done editting the main.scm. Now all you need to do is compile the code (press F7) and run the game. You will need to start a new game as old saves will not be compatible with your new code. Good luck.

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#27

Posted 09 July 2004 - 08:10 AM Edited by Y_Less, 09 July 2004 - 08:12 AM.

Alex "Y_Less" Cole's n00b guide to coding.

Its finally here: Part 2: Using Threads and Labels.

In this tutorial I will be exploring how to use threads, labels and ifs to check for conditions being met in order for more things to be done.

1. Labels.

A label names a small section of code so it can be called at any time, e.g.

CODE
:Label0B0910
00D6: if  0?
00DF:   actor  18576?? driving
004D: jump_if_false £Label0B0925
03E2: actor  18576?? exit_car


This is just a random bit of code I got from the main.scm, but anytime you put
CODE
0002: jump £Label0B0910
it will run that piece of code, and any bits linked to it by it, e.g. all the bits of code under £label0B0925 (and al the bits under that), (which happens to be just this):

CODE
:Label0B0925
0002: jump £Label0B0942


2. Threads.

A thread is a label, or collection or labels, that runs continuously to see if the player is doing something, every mission has a thread to check if the previous mission has been competed, and if it has, to check if the player is in the spot that triggers the mission (i.e. the contact point), and if those are both true, runs the mission. Threads are used to run all the things that happen in the game, they don't do them, generally, but will check conditions and run the associated mission if all the conditions are met. There are exceptions, threads can and do do things themselves, but generally these are more complex.

3. Ifs.

These are the bits that actually check for if something is happening, and jump somewhere if it isn't happening. This may seem a little backwards at first but is quite sensible as it means you can say 'Is this happening? No? Oh well sod off then'.

CODE
00D6: if  0?
0214:   pickup $PRINT_WORKS_ASSET picked_up
004D: jump_if_false ££Label00CA42
0417: start_mission  36?
004E: end_thread


This is another random piece of code taken from the Print Works Asset buying thread (surprisingly). It checks to see if the player has picked up the buy asset marker (by this point in the code it will be available), and if they have, run the buy Print Works asset mission (yes, even buying things is classed as a mission). But if it hasn't been picked up, it never gets to that piece of code as it is redirected (jumped) to another label, which restarts the thread to check again. if 0? means the code will check 1 condition, 1 means 2 etc, 20+ are ors'. e.g. if 21? means if condition 1 OR condition 2 is met, return true.

4. Using them together.

There are a few things that all threads need to work, firstly a definition. Without this, the code will not know that the thread exists and will not run it to check.

CODE
004F: create_thread ££Labelmy1stlabel


This OpCode is always used for this, you just change the label name depending on your threads first label.

Second, you need to create the label for the first part of the thread and, although from what I have read, this is not essential, name it.

CODE
:Labelmy1stlabel
03A4: name_thread "my1stth"


This tends to be all there is in the first label, although I belive this is more down to conventon and good coding practice than actual need. When using multiple labels in a thread, unless you jump in on label, the code will continue running through to the next label. e.g.

CODE
:Labelmy1stlabel
03A4: name_thread "my1stth"

:Labelmy2ndlabel
0001:wait $default_wait_time ms


This will run the first label, then continue on to the second part. You will also notice a wait in there, the code needs this or the game will crash. It would run the thread continuously, but that gives it a break (in ms) so it is not running it then re-running straight away, the length of the wait depends on how often or quickly the thing could happen. If you were writing code to see if the player is jumping, you would need a short wait, but if you were checking to see if they have completed a mission, it can be a longer wait as they will have still completed is several seconds later, $default_wait_time is a standard variable with a preset time in.

The final thing they need is a bit at the end to loop back to the beginning to re-run the code and re-check. This tends to also be in its own label so you can jump to it if a condition is not met.

CODE
:Labelmy3rdlabel
0002: jump ££Labelmy2ndlabel


Note the jump to ££Labelmy2ndlabel, this is because we don't need to re-re-name the thread.

5. My 1st Thread

In section 4, we have already established how to run a thread, and all the esentials needed for it, so now we can start constructing our own thread. We will use the pink marker created in the last part and the truck to create a thread to only spawn the truck after you have stepped in the pink marker.

First we will need to stop the truck spawning in the first place, but we still need it to be defined, so go to the part of the code where your truck is, i.e. this bit

CODE
014B:  $my1stcar = init_parked_car_generator #PACKER -1? -1?  0? alarm  0? door_lock  0?  0?  10000& at 470.9084! -121.0596! 10.36153! angle  0!
014C: set_parked_car_generator  $my1stcar cars_to_generate_to  101?


and change the 101 at the end to just 0.

CODE
014C: set_parked_car_generator  $my1stcar cars_to_generate_to  0?


Now if you placed your marker at the same place as me (over-looking the truck from a distance), then the co-ordinates for your blob should be:

556.2355! -3.073752! 14.3036!

, if not just use your instead.

We already have th start of our thread, with :Labelmy2ndlabel being the main part, but we need to make it check that the player is near the pink blob. There are alot of OpCodes which will check where a player is, so go to search and search for 'near' (or use F1) we want the player to be on foot when doing it, not in a car, so keep going until you find this line.

CODE
00F6:   player $PLAYER_CHAR  0? ()near point on foot  1812??  1816??  1820?? radius  1.4!  1.8!  1.5!


It is using a variable to define the co-ordinates, so change these to ours, we can also tell that this is an if statement check by the indent, which most of them have (if you aren't sure which is which, look in the OpCodes list file which has a complete list of all the OpCodes and what sort they are).

CODE
00F6:   player $PLAYER_CHAR  0? ()near_point_on_foot  556.2355! -3.073752! 14.3036! radius  1.4!  1.8!  1.5!


You can leave the radius as it is, this just says how close to the point you need to be. Now put this in an if statement with a jump_if_false to my3rdlabel, and you will have your first check (if 0? as there is only one condition).:

CODE
00D6: if  0?
00F6:   player $PLAYER_CHAR  0? ()near_point_on_foot  556.2355! -3.073752! 14.3036! radius  1.4!  1.8!  1.5!
004D: jump_if_false ££Labelmy3rdlabel


Now we know when the player is in our blob, we need to do something with that fact, as in, make the truck spawn. This is very easy, just copy the 014C opCode line you edited earlier, paste it under the if statement, then change the number back to 101. If you have done all this, you should have code something like this:

CODE
:Labelmy1stlabel
03A4: name_thread "my1stth"

:Labelmy2ndlabel
0001:wait $default_wait_time ms
00D6: if  0?
00F6:   player $PLAYER_CHAR  0? ()near_point_on_foot  556.2355! -3.073752! 14.3036! radius  1.4!  1.8!  1.5!
004D: jump_if_false ££Labelmy3rdlabel
014C: set_parked_car_generator  $my1stcar cars_to_generate_to  101?

:Labelmy3rdlabel
0002: jump ££Labelmy2ndlabel


If we compile and run this it will work.

Before:

user posted image

After:

user posted image

Unfortunately, as you can see here:

user posted image

, the marker is still there (and active) so everytime you go there again, you can still see it and it will continue to turn on the truck, even though it is already there. The easiest way to counter this is to set a variable that says it has already been done, then disable the markers. All the markers use the same command to disable them:

CODE
0164: disable_marker  264??


(after search). There are 2 markers in our code, $my1stblob and $my2ndblob, the pink marker and the radar marker, so copy the line twice and replace the variables with our variables.

CODE
0164: disable_marker  $my1stblob
0164: disable_marker  $my2ndblob


Put this with the set_parked_car_generator line, and it will turn off the markers at the same time as it turns on your car.

user posted image

Your first thread is now basically complete, you can leave it as that, or you can add, as mentioned before, a variable so that it doesn't keep doing things it has already done. This is another important OpCode, 0004.

CODE
0004:  $my1stvar =  1?  \\ integer values


Put this with the other parts done after the if statement and when you stand in the circle, it will set your variable to 1, which is all well and good, but you need the code to know that it is 1. Using the if statement, change the value to 1, for 2 conditions, then add a new line to check if $my1stvar is 0 (1 means it has already been done and will skip the bits being done). However, this time, I'm not going to tell you the OpCode, you can look it up yourself, but I will tell you you are looking for
CODE
==  0?


Practice activites:

1. Place a pink marker and a radar marker in the middle door of the large building next door to 3321 Vice Point (the one with the armour next to it).

2. Make a thread and get it to run with a delay of 500ms.

3. Add an if statement to check whether the player is within a radius of 4! 4! 4!, in a car, of it (don't add a section to check if you have done it before).

4. Use OpCode 00BC, and text "TAX2_4" to print a message to the screen when you are there.

5. Add to the if statement so the text will only appear if you are driving a Boxville (you may want to spawn one somewhere for ease of access).

Thats it for this Part, I don't know what to do for the next yet, but if I think of anything, or someone gives me a good idea, then I will do another. So again, please comment below.

Painkiller
  • Painkiller

    Player Hater

  • Members
  • Joined: 09 Jul 2004

#28

Posted 13 July 2004 - 01:42 AM

Can someone give me a link to a document explaining the GTA Vice SCM file format layout or is the format the same as it was in GTA3?

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#29

Posted 13 July 2004 - 04:51 AM

Not bad Y_Less. I know when I first started coding for GTA, the hardest concepts for me was the whole multiple thread thing. I don't believe I've programmed in a mutli-thread environment before. Those who aren't aware, should also note that it's not true multi-threading, but rather time-slicing. So when you encounter a wait in a thread (even a wait 0), the engine goes off to process the next thread in line.

Painkiller
  • Painkiller

    Player Hater

  • Members
  • Joined: 09 Jul 2004

#30

Posted 13 July 2004 - 05:36 PM

Ok, I have looked over both the GTA3 and Vice SCM files and they seem to follow the same format. The problem I am having now is the Segement 3 (thread). This is what I know so far:
Jump code to Code segment
Null byte
4 byte offset to intro thread
4 byte - ???
4 byte - # of threads
thread pointers

What are the 4 bytes after intro thread offset for? If someone can explain it for me that would be great. sigh.gif




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users