Jump to content

GTA:SA Opcodes


Opius

Recommended Posts

Alright, I think you know what to do with this: Post opcodes and descriptions so we know what they do.

 

 

038F: REQUEST_AND_LOAD_2D_IMAGE "%2" as %1%2 = string, %1 = int0873: RELEASE_2D_IMAGE %1%1 = int

 

Used to load and release the 2D menu items used in things like the schools, gambling minigames, etc. As to how they're used once loaded, I'm not sure.

Link to comment
Share on other sites

Here are some very useless opcodes (and they are actualy unused in the script):

 

0A49:   false0A4D:   false

 

 

And also, opcode 0914: init_external_script actually does absolutely nothing. It just reads the index of external script and discards it. I guess it was PS2 specific.

Edited by Hammer83
Link to comment
Share on other sites

Craig Kostelecky

 

09C7: change_player_skin $PLAYER_CHAR to 105

 

This was in the PS2 version (for the 2 player mode) but removed from the PC version. But it still works on the PC. The 2nd parameter is the peds.ide ID number. Putting this in the beginning of the code will make CJ a Grove St gang member. I don't know how eating or working out will affect this skin though.

 

EDIT: A test of this in action:

user posted image

 

EDIT2: I've been getting a lot of bugs with this opcode. Here's how the same code looked the next time I started the game:

user posted image

 

Edited by Craig Kostelecky
Link to comment
Share on other sites

As it is correct? confused.gif

 

 

(scm_sa.ini  GTA:SA Mission Editing Tools)04c1=6,06E2=5,09E9=3,0A3D=4,088E=3,

 

or

 

(sascm.ini  BW's GTA SA Mission Builder version v0.33)04c1=0,06E2=4,%1d% %2d% %3h% %4d%09E9=1,%1d%0A3D=1,%1h%088E=0,

 

Link to comment
Share on other sites

...

 

I'm not sure what you're posting. All those opcodes already have an entry in Barton's SASCM.ini file along with the number of arguments. We're looking for descriptions of each opcode.

Link to comment
Share on other sites

 

05DB: set_actor $actor to_run_from_actor  $actor radius 50.0 distance?  3000

 

 

did some testing, im not 100% on radius/distance, although in the main.scm they use 100000 / 3000 / -1 / -2

when its -1, the actor barely moves, -2 is a few feet, but when its like 3000 he runs forever. But basically it seems like a 'scare' flag.

 

I'll post more as i go through them.

 

-jax

Link to comment
Share on other sites

capushon; second set is correct (although the ini with sadisasm seems to have 04c1/088e correct already, so i'm not sure where you got those from).

Link to comment
Share on other sites

This is little off-topic, but how can you run San Andreas in a window, Craig Kostelecky?

Link to comment
Share on other sites

Craig Kostelecky
This is little off-topic, but how can you run San Andreas in a window, Craig Kostelecky?

Check out GTAGarage. There's a window mode/coordinates mod made by Smithers (along with many other mods)

Link to comment
Share on other sites

Is there an opcode to add nitro ability like the mod garages do? I mean, I know you could code it the same as with Vice City setting the car speed manually, but I was wondering if it can be done this way.

 

Link to comment
Share on other sites

This is little off-topic, but how can you run San Andreas in a window, Craig Kostelecky?

Check out GTAGarage. There's a window mode/coordinates mod made by Smithers (along with many other mods)

Thanks!

Link to comment
Share on other sites

 

05E2: $Actor1 kill_actor $Actor2

 

the new method of hate flags.^

 

05CB: $Actor1 enter_car $car -1

;; -1 makes the actor walk to the car and enter it / 1 teleports the actor in the car instantly.^

 

 

-jax

Link to comment
Share on other sites

For those who wan tto mess with car mods, check out these ops...

 

 

06E9: request_car_component #WHEEL_OR1 86EA:   NOT   car_component_available #WHEEL_OR1 06E7: $10420 = add_car_component $10415 to_car $10431 06EB: release_car_component $10415 

 

 

I just noticed those in the code. The component names are in data\maps\veh_mods\veh_mods.ide

 

There should be an op somewhere to check if a car has a component, but I haven't found one yet. Also, wasn't there somewhere you could get a chopper with a magnet hanging from it? Maybe that's a component too?

 

Edited by Viper187
Link to comment
Share on other sites

nah, the magnet is hardcoded. but you can still reactivate it for the chopper of your choice:

 

0788: enable_heli $yourheli magnet  1

 

bah, y_less beat me tounge.gif

 

i think i found the code to attach one vehicle to another as well..

 

0683: $car1 $car2  0.0 -4.6  .65  15.0  0.0  0.0

 

car1 gets attatched to car2

 

full code from scm:

 

00A5: @188 = create_car #PACKER at  1550.873 -1737.122  14.1055

09C4: @188  0

0175: set_car @188 z_angle_to  245.14

0129: @197 = create_actor  24 #MAFFA in_car @188 driverseat

054A: unknown_actor @197 flag  0

02AC: set_car @188 immunities  1  1  1  1  1

02AB: set_actor @197 immunities  1  1  1  1  1

060B: unknown_actor_use_entity @197 @35

01C8: @198 = create_actor  24 #MAFFA in_car @188 passenger_seat  0

01B2: give_actor @198 weapon  28 ammo  99999  ;; Load the weapon model before using this

060B: unknown_actor_use_entity @198 @35

00A5: @208 = create_car #SULTAN at  1550.873 -1737.122 -14.1055

09C4: @208  0

0175: set_car @208 z_angle_to  256.415

02AC: set_car @208 immunities  1  1  1  1  1

0683: @208 @188  0.0 -4.6  .65  15.0  0.0  0.0

 

edit, yep, thats it. interestingly if you try to drive a vehicle thats attachted to another ( a car attachted to a flatbed) you can start the engine and spin the wheels, the vehicle simply wont move.

Link to comment
Share on other sites

I'm sorry to interupt with such a newbish question, but I'm just not sure...

 

Am I to understand that the engines use the same opcodes? Of course Vice wouldn't use SA opcodes, but in comparing the database with my PEDS code, everything matches up. Does this mean that with a few IDE reference changes (ped and car selection) that I could just drop this script into SA Builder and compile it and do PEDS from SA?

 

If this is the case, I'll play with the animation states, since I use those the most...

 

And this explaination:

 

 

011C:  clear_actor_objective P: $actorID- how to explain... like taking a rope away from a person... (?)

 

 

just bugs me. This opcode resets the actor for a new task. For example, if I have a ped running, unless I invoke this after an animation:

 

 

011C: actor $Grp1Ped1 clear_objective

 

 

The ped will just do the animation and keep on running. This has been tested and works with the walk and run codes in Vice. (handy if your stupid peds run in the wrong direction)

Link to comment
Share on other sites

 

For those who wan tto mess with car mods, check out these ops...

Does anyone have an idea how multiple car textures are handled? The uranus for example has an uranus.txd, but also uranus1.txd, uranus2.txd and uranus3.txd (with additional body textures) which are not defined in any ide or (apparently) the main.scm. Don't tell me this is hardcoded... ph34r.gif

Link to comment
Share on other sites

nah, the magnet is hardcoded. but you can still reactivate it for the chopper of your choice:

 

0788: enable_heli $yourheli magnet  1

 

bah, y_less beat me tounge.gif

 

Hehe tounge.gif

 

 

i think i found the code to attach one vehicle to another as well..

 

0683: $car1 $car2  0.0 -4.6  .65  15.0  0.0  0.0

 

car1 gets attatched to car2

 

 

Im guessing its:

 

 

0683: attatch $car1 to $car2 at $xoffset $yoffset $zoffset rotation $xrot $yrot $zrot

 

 

yes?

 

Also, a bit offtopic, but who was it who discovered how to merge cars in VC, I remember hearing about it, but never found any info.

Link to comment
Share on other sites

Does anyone have an idea how multiple car textures are handled? The uranus for example has an uranus.txd, but also uranus1.txd, uranus2.txd and uranus3.txd (with additional body textures) which are not defined in any ide or (apparently) the main.scm. Don't tell me this is hardcoded... ph34r.gif

I believe it would just append '1', '2', etc to the TXD name given in vehicles.ide for that vehicle.

 

There was an old topic when the PS2 version was out where I believe I found the opcode that swaps textures. I'll try to dig it up.

 

Hopefully.

 

HOPEFULLY.

Link to comment
Share on other sites

Well, the database prune makes this fun. confused.gif

 

Dug it up on my own. Very strange usage.

 

06ED: $carid 0 

 

The integer at the end detirmines what TXD is used.

 

Basically, just subtract 1 from the TXD name for the last number.

 

NOTE YOU DO NOT HAVE TO REQUEST THIS TXD

 

Example: If you want to use the skin 'elegy2.txd' on your created Elegy, use this code.

 

06ED: $carid 1 

 

 

Example: If you want to use the skin 'elegy3.txd' on your created Elegy, use this code.

 

06ED: $carid 2 

 

 

However, I'm not sure whether these alternative skins are hardcoded, or whether it can just goes

I'll use "CARNAME""INT".txd for this car

 

 

[EDIT]Sample code and screenshot!

 

:opius_testloop22221110247: request_model #elegy:opius_testloop22221120001: wait  0 ms00D6: if  00248:   model #elegy available004D: jump_if_false ££opius_testloop222211204C4: create_coordinate $uniquevar0000 $uniquevar0001 $uniquevar0002 from_actor $player_actor offset  0.0  10.0  1.000A5: $uniquevar0003 = create_car #elegy at  $uniquevar0000 $uniquevar0001 $uniquevar000206ED: $uniquevar0003 0 04C4: create_coordinate $uniquevar0000 $uniquevar0001 $uniquevar0002 from_actor $player_actor offset  5.0  10.0  1.000A5: $uniquevar0004 = create_car #elegy at  $uniquevar0000 $uniquevar0001 $uniquevar000206ED: $uniquevar0004 1 04C4: create_coordinate $uniquevar0000 $uniquevar0001 $uniquevar0002 from_actor $player_actor offset  -5.0  10.0  1.000A5: $uniquevar0005 = create_car #elegy at  $uniquevar0000 $uniquevar0001 $uniquevar000206ED: $uniquevar0005 2 0249: release_model #elegy

user posted image

 

[EDIT 2]

Anything beyond a certain value (5, confirmed) causes the game to use another seemingly random texture. Note that it also applies alpha transparency, which is what's happening in the second image.

user posted image

Left: elegy99.txd Right: elegy9.txd

Thanks for persuading me to try that out, Dexx. biggrin.gif

 

[EDIT 3]The most alternate skins you can have per car is 5. Anything past that and they either don't load (so you get a normal body colour) or it applies a random texture.

 

NOTE: Probably only works on cars/trucks. Tried it on a bike and it didn't work. Haven't tried aircraft/boats though.

Link to comment
Share on other sites

Dug it up on my own. Very strange usage.

 

06ED: $carid 0 

 

The integer at the end detirmines what TXD is used.

why is this strange usage? it just tells the game use the Nth texture, so i guess it looks for elegy*.txd (or elegy%d.txd, N+2).

does this work on cars that originally only have 1 texture? (i guess we can only try that once a working txd editor pops up).

about the bikes, i don't think this would work even if there would be multiple txds for it, since the textures you've shown on the elegy are the painjobs you can add to it at Wheel Arch Angels, and bikes weren't supposed to be modded like that. but i'm just guessing, we'll have to wait for a txd editor for this, too..

Link to comment
Share on other sites

Dunno if this was posted, but...

 

 

09E1: @6 @29 

 

 

@29 = car model @6 monetary value

 

 

BTW, can anyone explian the init_jump_table opcode (0871)?

 

0871: init_jump_table @4 total_jumps 3 0 ££IMPEXPM_1032 jumps 10 ££IMPEXPM_1025 20 ££IMPEXPM_1027 30

££IMPEXPM_1029 -1 ££IMPEXPM_1032 -1 ££IMPEXPM_1032 -1 ££IMPEXPM_1032 -1 ££IMPEXPM_1032

 

Is it like a switch statement? if @4 is 0 it jumps to IMPEXPM_1032, 10 makes it jump to IMPEXPM_1025 , and so on? But why the 4 "-1 ££IMPEXPM_1032" arguments?

Link to comment
Share on other sites

why is this strange usage?

Because with other opcodes that directly reference outside files, you don't need to add or subtract to get the 'real' values. Just pointing it out.

 

As for jump tables and -1, there has to be a set amount of jumps in the table, so any they don't use they just set to -1, which would never be used.

Link to comment
Share on other sites

Standard main.scm. Bug in OPR ?

Where if ???

; ------------------------------------------------------------

:SCRASH2_49

06D8: @84(@48,3i) = create_train_at 0.0 0.0 0.0 track 10 unknown 0

000A: @48 += 1 ;; integer values

0029: @48 >= 3 ;; integer values

004D: jump_if_false ЈSCRASH2_49

009A: @78 = create_ACTOR 4 #WMYBU at 0.0 0.0 0.0

009A: @79 = create_ACTOR 4 #BMYBE at 0.0 0.0 0.0

; ------------------------------------------------------------

:CRASH1_73

009A: @87(@213,5i) = create_ACTOR 14 #LSV3 at 0.0 0.0 0.0

000A: @213 += 1 ;; integer values

0029: @213 >= 5 ;; integer values

004D: jump_if_false ЈCRASH1_73

0006: @213 = 0 ;; integer values

; ------------------------------------------------------------

 

Link to comment
Share on other sites

BTW, can anyone explian the init_jump_table opcode (0871)?

 

0871: init_jump_table @4 total_jumps 3 0 ££IMPEXPM_1032 jumps 10 ££IMPEXPM_1025 20 ££IMPEXPM_1027 30

££IMPEXPM_1029 -1 ££IMPEXPM_1032 -1 ££IMPEXPM_1032 -1 ££IMPEXPM_1032 -1 ££IMPEXPM_1032

 

Is it like a switch statement? if @4 is 0 it jumps to IMPEXPM_1032, 10 makes it jump to IMPEXPM_1025 , and so on? But why the 4 "-1 ££IMPEXPM_1032" arguments?

yes, This is the MB equivalent of a switch statement

 

The line you given corresponds with this switch-statement:

 

switch( @4 ) {case 10:   jump ££IMPEXPM_1025case 20:   jump ££IMPEXPM_1027case 30:   jump ££IMPEXPM_1029}

 

 

The rest of the params are filled with label -1, to indicate that they are not used ( but the opcode does always require the same amount of params.

 

param 1 : @4 = switch variable

param 2 : 3 = number of labels

param 3 : 0 = default present flag ( in this case, no default)

param 4 : ££IMPEXPM_1032 = jumpaddress for default case ( not used here)

param 5 : 10 = caselabel1

param 6 : ££IMPEXPM_1025 =casejumpaddress1

param 7 : caselabel2

param 8 : casejumpaddress2

param 9 : caselabel3

param 10 : casejumpaddress3

param 11 : caselabel4

param 12 : casejumpaddress4

param 13 : caselabel5

param 14 : casejumpaddress5

param 15 : caselabel6

param 16 : casejumpaddress6

param 17 : caselabel7

param 18 : casejumpaddress7

 

if you need a switch with more than 7 cases, you should give the total number of cases in the second param, and follow the 0871 opcode, with one or more 0872 opcode, which should hold the additional caselabels and casejumpaddresses.

 

 

 

And here are some new opcodes I found while studying the CARMOD scm code:

 

0988=2,%2d% = get_car %1d% paintjob06ed=2,set_car %1d% paintjob %2d%09b3=2,%2d% = get_car %2d% doorstatus

 

Link to comment
Share on other sites

 

why is this strange usage?

Because with other opcodes that directly reference outside files, you don't need to add or subtract to get the 'real' values. Just pointing it out.

"real" values? smile.gif i guess the game doesn't look at the '2' appended to the txd's name, simply gives each matching texture an index, obviously starting from 0. that's why i don't think it's strange. smile.gif

 

anyway i'll stop talking about SA coding and try to actually do something. smile.gif i f*cked around a bit with coding in LC, released a working mod bundle (written and released 4 mods in the same main.scm: speed & forward gravity meter, 0-100 acceleration timer, realistic crashes, and working car shop) in VC, and i'm about to have a lot of fun in SA... smile.gif

 

off-topic: for VC coding, i used Giddy (by Rick) because that way i didn't have to remember both the opcodes and their text parts (which is silly, why include the opcodes in the source code if the compiler can already identify them by the textual "commands"), is there anything like that for SA or will i have to get used to Barton's editor? smile.gif

Edited by GodGell
Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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