Quantcast

Jump to content

» «
Photo

GTA:SA Opcodes

874 replies to this topic
Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#1

Posted 11 June 2005 - 04:11 PM

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

CODE
038F: REQUEST_AND_LOAD_2D_IMAGE "%2" as %1
%2 = string, %1 = int
0873: 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.

Hammer83
  • Hammer83

    Hustler

  • Members
  • Joined: 11 Jan 2003

#2

Posted 11 June 2005 - 09:03 PM Edited by Hammer83, 11 June 2005 - 09:57 PM.

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

0A49:   false
0A4D:   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.

GodGell
  • GodGell

    shlurp my burger, sir

  • Members
  • Joined: 31 Oct 2003

#3

Posted 12 June 2005 - 04:05 AM

if you find new opcodes, please post them to http://sa-db.webtools4you.net/
it's the sa-version of TbM2k's vice city opcode database. it isn't fully up yet, but you can already add opcodes as far as i know.

Craig Kostelecky
  • Craig Kostelecky

    GTA:LC Team Leader

  • The Connection
  • Joined: 28 Jan 2004

#4

Posted 13 June 2005 - 12:50 AM Edited by Craig Kostelecky, 13 June 2005 - 01:32 AM.

CODE
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

Capushon
  • Capushon

    Player Hater

  • Members
  • Joined: 19 Apr 2003

#5

Posted 15 June 2005 - 12:01 AM

As it is correct? confused.gif

CODE

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

or
CODE

(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,

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#6

Posted 15 June 2005 - 07:18 AM

...

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.

jax
  • jax

    Moof!

  • Members
  • Joined: 20 Jan 2004

#7

Posted 15 June 2005 - 12:14 PM

CODE
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

Un3462
  • Un3462

    Mack Pimp

  • Members
  • Joined: 27 Jun 2002

#8

Posted 15 June 2005 - 01:00 PM

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

MiiKKiZ
  • MiiKKiZ

    Player Hater

  • Members
  • Joined: 09 Jun 2005

#9

Posted 15 June 2005 - 09:08 PM

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

jax
  • jax

    Moof!

  • Members
  • Joined: 20 Jan 2004

#10

Posted 16 June 2005 - 02:40 AM

CODE
05BE: kill_actor $PLAYER_ACTOR


obvious what this one does smile.gif

-jax

Craig Kostelecky
  • Craig Kostelecky

    GTA:LC Team Leader

  • The Connection
  • Joined: 28 Jan 2004

#11

Posted 16 June 2005 - 04:10 AM

QUOTE (MiiKKiZ @ Jun 15 2005, 16:08)
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)

Viper187
  • Viper187

    Crazy Snake

  • Members
  • Joined: 17 Oct 2002

#12

Posted 16 June 2005 - 05:40 AM

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.

MiiKKiZ
  • MiiKKiZ

    Player Hater

  • Members
  • Joined: 09 Jun 2005

#13

Posted 16 June 2005 - 07:20 PM

QUOTE (Craig Kostelecky @ Jun 16 2005, 04:10)
QUOTE (MiiKKiZ @ Jun 15 2005, 16:08)
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!

jax
  • jax

    Moof!

  • Members
  • Joined: 20 Jan 2004

#14

Posted 20 June 2005 - 11:20 AM

CODE
05E2: $Actor1 kill_actor $Actor2

the new method of hate flags.^
CODE
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

Viper187
  • Viper187

    Crazy Snake

  • Members
  • Joined: 17 Oct 2002

#15

Posted 20 June 2005 - 06:48 PM Edited by Viper187, 20 June 2005 - 07:01 PM.

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

CODE

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?

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#16

Posted 20 June 2005 - 09:27 PM

CODE
0788: enable_heli $MAGNET_HELI magnet  1;; Turn it on


No its not.

DexX
  • DexX

    Black Hat

  • Feroci Racing
  • Joined: 16 May 2002

#17

Posted 20 June 2005 - 09:29 PM

nah, the magnet is hardcoded. but you can still reactivate it for the chopper of your choice:
CODE
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..
CODE
0683: $car1 $car2  0.0 -4.6  .65  15.0  0.0  0.0

car1 gets attatched to car2

full code from scm:
QUOTE
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.

ceedj
  • ceedj

    PEDS Creator

  • Feroci Racing
  • Joined: 21 May 2005

#18

Posted 21 June 2005 - 03:24 AM

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:

CODE

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:

CODE

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)

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#19

Posted 21 June 2005 - 05:15 PM

QUOTE (Viper187 @ Jun 20 2005, 20:48)
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

Y_Less
  • Y_Less

    629

  • Members
  • Joined: 14 Mar 2004

#20

Posted 21 June 2005 - 09:53 PM

QUOTE (ashdexx @ Jun 20 2005, 21:29)
nah, the magnet is hardcoded. but you can still reactivate it for the chopper of your choice:
CODE
0788: enable_heli $yourheli magnet  1

bah, y_less beat me tounge.gif


Hehe tounge.gif

QUOTE (ashdexx @ Jun 20 2005, 21:29)
i think i found the code to attach one vehicle to another as well..
CODE
0683: $car1 $car2  0.0 -4.6  .65  15.0  0.0  0.0

car1 gets attatched to car2


Im guessing its:

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

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#21

Posted 21 June 2005 - 11:34 PM

QUOTE (steve-m @ Jun 22 2005, 03:15)
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.

DexX
  • DexX

    Black Hat

  • Feroci Racing
  • Joined: 16 May 2002

#22

Posted 22 June 2005 - 12:09 PM

find it or die.

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#23

Posted 22 June 2005 - 01:08 PM

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

Dug it up on my own. Very strange usage.
CODE
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.
CODE
06ED: $carid 1


Example: If you want to use the skin 'elegy3.txd' on your created Elegy, use this code.
CODE
06ED: $carid 2


However, I'm not sure whether these alternative skins are hardcoded, or whether it can just goes
CODE
I'll use "CARNAME""INT".txd for this car


[EDIT]Sample code and screenshot!
CODE
:opius_testloop2222111
0247: request_model #elegy

:opius_testloop2222112
0001: wait  0 ms
00D6: if  0
0248:   model #elegy available
004D: jump_if_false ££opius_testloop2222112

04C4: create_coordinate $uniquevar0000 $uniquevar0001 $uniquevar0002 from_actor $player_actor offset  0.0  10.0  1.0
00A5: $uniquevar0003 = create_car #elegy at  $uniquevar0000 $uniquevar0001 $uniquevar0002
06ED: $uniquevar0003 0
04C4: create_coordinate $uniquevar0000 $uniquevar0001 $uniquevar0002 from_actor $player_actor offset  5.0  10.0  1.0
00A5: $uniquevar0004 = create_car #elegy at  $uniquevar0000 $uniquevar0001 $uniquevar0002
06ED: $uniquevar0004 1
04C4: create_coordinate $uniquevar0000 $uniquevar0001 $uniquevar0002 from_actor $player_actor offset  -5.0  10.0  1.0
00A5: $uniquevar0005 = create_car #elegy at  $uniquevar0000 $uniquevar0001 $uniquevar0002
06ED: $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.

GodGell
  • GodGell

    shlurp my burger, sir

  • Members
  • Joined: 31 Oct 2003

#24

Posted 22 June 2005 - 02:14 PM

QUOTE (Opius @ Jun 22 2005, 15:08)
Dug it up on my own. Very strange usage.
CODE
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..

Viper187
  • Viper187

    Crazy Snake

  • Members
  • Joined: 17 Oct 2002

#25

Posted 22 June 2005 - 09:21 PM

Dunno if this was posted, but...

CODE

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?

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#26

Posted 22 June 2005 - 09:59 PM

QUOTE (GodGell @ Jun 23 2005, 00:14)
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.

Capushon
  • Capushon

    Player Hater

  • Members
  • Joined: 19 Apr 2003

#27

Posted 23 June 2005 - 12:13 AM

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
; ------------------------------------------------------------

PatrickW
  • PatrickW

    GTA Juggernaut

  • Inactive Staff
  • Joined: 07 Jan 2004
  • Netherlands
  • Best Script 2013 [DYOM]
    Best Script 2012 [DYOM]

#28

Posted 23 June 2005 - 12:33 AM

QUOTE (Viper187 @ Jun 22 2005, 23:21)

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

switch( @4 ) {
case 10:
   jump ££IMPEXPM_1025
case 20:
   jump ££IMPEXPM_1027
case 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:
CODE
0988=2,%2d% = get_car %1d% paintjob
06ed=2,set_car %1d% paintjob %2d%
09b3=2,%2d% = get_car %2d% doorstatus

GodGell
  • GodGell

    shlurp my burger, sir

  • Members
  • Joined: 31 Oct 2003

#29

Posted 23 June 2005 - 04:33 AM Edited by GodGell, 23 June 2005 - 05:30 PM.

QUOTE (Opius @ Jun 22 2005, 23:59)
QUOTE (GodGell @ Jun 23 2005, 00:14)
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

Opius
  • Opius

    General

  • Feroci Racing
  • Joined: 27 Jun 2002

#30

Posted 23 June 2005 - 07:36 AM

There's a DEcompiler for GTAMA but no compiler, as far as I know.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users