IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


Pages: (6) 1 [2] 3 4 ... Last »  ( Go to first unread post ) Closed TopicStart new topicStart Poll

 Tutorial Links and Mission Coding Information

 some links if you want to learn coding
 
Demarest  
Posted: Tuesday, Jun 22 2004, 14:19
Quote Post


what could be
Group Icon
Group: BUSTED!
Joined: Jul 12, 2003

XXXXX



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.
Users WebsitePMAOL
  Top
 

 
Y_Less  
Posted: Tuesday, Jun 22 2004, 14:34
Quote Post


629
Group Icon
Group: Members
Joined: Mar 14, 2004

en.gif

Member Award




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).
Users WebsitePM
  Top
 

 
Demarest  
Posted: Tuesday, Jun 22 2004, 14:46
Quote Post


what could be
Group Icon
Group: BUSTED!
Joined: Jul 12, 2003

XXXXX



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

 
brokenfish  
Posted: Wednesday, Jun 23 2004, 02:57
Quote Post


Homie
Group Icon
Group: Members
Joined: Jul 11, 2003

us.gif

XXXXX



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
PM
  Top
 

 
Y_Less  
Posted: Tuesday, Jun 29 2004, 10:26
Quote Post


629
Group Icon
Group: Members
Joined: Mar 14, 2004

en.gif

Member Award




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.
Users WebsitePM
  Top
 

 
Craig Kostelecky  
Posted: Thursday, Jul 8 2004, 05:34
Quote Post


GTA:LC Team Leader
Group Icon
Group: The Connection
Joined: Jan 28, 2004

us.gif

Member Award




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.
Users WebsitePMAOLYahooICQ
  Top
 

 
Y_Less  
Posted: Friday, Jul 9 2004, 08:10
Quote Post


629
Group Icon
Group: Members
Joined: Mar 14, 2004

en.gif

Member Award




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.

This post has been edited by Y_Less on Friday, Jul 9 2004, 08:12
Users WebsitePM
  Top
 

 
Painkiller  
Posted: Tuesday, Jul 13 2004, 01:42
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jul 9, 2004

XXXXX



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?
PM
  Top
 

 
Demarest  
Posted: Tuesday, Jul 13 2004, 04:51
Quote Post


what could be
Group Icon
Group: BUSTED!
Joined: Jul 12, 2003

XXXXX



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.
Users WebsitePMAOL
  Top
 

 
Painkiller  
Posted: Tuesday, Jul 13 2004, 17:36
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jul 9, 2004

XXXXX



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
PM
  Top
 

 
Painkiller  
Posted: Wednesday, Jul 14 2004, 15:28
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jul 9, 2004

XXXXX



Well I still can't understand what those 4 bytes after offset to intro thread are for. Anyone know what it's for? confused.gif
PM
  Top
 

 
Craig Kostelecky  
Posted: Wednesday, Jul 14 2004, 20:31
Quote Post


GTA:LC Team Leader
Group Icon
Group: The Connection
Joined: Jan 28, 2004

us.gif

Member Award




To understand the differences between the engines, you may want to look at the GTA:LC code and compare it to the GTA3 code. That way, you're looking at the same information, in a slightly different presentation.
Users WebsitePMAOLYahooICQ
  Top
 

 
Painkiller  
Posted: Thursday, Jul 15 2004, 02:00
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jul 9, 2004

XXXXX



I noticed that the opcodes are not the same. But the SCM file layout looks the same.
PM
  Top
 

 
Demarest  
Posted: Thursday, Jul 15 2004, 09:12
Quote Post


what could be
Group Icon
Group: BUSTED!
Joined: Jul 12, 2003

XXXXX



It is. You may have to ask CyQ. He's one of the few people that understand SCM at that level.
Users WebsitePMAOL
  Top
 

 
Y_Less  
Posted: Thursday, Jul 15 2004, 13:22
Quote Post


629
Group Icon
Group: Members
Joined: Mar 14, 2004

en.gif

Member Award




QUOTE
Not bad Y_Less.


Ooh, praise from the great Demarest, me is honoured.

I have a few ideas for the next one, but suggestions will be greatly appreciated (e.g. areas to look into from more experienced coders).
Users WebsitePM
  Top
 

 
Prikki  
Posted: Monday, Jul 19 2004, 13:22
Quote Post


Crackhead
Group Icon
Group: Members
Joined: Apr 5, 2004

XXXXX



Is it possible to delet an exsiting mission?
Users WebsitePMICQ
  Top
 

 
Demarest  
Posted: Monday, Jul 19 2004, 14:03
Quote Post


what could be
Group Icon
Group: BUSTED!
Joined: Jul 12, 2003

XXXXX



QUOTE (Prikki @ Jul 19 2004, 08:22)
Is it possible to delet an exsiting mission?

Yes. But remember than most any changes to the code will mean a need to restart.
Users WebsitePMAOL
  Top
 

 
PatrickW  
Posted: Friday, Aug 13 2004, 23:08
Quote Post


GTA Juggernaut
Group Icon
Group: Moderators
Joined: Jan 7, 2004

nl.gif

Member Award




For all the ppl who are having trouble to find the correct constants for some of the opcodes, here's a file containing a lot of them. Then file is generated, if you disassemble your main.scm with GTAMA. But the values for MB are offcourse the same wink.gif
All credits for this info go to the great CyQ...
CODE
; Standard include file generated by VCDisAsm v1.6 (C) CyQ, 2003

; Boolean
#define False 0
#define True 1

; Zone info
#define znNight 0
#define znDay 1

; Fade
#define fdOut 0
#define fdIn 1

; Timer
#define tmCountUp 0
#define tmCountDown 1

; Pedtypes
#define ptPlayer1 0
#define ptPlayer2 1
#define ptPlayer3 2
#define ptPlayer4 3
#define ptCivMale 4
#define ptCivFemale 5
#define ptCop 6
#define ptGang1 7
#define ptGang2 8
#define ptGang3 9
#define ptGang4 10
#define ptGang5 11
#define ptGang6 12
#define ptGang7 13
#define ptGang8 14
#define ptGang9 15
#define ptEmergency 16
#define ptFireman 17
#define ptCriminal 18
#define ptSpecial 19

; Threats
#define thPlayer1 1
#define thPlayer2 2
#define thPlayer3 4
#define thPlayer4 8
#define thCivMale 16
#define thCivFemale 32
#define thCop 64
#define thGang1 128
#define thGang2 256
#define thGang3 512
#define thGang4 1024
#define thGang5 2048
#define thGang6 4096
#define thGang7 8192
#define thGang8 16384
#define thGang9 32768
#define thEmergency 65536
#define thFireman 16777216
#define thCriminal 262144
#define thSpecial 524288
#define thGun 1048576
#define thCopCar 2097152
#define thFastCar 4194304
#define thExplosion 8388608
#define thProstitute 131072
#define thDeadPeds 33554432

; Icons
#define icDot 0
#define icCentre 1
#define icArrow 2
#define icNorth 3
#define icAvery 4
#define icBiker 5
#define icCortez 6
#define icDiaz 7
#define icKent 8
#define icLawyer 9
#define icPhil 10
#define icBikers 11
#define icBoatyards 12
#define icClub 13
#define icCubans 14
#define icFilmstudio 15
#define icGun 16
#define icHaitians 17
#define icHardware 18
#define icSave 19
#define icStrip 20
#define icIcecream 21
#define icKCabs 22
#define icLoveFist 23
#define icPrintWorks 24
#define icProperty 25
#define icSunyard 26
#define icSpray 27
#define icTShirt 28
#define icTommy 29
#define icPhone 30
#define icRWildstyle 31
#define icRFlash 32
#define icRKChat 33
#define icRFever 34
#define icRVRock 35
#define icRVCPR 36
#define icREspantoso 37
#define icREmotion 38
#define icRWave 39

; Keys
#define kPedTurnLeftRight 2
#define kVehicleLookLeftRight 2
#define kVehicleTurretLeftRight 2
#define kPedLookLeftRight 3
#define kVehicleTurretUpDown 3
#define kPedAnswerPhone 4
#define kVehicleChangeRadioStation 4
#define kPedCycleWeaponLeft 5
#define kVehicleLookLeft 5
#define kPedLockTarget 6
#define kVehicleHandbrake 6
#define kPedCycleWeaponRight 7
#define kVehicleLookRight 7
#define kGoForward 8
#define kGoBackward 9
#define kGoLeft 10
#define kGoRight 11
#define kExit 12
#define kCameraChangeViewAllSituations 13
#define kPedJumping 14
#define kVehicleBrake 14
#define kVehicleEnterExit 15
#define kPedSprint 16
#define kVehicleAccelerate 16
#define kPedFireWeapon 17
#define kPedDuck 18
#define kVehicleHorn 18
#define kPedLookBehind 19
#define kToggleSubmissions 19

; Weapons
#define wpUnarmed 0
#define wpBrassKnuckle 1
#define wpScrewDriver 2
#define wpGolfClub 3
#define wpNightStick 4
#define wpKnife 5
#define wpBaseballBat 6
#define wpHammer 7
#define wpCleaver 8
#define wpMachete 9
#define wpKatana 10
#define wpChainsaw 11
#define wpGrenade 12
#define wpDetonateGrenade 13
#define wpTearGas 14
#define wpMolotov 15
#define wpRocket 16
#define wpColt45 17
#define wpPython 18
#define wpShotgun 19
#define wpSpas12Shotgun 20
#define wpStubbyShotgun 21
#define wpTec9 22
#define wpUzi 23
#define wpSilencedIngram 24
#define wpMp5 25
#define wpM4 26
#define wpRuger 27
#define wpSniperRifle 28
#define wpLaserScope 29
#define wpRocketLauncher 30
#define wpFlameThrower 31
#define wpM60 32
#define wpMinigun 33
#define wpDetonator 34
#define wpHeliCannon 35
#define wpCamera 36

; Locations
#define lOutside 0
#define lHotel 1
#define lMansion 2
#define lBank 3
#define lMall 4
#define lStripclub 5
#define lLawyers 6
#define lCafeRobina 7
#define lConcertHall 8
#define lStudio 9
#define lShootingRange 10
#define lApartmentAndBikerbar 11
#define lVCPD 12
#define lStadium1 14
#define lStadium2 15
#define lStadium3 16
#define lClub 17
#define lPrintWorks 18

; Particles
#define prSpark 0
#define prSparkSmall 1
#define prWaterSpark 2
#define prWheelDirt 3
#define prSand 4
#define prWheelWater 5
#define prBlood 6
#define prBloodSmall 7
#define prBloodSpurt 8
#define prDebris 9
#define prDebris2 10
#define prFlyers 11
#define prWater 12
#define prFlame 13
#define prFireball 14
#define prGunFlash 15
#define prGunFlashNoAnim 16
#define prGunSmoke 17
#define prGunSmoke2 18
#define prCigaretteSmoke 19
#define prSmoke 20
#define prSmokeSlowMotion 21
#define prDryIce 22
#define prTeargas 23
#define prGaragePaintSpray 24
#define prShard 25
#define prSplash 26
#define prCarFlame 27
#define prSteam 28
#define prSteam2 29
#define prSteamNY 30
#define prSteamNYSlowMotion 31
#define prGroundSteam 32
#define prEngineSteam 33
#define prRaindrop 34
#define prRaindropSmall 35
#define prRainSplash 36
#define prRainSplashBigGrow 37
#define prRainSplashUp 38
#define prWaterSpray 39
#define prWaterDrop 40
#define prBloodDrop 41
#define prExplosionMedium 42
#define prExplosionLarge 43
#define prExplosionMFast 44
#define prExplosionLFast 45
#define prCarSplash 46
#define prBoatSplash 47
#define prBoatThrustJet 48
#define prWaterHydrant 49
#define prWaterCannon 50
#define prExtinguishSteam 51
#define prPedSplash 52
#define prPedFootDust 53
#define prCarDust 54
#define prHeliDust 55
#define prHeliAttack 56
#define prEngineSmoke 57
#define prEngineSmoke2 58
#define prCarFlameSmoke 59
#define prFireballSmoke 60
#define prPaintSmoke 61
#define prTreeLeaves 62
#define prCarCollisionDust 63
#define prCarDebris 64
#define prBirdDebris 65
#define prHeliDebris 66
#define prExhaustFumes 67
#define prRubberSmoke 68
#define prBurningRubberSmoke 69
#define prBulletHitSmoke 70
#define prGunShellFirst 71
#define prGunShell 72
#define prGunShellBump1 73
#define prGunShellBump2 74
#define prRocketSmoke 75
#define prTest 76
#define prBirdFront 77
#define prShipSide 78
#define prBeastie 79
#define prRaindrop_2d 80
#define prHeatHaze 81
#define prHeatHazeInDist 82

; Misc
#define zGround -100.0
#define Infinite 101


I hope CyQ won't mind me posting this here, or else I'll have to remove it sad.gif
Users WebsitePM
  Top
 

 
Y_Less  
Posted: Wednesday, Aug 18 2004, 19:39
Quote Post


629
Group Icon
Group: Members
Joined: Mar 14, 2004

en.gif

Member Award




He shouldn't do, you did fully quote it as his work.
Users WebsitePM
  Top
 

 
timmy2004  
Posted: Monday, Aug 30 2004, 07:22
Quote Post


Gangsta
Group Icon
Group: Members
Joined: Aug 5, 2004

au.gif

XXXXX



Welcome to my Vice City coding tutorial for beginners!

Tutorial 1

Ok, this tutorial is strictly for beginners. Before we start I hope that you have BW’s Mission builder Version 1.3 (MUST BE VERSION 1.3!!!!!!!!!!!!!!) (u will need it to code vice city).

In this tutorial I will show u how to place cars, health, weapons, and show you how to change the starting position of the player, etc. In the next tutorial (tutorial 2) these things will be explained more and you will learn how to place money, actors and markers. And by the end of it, you will know how to make a car spawn by pressing a button and a simple bodyguard mod.

Lesson one: Weapons
Ok, in BW’s mission builder, open up the file called main.scm in the vice city data folder
Then goto search, and search for this line:

CODE

032B: $471 = create_weapon_pickup #COLT45


as u can see, there are a whole lot of:

CODE

create_weapon_pickup


things, this is where all the weapons are placed in the game. But before u create your own weapon you must understand the code:

CODE

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


-the ‘032B’ part is called the opcode (this can be ignored at the moment)
-the ‘$471’ is what rockstar games decided to name this particular weapon (every thing that u create must have a name)
-the ‘create_weapon_pickup’ is what the code is telling the game to do
-the ‘#COLT45’ is the weapon that it is creating
-the ‘15’ is the type (this can be ignored at the moment)
-the ‘ammo 34’ is how much ammo the weapon has
-the ‘at -228.4 -1318.2 9.1’ are the coordinates that you want the weapon to be created

so to create your own weapon copy that piece of code that I just showed you and paste it under it’s self so that you have two of the same codes, you will soon modify this and make your own weapon.

-Ok, first of all give your new weapon a different name, like ‘$myweapon’ instead of ‘$471’
-Then change the ‘#COLT45’ part to another weapon that you like, e.g. ‘#UZI’. Here are some names of weapons that u can choose:
#UZI
#COLT45
#M60
#M4
#GRENADE
#TEC9
#SNIPER
there are just some of the weapons, (but don’t choose any melee weapon because they use a different opcode).
-Then change the ‘ammo 34’ part to whatever u want, like ‘ammo 999’
-Then change the coordinate part of the code to a coordinate of your choice. I have chosen: ‘at 402.428 -465.688 9.918’ (outside the Washington beach police station)
-If you want to get coordinates then download a coordinate reader, like ‘Player Pos’

So I ended up with a piece of code that looks like this:

CODE

032B: $myweapon = create_weapon_pickup #UZI  15 ammo  999 at  402.428 -465.688 9.918


you can now test it by going to: ‘Copy, Compile, Run GTA Vice’
BUT YOU MUST START A NEW GAME!!!!!!!!!!!!!!

It should work!



Lesson two: Pickups (health)

I hope u still have mission builder open.
Ok, search for the line:

CODE

0213: $495 = create_pickup -86


(you should see heaps of these lines)
the one u just searched for should look like this:

CODE

0213: $495 = create_pickup -86 (HEALTH) type  15 at -113.2 -975.7  10.4


as u can see it is much similar to the weapon placing we did in lesson one.
It has an opcode, a name, the thing that tells the game what to do, the pickup that we are placing, a type (type 1 is buyable health and type 15 is free (I think)), and the coordinates. I don’t think I need to explain in further detail.

So copy that line and paste it under its self

So just like before, change the name to whatever u want
then change the coordinates to whatever u want, I have chosen 206.666 -491.721 11.351 (outside the hardware store near the police station)

so now my code should look like this:

CODE

0213: $mypickup = create_pickup -86 (BRIBE) type  15 at  206.666 -491.721 11.351


Copy compile run
Start new game!



Lesson three: Cars

Cars are a bit more tricky (some parts of this I don’t even know what they are) , but you should be able to do it if you stick to this tutorial. But if at any time you get lost, just skip to the next lesson

Search for this line:


014B: $457 = init_parked_car_generator #ADMIRAL


the whole line should look like this:

CODE

014B: $457 = init_parked_car_generator #ADMIRAL  8  8  0 alarm  50 door_lock  0  0  10000 at -401.2715 -534.6655  11.7534 angle  149.2032


and it will have this line underneath it:


014C: set_parked_car_generator $457 cars_to_generate_to 101


lets take a look at this code:

CODE

014B: $457 = init_parked_car_generator #ADMIRAL  8  8  0 alarm  50 door_lock  0  0  10000 at -401.2715 -534.6655  11.7534 angle  149.2032

014C: set_parked_car_generator $457 cars_to_generate_to  101


it is a little similar to the other things we have been doing; it has an opcode, a name, a piece of code that tells the game what to do (init_parked_car_generator), it has what car we are creating (in this case it is an admiral), the ‘8 8’ is the color, I’m not sure what the ‘0’ before the alarm is, it also says ‘alarm 50’ this means that there is 50% chance that the alarm is on and ‘door_lock 0’ this means that there is 0% chance of a locked door, I don’t know what the other ‘0’ is for, but I think the 10000 is the cars health, and obviously the ‘at -401.2715 -534.6655 11.7534 angle 149.2032’ is the coordinates and the angle (angle 0 is facing north and angle 180 is facing south, it goes all the way up to angle 360).

The line after it, is a line that tells the car to acutely appear, it has an opcode, code that tells the game what to do (set_parked_car_generator), the $457 is the name of the car that you want to appear (101 is always appear and 0 is never appearing)

So to create your own car copy those lines and paste them underneath the ones you just copied. Then you need to edit the following to your standards:

You can edit the $457 to name that you want like; $car. Then you can change ‘#ADMIRAL’ to a much better car, here are some:
#banshee
#hotring
#PCJ600
#POLICE
Then you can change the 8 8 to another color, just choose 0 0 (it means random color). Change the door lock and alarm to 0 and 0 (so that we can actually get in the car). Leave the other zero alone and leave the 10000 alone too. Change the coordinates to what ever you want and change the angle to what ever you want. I have chosen;

With the next line, just change the $457 to what ever you called the car. But leave the rest

So my code should look like this

CODE

014B: $car = init_parked_car_generator #PCJ600  0  0  0 alarm  0 door_lock  0  0  10000 at -401.2715 -534.6655  11.7534 angle  149.2032
014C: set_parked_car_generator $car cars_to_generate_to  101


copy, compile, run
and start a new game



Lesson 4: Changing the players starting position, (this is easy)

Search for this line:

CODE

0053: $PLAYER_CHAR = create_player #NULL at


This line creates the player; it should be near the top.
The coordinintas after it tell the player where to start the game. I have chosen; -369.9 -537.1 18.3 (near the hard ware store, next to the health that we placed earlier)

Compile copy run (like always)

That’s it just start a new game

This is the end of tutorial 1

For questions or comments me email me at: eetmorechikin2003@hotmail.com
Or visit my web site at http://tubbytim.tripod.com
PMMSN
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Pages: (6) 1 [2] 3 4 ... Last »

Topic Options Closed TopicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG