Coding

 Reply to this postStart new topic

GTAG Opcode Database

Deji
post Aug 17 2009, 09:17 PM
Post #1


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



Opcode Database
Go for SASCM.ini


Let's have a bash at finishing the documentation of all the unknown parameters and opcodes in San Andreas. Posts in this topic go towards improving the GTAG Opcode Database and Documentation and the widely used SASCM.ini file.


GXT/FXT Capabillities:

Colours

~1~Dynamic Number
~a~Area Title / Dynamic String (Used in Vigilante and Taxi missions. To be used with Opcode 0384)
~b~Blue Text
~d~â–¼ Down Symbol
~g~Green Text
~h~Text Highlighter (Used for main menu. Text will light up when selected.)
~k~Key Definition
~l~Black Text
~n~New Line
~p~Purple Text
~r~Red Text
~s~Default Text
~u~â–² Up Symbol
~w~White Text
~y~Yellow Text
~z~Subtitle Text (Invisible when subtitles are turned off).



Symbols

~u~ Up arrow.
~d~ Down arrow.
~<~ Left arrow.
~>~ Right arrow.


Keypresses

(These change according to your control settings. For example, if the players action button was set to "TAB" you can use the code to show that...)

E.G: Press ~k~~PED_ANSWER_PHONE~ == Press TAB


On Foot

KeypressActionGXT Symbol
0Left / Right~k~~GO_LEFT~ / ~k~~GO_RIGHT~
1Forward / Backward~k~~GO_FORWARD~ / ~k~~GO_BACK~
2Look Left / Right~k~~VEHICLE_LOOKLEFT~ / ~k~~VEHICLE_LOOKRIGHT~(Joypad Mode) ~k~~PED_1RST_PERSON_LOOK_LEFT~ / ~k~~PED_1RST_PERSON_LOOK_RIGHT~
3Look Up / Down(Joypad Mode) ~k~~PED_1RST_PERSON_LOOK_UP~ / ~k~~PED_1RST_PERSON_LOOK_DOWN~
4Action / Center Camera~k~~PED_ANSWER_PHONE~~k~~PED_FIREWEAPON_ALT~ /(Joypad Mode) ~k~~PED_CENTER_CAMERA_BEHIND_PLAYER~
5Previous Weapon / Zoom In~k~~PED_CYCLE_WEAPON_LEFT~ / ~k~~PED_SNIPER_ZOOM_IN~
6Aim Weapon~k~~PED_LOCK_TARGET~
7Next Weapon / Zoom Out~k~~PED_CYCLE_WEAPON_RIGHT~ / ~k~~PED_SNIPER_ZOOM_OUT~
8Group CTRL Forward~k~~GROUP_CONTROL_FWD~
9Group CTRL Backward~k~~GROUP_CONTROL_BWD~
10No~k~~CONVERSATION_NO~
11Yes~k~~CONVERSATION_YES~
13Change Camera~k~~CAMERA_CHANGE_VIEW_ALL_SITUATIONS~
14Jump~k~~PED_JUMPING~
15Enter Vehicle~k~~VEHICLE_ENTER_EXIT~
16Sprint~k~~PED_SPRINT~
17Fire Weapon~k~~PED_FIREWEAPON~
18Crouch~k~~PED_DUCK~
19Look Back~k~~PED_LOOKBEHIND~
--Sneak~k~~SNEAK_ABOUT~



Unused

~k~~HBTAKE_SCREEN_SHOT~Displays "HBTAKE SCREEN SHOT".
~k~~SWITCH_DEBUG_CAM_ON~Crashes game.
~k~~TOGGLE_DPAD~Crashes game on PC.
~k~~NETWORK_TALK~Crashes game.
~k~~SHOW_MOUSE_POINTER_TOGGLE~Crashes game.


Don't let the "crashes game" fool you into thinking it doesn't exist. When using an incorrect/inexistant GXT keypress value, the text displays.

So in this case, HB_TAKE_SCREEN_SHOT is probably the only non-functioning one. The others try and do stuff, but that seems to lead to errors. Functions have probably been removed.

Other

( = [
) = ]
{ = ?
* = &

| makes a degrees sign. Little circle above text.

^ makes an upside down !

] Makes a star.

[ Large space.


Parameters:

CODE
009A: 2@ = create_actor_pedtype X model #MALE01 at 0.0 0.0 0.0

Changes the type of character being created.

Pedtype 0 = Player1
Pedtype 1 = Player2
Pedtype 2 = Player_NETWORK
Pedtype 3 = Player_UNUSED
Pedtype 4 = CIVMALE (Default)
Pedtype 5 = CIVFEMALE
Pedtype 6 = Cop
Pedtype 7 = Gang1 (Ballas)
Pedtype 8 = Gang2 (Grove Street)
Pedtype 9 = Gang3 (LS Vagos)
Pedtype 10 = Gang4 (SF Rifa)
Pedtype 11 = Gang5 (Da Nang Boys)
Pedtype 12 = Gang6 (Mafia)
Pedtype 13 = Gang7 (Mountain Cloud)
Pedtype 14 = Gang8 (Varrio Los Aztecas)
Pedtype 15 = Gang9 (Unused)
Pedtype 16 = Gang10 (Unused)

CODE
07E0: set_marker @0 type X

Creates the bouncing marker above characters heads.

Type 1 = Enemy Marker (Red)
Type 2 = Friendly Marker (Blue)

CODE
00AF: set_car 62@ driver_behaviour_to X

Changes the way a character drives the vehicle.

Driver Behaviour 0 = Stopped.
Driver Behaviour 1 = Follow roads and paths.
Driver Behaviour 2 = Tries to kill player.

CODE
00AE: set_car 71@ traffic_behaviour_to X

Changes the way a character drives the vehicle.

Traffic Behaviour 0 = Stop for other traffic.
Traffic Behaviour 1 = Impatient. Overtakes other traffic.
Traffic Behaviour 2 = Very impatient. Speeds regardless of traffic.
Traffic Behaviour 3 = Steady speed. Crashes through traffic
Traffic Behaviour 4 = Stops for other cars. Drives fast.
Traffic Behaviour 5+ = Stops at traffic lights. Drives through traffic.

CODE
067F: set_car 35@ lights X

Changes the vehicles lights.

Lights 0 = Off.
Lights 1 = On.
Lights 2 = Default (off in day, on at night).



I'll probably update this list with new ones found. Hopefully we'll end up having a full documentation of the opcode's parameters so they can be used easily.

Your turn!


--------------------
Go to the top of the page
 
+Quote Post
Spider-Vice
post Aug 20 2009, 02:04 PM
Post #2


In motus...

Group Icon

Posts: 362
From: Portugal
Joined: 28-May 09



Thanks for all the GXT/CleoGXT (FXT) params. They're needed for Design Your Own Mission mission (custom) editing tongue.gif
Go to the top of the page
 
+Quote Post
Deji
post Aug 20 2009, 03:19 PM
Post #3


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



I believe the ones listed are ALL the capabilities. Any others you see posted are usually wrong. I tested every symbol on my keyboard with a few different types of text and only those did something.

I'm not sure about ~a~, though...


--------------------
Go to the top of the page
 
+Quote Post
Spider-Vice
post Aug 21 2009, 02:05 PM
Post #4


In motus...

Group Icon

Posts: 362
From: Portugal
Joined: 28-May 09



I know. I just said these work in DYOM .dat editing. (mission editing) and said thanks.
Go to the top of the page
 
+Quote Post
Deji
post Oct 4 2009, 05:59 PM
Post #5


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



CODE
09E5: create_flash_light_at 225@ 226@ 227@ RGB_mask 255 255 255 radius 200.0


Param1: x coord of the flash light.
Param2: y coord of the flash light.
Param3: z coord of the flash light.

Param4: Amount of Red in flash light.
Param5: Amount of Blue in flash light.
Param6: Amount of Green in flash light.

Param7: How far flash light can take effect on peds, cars etc.


This opcode creates a quick flash of light that can not be seen, but what the light touches can (cars, peds etc.).

Params 4,5 and 6 controll the RGB (red, green, blue) in the colour. You may not know it, but every colour discovered can be created with only Red, green and blue (bit like mixing paint).

If red was set to 255, there would be 100% red in the colour. If the others were set to 0, the colour would be fully red. If RG and B are set to 255, the colour would be white, as white is a combination of every colour (believe it or not).

You can use MS Paint to find the right colour. Open Paint, double-click any colour on the bottom panel, click "define custom colors" and drag the cursor around to find the colour you want. The Red, Green and Blue will show up in the boxes underneath. Simply paste each one and you have your coloured flash!



CODE
03E7: flash_hud_component 4


I've been tackling with this one... It appears that some numbers don't do anything, but that just doesn't make sense. So if you know more about this opcode, post!

3 = armour bar
4 = health bar
8 = radar (& height bar when in flying vehicle)
10 = lung capacity

.. And that's about all I can find.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Dec 31 2009, 04:44 AM
Post #6


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



CODE
07FE: set_actor $PLAYER_ACTOR fighting_style_to 5 7



People seem confused about this opcode and don't understand the 2 parameters.



Param1: Fighting style

4 Standard
5 Boxing
6 Martial Arts
7 Kickboxing
8-14 Various weapon styles
15 Default
16 Elbows


Param2: Moves

Now, this limits the amount of moves the actor can perform. So for example, if they are set to use boxing, you can ensure they only do the first two punches in the boxing combo or enable them to do everything.

This is used for the trainers, as they are made to attack, but are made to do specific moves.

You may also find that some have moves that aren't usually used in the normal game.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jan 30 2010, 05:55 AM
Post #7


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



CODE
06E1: AS_actor 50@ using_car 51@ target_car 69@ with_order 29 max_speed 30.0 traffic_flag 2


with_order:

0 = stopped.
3 = follows sirens, tries to stop other car. follows anywhere. never stops.
4 = follows sirens, tries to stop other car. stops when other car stops.
5 = follows with sirens, stops ahead of other car.
6 = similar to above.
7 = follows by reversing.
8 = drives away from other car.
10 = similar to 7?
12 = drives away from other car.
16 = follows other car.
24 = follows other car, gets out of car when close and tries to kill other driver.
25 = follows other car on foot, tries to wreck other car when close.
26 = similar to 5.
29 = tries to keep 9-o'clock angle on other car.
30 = tries to keep 3-o'clock angle on other car.
32 = tries to keep 12-o'clock angle on other car.

33 = seems to be the max.

some have not quite been figured out due to their seemingly odd behaviours

traffic_flag (see 00AE)


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jan 31 2010, 12:35 AM
Post #8


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



Wow... I found out about a coding trick... As well as discovering that 2 opcodes were falsely considered as nopcodes...


0485 and 059A are NOT nopcodes.


SANNY
0485: return_true
059A: return_false


Lemme explain...


If you know enough about coding, you know all about gosubs (or at least you think you do tongue.gif)... They execute code at a specified thread and then return. However, like with most coding languages, they can return true or false (although most languages can return values too).

Then, get this... you can use "gosub" as a condition... Yeah, that's right. A condition.


SANNY
:MyThread
wait 0
if
    0050: gosub @Check
then
    0662: ";gosub has returned true. Player is controllable!";
else
    0662: ";gosub has returned false. Player is not controllable!";
end
end_thread

:Check
if
    03EE:   player $PLAYER_CHAR controllable
then
    0485: return_true
else
    059A: return_false
end
return



May be very useful, eh?


Updated opcode databse (and sascm.ini).


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Mar 3 2010, 05:13 AM
Post #9


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



Removed some of the ordering options. Only the opcode one exists now (the others didn't work anyway).

Also fixed some bugs and added code for more consistent pages.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Apr 2 2010, 07:13 PM
Post #10


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



Work on adding III and VC compatibility is going smoothly...


All documented opcodes for the two games can now be found in the database.

There have been some issues, though... CLEO opcodes for III and VC won't be as well documented as the ones for SA due to the fact they use opcodes that have uses in games released later.

So if there's a Vice City CLEO function and a San Andreas function that share the same opcode, San Andreas will take priority, since it's a later game and is an original opcode. Maybe I'll find a workaround for this.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post May 11 2010, 10:42 AM
Post #11


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



I consider myself a finder of many things now smile.gif

CODE
0709: set_decision_maker 0@ on_event 31 task 413 respect 0.0 hate 0.0 like 0.0 dislike 0.0 in_car 0 on_foot 1


Woot! Gawd, this forum is the shiznit. If this website had more activity it'd be the perfect.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post May 12 2010, 02:53 AM
Post #12


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



CODE
05D3: AS_actor 1@ goto_point 0.0 0.0 0.0 mode 4 -2 ms


mode

4 - Walk
6 - Run


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jul 2 2010, 02:33 AM
Post #13


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



Added some messy code to give the opcode database search ability.

Very basic, but that's all that's needed for now. I'm planning on (eventually) redoing the whole database system now that I fully know what needs adding. Right now there is a lot of unnecessary code due to me not knowing exactly what to do when I started (me not knowing CLEO 4 would come out didn't help) tongue.gif


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jul 24 2010, 02:19 AM
Post #14


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



Добрае утра!

Sorry, I just wanted to try out my new language skillz... It's not even morning yet tongue.gif


But here I am, 3AM in the morning... A less random find than usual...

Weapon ID 56

Seems to refer to "no dangerous weapon". As seen by the use in the main.scm.

SANNY
if
    82D8:   not actor $PLAYER_ACTOR current_weapon == 56
then
    010E: set_player $PLAYER_CHAR minimum_wanted_level_to 2
end


This is used in the interior scripts for the police stations. If the current_weapon is 56, the player isn't holding a weapon of threat, so the above returns true and the player recieves 2 stars.


I've reason to believe there are more ID's like this, that do odd things smile.gif


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Aug 7 2010, 04:26 AM
Post #15


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



CODE
06B5: set_searchlight 4@ travel_to 0.0 0.0 0.0 speed 0.0


This, simply put, makes the searchlight target travel to the specified coords. The first example of this in the main.scm has all floats at 0, which would quite simply make the searchlight stop... No, it doesn't make the searchlight go to coords 0.0 0.0 0.0 instantly. Pretty standard opcode.


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Aug 8 2010, 01:31 PM
Post #16


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Hmm... I have a question... In original SASCM.ini there is incorrect opcodes with sin and cos, did you fix this in yours?

This post has been edited by TLMC: Aug 8 2010, 01:31 PM
Go to the top of the page
 
+Quote Post
Deji
post Aug 8 2010, 02:30 PM
Post #17


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



It might be fixed... In the database it's recorded as being changed from the original sascm.in - Is this correct?

CODE
02F6: 14@ = cosine 45.0 // (float)

CODE
02F7: 13@ = sine 45.0 // (float)


I can't test at the moment.


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Aug 11 2010, 08:45 PM
Post #18


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Must be

SANNY
02F6: 14@ = sine 90.0
02F7: 13@ = cosine 90.0


This post has been edited by TLMC: Aug 11 2010, 08:46 PM
Go to the top of the page
 
+Quote Post
Deji
post Aug 11 2010, 09:27 PM
Post #19


Coding like a Rockstar!

Group Icon

Posts: 1,477
From: ???
Joined: 28-May 09



Updated.


--------------------
Go to the top of the page
 
+Quote Post
Silent
post Aug 17 2010, 03:08 PM
Post #20


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



SANNY
0605: actor -1 perform_animation_sequence "M_SMKLEAN_LOOP" IFP_file "LOWRIDER" rate 4.0 loop 1 lockX 0 lockY 0 lockF 0 time -1 // versionA
0812: AS_actor -1 perform_animation "LRGIRL_IDLELOOP" IFP_file "LOWRIDER" 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB
0A1A: actor 88@ perform_animation "HIKER_POSE_L" IFP_file "MISC" 4.0 loopA 0 lockX 0 lockY 0 lockF 1 -1 ms // versionC


Finally differences discovered!

VersionA stops animation when actor is hit/shot/aimed/something other - just when he need to play any other, EXE coded animation.
VersionB plays animation regardless of situation.
VersionC unlocks walking while animation is on.
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

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