Jump to content

Mission Coding


Recommended Posts

Craig Kostelecky

Grand Theft Auto: Liberty City -- Mission Coding


This is the location where we will discuss and release updates to the mission script and related files. Any questions on it should be posted here. This section is for official code only, so any unofficial additions go in the unofficial mods topic.

These missions require some audio files as well. They can be found on your GTA3 CD.

Missions

[table]
Mission
Status
Mission 0 SetupDone, requires latest updates
Mission 1 Hospital HelpDone and bug free
Mission 2 Police HelpDone and bug free
Mission 3 Diablo DestructionDone and bug free
Mission 4 Mafia MassacreDone and bug free
Mission 5 Rumpo RampageDone and bug free
Mission 6 Casino CalamityDone and bug free
Mission 7 Patriot PlaygroundDone and bug free
Mission 8 A Ride in the ParkDone and bug free
Mission 9 Gripped!Done and bug free
Mission 10 Multistory MayhemDone and bug free
Mission 11 Paramedic sub-missionDone with no known bugs
Mission 12 Firefighter sub-missionDone with no known bugs
Mission 13 Vigilante sub-missionMostly done -- there's a chance cars will cross to other islands
Mission 14 Taxi sub-missionDone with no known bugs
Mission 15 The CrookDone and bug free
Mission 16 The ThievesDone and bug free
Mission 17 The WifeDone and bug free
Mission 18 Her LoverDone and bug free
Mission 19 Give Me LibertyDone and bug free
Mission 20 Dont Spank Ma Bitch UpDone with no known bugs
Mission 21 Drive Misty For MeDone with no known bugs
Mission 22 Pump Action PimpDone with no known bugs
Mission 23 The FuzzballDone with no known bugs
Mission 24 Mike Lips Last LunchDone.
Mission 25 Farewall Chunky Lee ChongDone with no known bugs
Mission 26 Van HeistDone.
Mission 27 Cipriani's ChauffeurDone with no known bugs
Mission 28 Dead Skunk In The TrunkDone with no known bugs
Mission 29 The Get AwayDone with no known bugs
Mission 30 Taking Out The LaundryDone with no known bugs
Mission 31 The Pick UpDone with no known bugs
Mission 32 Salvatore's Called A MeetingDone with no known bugs
Mission 33 Triads And TribulationsDone with no known bugs
Mission 34 Blow FishDone.
Mission 35 ChaperoneMostly done -- no SWAT speech
Mission 36 Cutting The GrassDone and bug free
Mission 37 Bomb Da Base Act IDone and bug free
Mission 38 Bomb Da Base Act IIDone
Mission 39 Last RequestsDone
Mission 40 TurismoDone and bug free
Mission 41 I Scream, You ScreamDone
Mission 42 Trial By FireDone and bug free
Mission 43 Big 'N' VeinyDone and bug free
Mission 44 Sayonara SalvatoreDone with no known bugs
Mission 45 Under SurveillanceDone with no known bugs
Mission 46 Paparazzi PurgeDone and bug free
Mission 47 Pay Day For RayDone and bug free
Mission 48 Two Faced TannerDone and bug free
Mission 49 Kanbu Bust OutDone with no known bugs
Mission 50 Grand Theft AutoDone with no known bugs
Mission 51 Deal StealDone with no known bugs
Mission 52 ShimaDone with no known bugs
Mission 53 SmackdownDone with no known bugs
Mission 54 Silence The SneakDone with no known bugs
Mission 55 Arms ShortageDone with no known bugs
Mission 56 Evidence DashDone, with no known bugs
Mission 57 Gone FishingDone, with no known bugs
Mission 58 Plaster BlasterMostly done -- damage by vehicle not recognized
Mission 59 Marked ManDone with no known bugs
Mission 60 LiberatorDone with no known bugs
Mission 61 Waka Gashira WipeoutDone, with no known bugs
Mission 62 A Drop In The OceanDone with no known bugs
Mission 63 Bling-Bling ScrambleDone and bug free
Mission 64 Uzi RiderDone with no known bugs
Mission 65 Gangcar RoundupDone with no known bugs
Mission 66 Kingdom ComeDone with no known bugs
Mission 67 Grand Theft AeroDone.
Mission 68 Escort ServiceDone, with no known bugs
Mission 69 DecoyDone with no known bugs
Mission 70 Loves DisapperanceDone and bug free
Mission 71 BaitDone with no known bugs
Mission 72 Espresso 2 GoDone with no known bugs
Mission 73 SAMDone, with no known bugs
Mission 74 Uzi MoneyDone and bug free
Mission 75 ToyminatorDone and bug free
Mission 76 Rigged to BlowDone and bug free
Mission 77 Bullion RunDone.
Mission 78 RumbleDone and bug free
Mission 79 The ExchangeDone with no known bugs
[/table]
Other bits

[table]
Item
Status
TrainCode is final, there are issues with the models and lack of sounds though
SubwayCode is final, there are issues with the models and lack of sounds though
Car crusherCrane is done and bug free, crusher needs full conversion
Military (emergency vehicle) craneDone and bug free
Import/Export garageDone and bug free
SSV Bridge AnimationDone and bug free
Ped speechAlmost done!
Any otherDon't know
[/table]
Mission conversion info

There are a few things you need to know before doing a conversion.

The city has been moved for sea alignment reasons, so the code must be moved accordingly. The x has been moved -335 and the z has been +6, all co-ordinates must be moved accordingly.

Weapon numbers - the weapons have changed, so the numbers must be changed too:

[table]
III
LC
Weapon
16Bat
217Colt45
323Uzi
421Shotgun
525AK47
627M16
728Sniper Rifle
830Rocket Launcher
931Flamethrower
1015Molotov cocktails
1112Grenades
1234Detonator
[/table]
Radar icons - these have also changed:

[table]
SCM
Sprite
GXT
GXT String
4ALG_02Asuka
5III_radar_bomb.pngLG_03el Burro
6CLG_04Catalina
8III_radar_copcar.pngLG_06Police Car
9DLG_07Donald Love
108LG_088-Ball
11III_radar_el.pngLG_03el Burro (notice the repeated LG_03)
12III_radar_ice.pngLG_09D-Ice
13JLG_10Joey
14KLG_11Kenji
15III_radar_liz.pngLG_12King Courtney
16LLG_13Luigi
18RLG_15Ray
19SLG_16Salvatore
20III_radar_save.pngLG_37Hideout
21III_radar_spray.pngLG_17Pay 'n' Spray
22TLG_18Toni
23III_radar_weapon.pngLG_19Ammunation
27CanLG_27Pay 'n' Spray
28MLG_23Marco's Bistro
[/table]
Some z-coordinates are -100.0 in GTA 3 -- this is used to find the ground z coordinate, but this doesn't always look right in VC (due to the way the game loads collision now), so you will need to find the correct coordinates yourself.

III-specific opcodes

Many of the GTA III's opcodes did not carry over to Vice City as R* deemed them unnecessary. Fortunately we have gained enough knowledge to recreate most of these opcodes faithfully. If you are interested in these opcodes independent of the mod, check out the Opcodes Restoration Project. All recreated opcodes are handled by the dinput8.dll file.

[table]
Opcode
Status
00A2: is_char_still_aliveThis now works
00AC: is_car_still_aliveThis now works
00BD: print_soonThis now works
0130: is_player_bustedThis now works
0135: change_car_lockThis now works
0149: is_car_crushed0119: is_car_wrecked \\ Possibly with area check
014D: text_pagerThis now works
0156: set_ped_densityI used a forbidden_for_peds cube, but that depends on the density you want
015E: is_car_in_airThis now works
016F: draw_shadowThis now works
0178: is_player_touching_objectThis now works
0181; declare_mission_flag_for_contactno effect in III, is ignored here
0182; set_contact_base_briefno effect in III, is ignored here
01EE: activate_craneThis now works
01EF: deactivate_craneThis now works
0218: print_with_number_big_qThis now works
021D: set_free_bombsThis now works
0228: is_car_armed_with_bombThis now works
0240: flash_objectThis now works
0242: arm_car_with_bombThis now works
024C: set_phone_messageThis now works
0250: draw_lightThis now works
0255: restart_critical_missionThis now works
0299: activate_garageThis now works
029C: is_boatThis now works
02A0: is_char_stoppedThis now works
02A1: message_waitThis now works
02A2: add_particle_effectThis now works
02B9: deactivate_garageThis now works
02BC: set_swat_requiredThis now works
02C3: start_pacman_raceThis now works
02C5: get_number_of_power_pills_eatenThis now works
02C6: clear_pacmanThis now works
02C7: start_pacman_scrambleThis now works
02C8: get_number_of_power_pills_carriedThis now works
02C9: clear_number_of_power_pills_carriedThis now works
02CD: gosub_file @Label00FEAD @Label00FEADThis now works, but gosub is still better to use
02D9: clear_number_of_power_pills_eatenThis now works
02EE: is_projectile_in_cubeThis now works
02EF: remove_projectile_in_cubeThis now works
02F0: drop_mineThis now works
02F1: drop_nautical_mineThis now works
02F4: create_cutscene_actor_from_head_and_body???
02F5: set_head_anim???
02FB: activate_crusher_craneThis now works
02FE: print_with_2_numbers_soonThis now works
032D: set_car_to_blockThis now works
033A: create_incoming_cessnaThis now works
033B: has_incoming_cessna_landedThis now works
033C: has_incoming_cessna_been_destroyedThis now works
0344: set_text_centre_size???
0346: set_text_draw_background_color???
0349: set_text_font???
034A: set_portland_completeThis now works
034B: set_staunton_completeThis now works
034C: set_shoreside_completeThis now works
0351: is_gore_enabledThis now works
0354: set_up_chase_sceneThis now works
0355: clean_up_chase_sceneThis now works
0356: is_explosion_in_areaThis now works
0358: create_drop_off_cessnaThis now works
0359: is_drop_off_cessna_destroyedThis now works
035A: get_drop_off_cessna_coordsThis now works
035B: create_floating_packageThis now works
0367: start_kill_frenzy_headshotThis now works
0368: activate_military_craneThis now works
0374: set_motion_blurThis now works
037F: give_player_detonatorThis now works
0399: disable_ped_nodes_in_angled_cube???
03A0: is_crane_lifting_carThis now works
03A5: change_garage_type_with_car_modelThis now works
03A6: find_drug_plane_coordinatesThis now works
03B2: start_catalina_heliControlled by the CAT_FB script
03B3: catalina_heli_take_offControlled by the CAT_FB script
03B4: remove_catalina_heliControlled by the CAT_FB script
03B5: has_catalina_heli_been_shot_downControlled by the CAT_FB script
03B9: grab_catalina_heliControlled by the CAT_FB script
03C6: is_collision_in_memoryThis now works
03C9: is_car_visibly_damagedThis now works
[/table]
Due to the 550 cells per post limit, see the post below for the rest of the table.

Development

If you want to help develop the script, these are the files required to get it compiled in Sanny Builder.If you want to help debug the script, you can enable debug by adding these lines into the gta-lc.ini file under the "Debug" section.
[Debug]MasterDebug=1MasterExtras2=1MasterPackagesCompleted=0MasterParamedicCompleted=0MasterVigilanteCompleted=0MasterFirefighterCompleted=0MasterIEGaragesCompleted=0Master100Completed=0SkipHelp=0ViceCity=0
Mission coding related links

Previous mission coding topic, from the Wayback Machine

Coding forum

HUGE thanks to Y_Less for organizing all of this and formatting it like it is. God knows I didn't have the time to do it.

09-2012 update: Updated opcode list. It's more accurate now but the list seems to also include opcodes that worked with the latest but glitchy and excluded .asi file. -space

02-2016 update: Table is now updated post-forum upgrade, updated some really outdated information especially opcodes table, added 018D information. -space

06-2016 update: New opcodes from dinput8.dll added. -space

08-2016 update: vcopcode.asi has been replaced with dinput8.dll. -space Edited by spaceeinstein
  • Like 1
Link to comment
https://gtaforums.com/topic/743524-mission-coding/
Share on other sites

  • 10 years later...
spaceeinstein

(Continued from above)

[table]

 

Opcode

 

Status

 

03C2: is_phone_displaying_message

 

This now works

 

03DD: show_pickup_on_radar

 

This now works

 

03EC: has_ev_crane_collected_all_cars

 

This now works

 

03F7: load_collision

 

Not needed?

 

03F8: get_bodycast_health

 

This now works

 

03FB: set_car_stays_in_current_level

 

This now compiles, but level transitions are not available

 

03FC: set_char_stays_in_current_level

 

This now compiles, but level transitions are not available

 

03FD: register_4x4_one_time

 

042E: register_fastest_time 16

 

03FE: register_4x4_two_time

 

042E: register_fastest_time 17

 

03FF: register_4x4_three_time

 

042E: register_fastest_time 18

 

0400: register_4x4_mayhem_time

 

042E: register_fastest_time 19

 

0406: register_longest_dodo_flight

 

This now works

 

0407: register_time_taken_defuse_mission

 

042E: register_fastest_time 1

 

040A: remove_car_from_chase

 

This now works

 

0410: set_gang_ped_model_preference

 

This now works

 

041C: make_actor_say

 

This now mostly works, sans the SWAT speech

 

041F: override_hospital_level

 

This now compiles, but level transitions are not available so use 016E

 

0420: override_police_station_level

 

This now compiles, but level transitions are not available so use 016E

 

0421: force_rain

 

This now works

 

0422: does_garage_contain_car

 

This now works

 

0426: create_save_cars_between_levels

 

???

 

042A: is_threat_for_ped_type

 

This now works

 

0438: set_char_ignore_level_transitions

 

This now compiles, but level transitions are not available

 

043A: start_boat_foam_animation

 

no effect in III, is ignored here

 

043B: update_boat_foam_animation

 

This now mostly works, simplified form of III

 

043D: set_intro_is_playing

 

???

 

0444: set_script_fire_audio

 

This now works

 

0447: is_player_lifting_a_phone

 

This now works

 

044C: load_collision_with_screen

 

???

 

044E: set_car_ignore_level_transitions

 

This now compiles, but level transitions are not available

 

044F: make_car_a_bit_stronger

 

This now works

 

0452: enable_player_control_camera

 

This now works

[/table]

Togglable features

New! There are many (optional) entries for the gta-lc.ini settings file that lets you control various features in the latest updates. Place these lines in the "Misc" section.

 

[Misc]AllowHorizonShips=0UseVCCarAlarm=0AllowPlaneTrailsBanners=0UseVCWantedSystem=0UseVCAutoAimTexture=0ShowArrowMarkerGlow=1AllowDeadPedInFrontOfCar=1UseTommySfx=0UseShortcutDropoff=1UseVCTrails=0UseVCWeather=0UseRCBaron=0AdditionalStats=1UseVCEnvironmentMap=0RandomLoadScreen=1UseVCFontStyles=0UseVCFontColors=0
Script file update (last updated 2015-06-09)

Changes:

  • Proper gun flashes during the introduction scene and Grand Theft Aero
  • Proper smoke particle during Kanbu Bust-out
  • The Yakuza Stinger replaces the Hotrinb while the Phoenix is reverted back to original
  • During Paramedic, the patients will scream properly when hurt
  • Better city loading when starting a new game with debug mode on
A new game is always required when the main script is modified. Edited by spaceeinstein
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067248050
Share on other sites

Craig Kostelecky

Awesome space. Thank you. I see you updated planes.sc in Dropbox and main.sc. Could you please update the other source files so I can sync up? Thanks.

Edited by Craig Kostelecky
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067260346
Share on other sites

spaceeinstein

I don't think it should matter what car is being replaced when it comes to sounds since a way to fix them was posted in another topic. I think Silent is working on implementing those fixes.

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067276192
Share on other sites

Would be good if MM didn't dissapear again, though :(

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067280274
Share on other sites

  • 1 month later...
spaceeinstein

While we await a permanent update, I have set up a temporary update so that you can test all the car SFX. You can post any inconsistencies you discover in the sounds of the cars. In your gta-lc.ini file, change the UseDebugSCM setting to 1 in order to use this update. It is only accessible using debug mode.

Edited by spaceeinstein
  • Like 1
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067518855
Share on other sites

Craig Kostelecky

As usual, thank you space. I'm still amazed at some of the things you can do in the scm these days. Speaking of sound altering scm code, would you know how to mute the helicopter sound (or swap it with the driving engine sound) from the flying DeLorean? And also the horn in the General Lee?

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067522441
Share on other sites

spaceeinstein

It's not possible to change the sound of a helicopter using this hack (but it's possible through traditional ways, at 0x5F3DB0 for those who know how to change it). For the General Lee, I can assign a blank SFX as its horn. I discovered this hack relatively recently so I think few knows such hack is even possible. But it's very impractical compared to other ways. You can check out 042E/042F for more practical uses.

Edited by spaceeinstein
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067524443
Share on other sites

Thanks for this, I have doubts whether I'll ever remember to implement the DAT customization for without being constantly nagged :D

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067525354
Share on other sites

Craig Kostelecky

I try to keep my nagging to a minimum while you're occupied with other projects. And so much of our development here is dependent on MM's work, so I'm fine waiting at a standstill for as long as we need to.

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067525651
Share on other sites

  • 4 weeks later...
spaceeinstein

Script file update (last updated 2015-06-21)

Changes:

  • Workaround for creating smoke particles during "Chaperone"
  • When starting "Bomb Da Base: Act I", the message "Salvatore wants you to help Toni deal with the Triads first!" will not appear when "Blow Fish" is already completed
  • Debug mode: Portland Ammu-Nation no longer duplicate weapon pickups when missions unlock them
  • Debug mode: Removed Toni's blip after completing "Salvatore's Called A Meeting", readded after completing "Chaperone"
  • Debug mode: Two clothes pickup at the Portland hideout, one is the default outfit and the other is the prison outfit, in order to test the change below
  • For modders: Initial progress on preventing crashes when starting cutscenes using different player character models
  • Source code: Removed extraneous spaces in frank1.sc
  • Source code: Initial progress to rename opcode 03C8 to its proper name
A new game is required as usual.

 

chaperone_th.jpg

Edited by spaceeinstein
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067634741
Share on other sites

  • Source code: Initial progress to rename opcode 03C8 to its proper name

Help what's regex replace :D

 

I'll handle it on dropbox.

 

EDIT:

Done. This command is paramless so why on Earth would you even want to rename it by hand? :D

 

 

EDIT2:

What did you change regarding cutscenes so they work with custom models?

Edited by Silent
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067635207
Share on other sites

Craig Kostelecky

Awesome work guys. I wondered what all of those updates were on Dropbox last night. I even scanned a few but did not notice the changes until they were pointed out this morning. Very happy to see you plugging away at these little things that you are so good at finding and fixing, space.

 

I'm happy to see a clothes pickup used. I'd even like to see people make more clothing options that we can include like in Vice City. If they look as good as the models in game, I'll likely accept them as official.

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067635373
Share on other sites

spaceeinstein

EDIT2:

What did you change regarding cutscenes so they work with custom models?

In GTA III, it uses #NULL as the model to use for the player. In Vice City, it uses special character models #SPECIALxx instead. So I tried using the technique Vice City uses and found that it made cutscenes work. I think somehow the 'PLAYER' model doesn't stay in memory and would crash the game when cutscenes try to create it. All fixed cutscenes right now use the default player model regardless of the model you are playing. I don't know how Vice City manages to allow different models to appear on the same cutscene model yet. Edited by spaceeinstein
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067636927
Share on other sites

Vice city loads the player model as a special actor if I remember correctly.Back then I managed to give Claude a different outfit in cutscenes by loading his body as a special actor and changed the lines to use that model. The only problem was that in the mission where you meet Salvatore, the cutscene uses 6 special actors(or 12, maybe the heads are counted as special actors too) and that's the most the game can load without crashing.So you're kinda limited in some cutscenes, unless you change the lines to get two actors share the same body model.

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067637970
Share on other sites

spaceeinstein

All the cutscenes are completely done! Now you can use different player model names without a game crash. Cutscenes will use the default player model "player.dff" regardless of the model you use. I found that Vice City looks through a list of hardcoded model names to determine what player model to use during cutscenes. If the model is not in the list, it will use the default player model. I'm unsure how to implement that feature though. It requires renaming many things or some memory editing for it to work here.

 

Script file update (last updated 2015-06-23)

Changes:

  • Uzi uses pistol's animation to avoid random crashes
  • Correctly positioned cutscene offset in "Silence The Sneak"
  • Currectly positioned camera angles of McAffrey's hideout in "Silence The Sneak"
  • Fixed game crash during "Silence The Sneak" when the escaping car is immediately blown up
  • Fixed height of destination blip in "I Scream, You Scream"
  • As a workaround, all peds are forced to spawn as Triads during "Trial By Fire" (I am unsure why the density is so low)
  • Debug mode: Phil's compound gate remains opened during "Arms Shortage"
  • For modders: Different player character model names can be used without the game crashing at cutscenes (cutscenes use the default player model)
  • Source code: Updated names of opcode 0168
Edited by spaceeinstein
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067642824
Share on other sites

Redride' s OG

All the cutscenes are completely done! Now you can use different player model names without a game crash. Cutscenes will use the default player model "player.dff" regardless of the model you use. I found that Vice City looks through a list of hardcoded model names to determine what player model to use during cutscenes. If the model is not in the list, it will use the default player model. I'm unsure how to implement that feature though. It requires renaming many things or some memory editing for it to work here.

 

Script file update (last updated 2015-06-23)

Changes:

  • Uzi uses pistol's animation to avoid random crashes
  • Correctly positioned cutscene offset in "Silence The Sneak"
  • Currectly positioned camera angles of McAffrey's hideout in "Silence The Sneak"
  • Fixed game crash during "Silence The Sneak" when the escaping car is immediately blown up
  • Fixed height of destination blip in "I Scream, You Scream"
  • As a workaround, all peds are forced to spawn as Triads during "Trial By Fire" (I am unsure why the density is so low)
  • Debug mode: Phil's compound gate remains opened during "Arms Shortage"
  • For modders: Different player character model names can be used without the game crashing at cutscenes (cutscenes use the default player model)
  • Source code: Updated names of opcode 0168

when i reached hideout, screen flashes

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067645422
Share on other sites

spaceeinstein

Thanks for noticing it. I have uploaded the fix at the same link.

 

EDIT: Craig, would you like the Distribution mission be officially supported?

distribution_th.jpg

Edited by spaceeinstein
Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067645534
Share on other sites

IMO it could fit better as some sort of a semi-official expansion with ALL VC side missions in. So Pizzaboy, RC planes and stuff.

 

But that might be too much additional content for the vanilla.

Link to comment
https://gtaforums.com/topic/743524-mission-coding/#findComment-1067646601
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.