Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

[VC] Making existing mission garage working like normal


sebejszczyn
 Share

Recommended Posts

sebejszczyn

Hello again, I need some more help. I managed with help from ArmanCan to make a save point in Salvatore's mansion in GTA liberty City Beta 4.0 mod. I was thinking about adding a garage in mansion. 
There is already fully functioning garage door with animation and stuff, but the door only works in missions. 
How can I make the garage opening normally and saving cars inside? I've searched for garage ID, door model and coordinates, and here's what I found:

 

Enum: GARAGE_MISSION_KEEPCAR_REMAINCLOSED

Garage name: frankie_garage

 

industNE.ide

536, SalvGarage, frankiesbase, 1, 100, 0


industNE.ipl

536, SalvGarage, 0, 1093.37, -183.262, 57.6481, 1, 1, 1, 0, 0, 0, 1

 

It have the same names of garage and door as original GTA 3, but of course the coordinates are different. I searched for script to make garage working, and found something like this(from what I read the opcode in VC is little different than 3 and SA):

 

:opcode_0299
// [email protected] - input param (garage handle)
[email protected] *= 0xA8  // size of each garage block
[email protected] += 0x812668  // add to beginning of garage block
05E0: [email protected] = read_memory [email protected] size 1 virtual_protect 0  // read garage type
if
    [email protected] == 11  // is garage type 11
then
    [email protected] += 1  // door state offset
    05E0: [email protected] = read_memory [email protected] size 1 virtual_protect 0  // read garage door state
    if
        [email protected] == 0  // is door closed
    then
        05DF: write_memory [email protected] size 1 value 3 virtual_protect 0  // open garage door
    end
    [email protected] -= 1
end
[email protected] += 5  // activation offset
05DF: write_memory [email protected] size 1 value 0 virtual_protect 0  // activate garage
05F6: ret 0

 

The site said something about this one, too:

 

"Use this line as a substitute for opcode 0299. This can be placed anywhere within the external script:"

05F5: call_scm_func @opcode_0299 inputs 1 garage_handle [garage handle]

 

I'm little confused what put where in this code, I tried to put "SalvGarage", "GARAGE_MISSION_KEEPCAR_REMAINCLOSED" or "frankie_garage" name in the place of input param, but it doesn't seem to work. Any help will be greatly appreciated.

Link to comment
Share on other sites

I'm not very familiar with VC coding, or at all familiar with your mod, but perhaps a little basic info will provide some useful clues.

 

The key to manipulating garages is the garage handle, the global variable used to create the garage;

0219: $681 = create_garage_type 5 door -914.129 -1263.54 10.706 to -906.3 -1266.9 14.421 depth -907.137 -1246.626

In this example from SB's opcode search tool, $681 is the garage handle. A handle can be used to manipulate various GTA entities after they've been created.  For example, you could change they garage type from 5 (GARAGE_RESPRAY) to 32 (GARAGE_HIDEOUT_TWELVE), a save garage type that's normally unused in standard VC. Hopefully, the save garage will be active by default. More example's;

 

//0219: $681 = create_garage_type 5 door -914.129 -1263.54 10.706 to -906.3 -1266.9 14.421 depth -907.137 -1246.626 // GARAGE_RESPRAY
02FA: garage $681 change_to_type 32 // GARAGE_HIDEOUT_TWELVE unused
if
  03B0:   garage $681 door_open // respray garages are open by default
then
  0361: close_garage $681
end
//03BB: set_garage $681 door_type_to_swing_open
//03DA: set_garage $681 camera_follows_player
05F5: call_scm_func @opcode_0299 inputs 1 garage_handle $681

terminate_this_custom_script
//Outside the main body of the script, like a subroutine.
:opcode_0299
{...}

Note: The opcode_0299 cleo function suggests that the value recorded in a garage handle is simply the index of the garage within the garage info structure. This is how it calculates the offset of the "active" field. Other handles, like for blips or objects, usually include a unique identifier/use counter in the upper 16 or 8 bits of the handle.

 

You'll need to decompile the main.scm from your mod to learn the handle of the garage you want to manipulate, and change the global variable in the codes above accordingly. Also, I'm guessing that the unused VC garage is unused in the mod, and there may be other unused save garages as well, but these assumptions need to be verified.

 

If you want to use constants (enums) such as GARAGE_MISSION_KEEPCAR_REMAINCLOSED and SalvGarage in your scripts then you can define them in the header of your cleo script. Besides being more descriptive, constants have the advantage of allowing you to change the variable or number in one place at the top of the file. (VC garage reference)

//Alloc($SalvGarage, 681) // uncommon strategy, using constant instead

const
  GARAGE_RESPRAY = 5
  GARAGE_MISSION_KEEPCAR_REMAINCLOSED = 21
  GARAGE_HIDEOUT_TWELVE = 32
  SalvGarage = $681
end

In the body of the script, you'd replace 32 with GARAGE_HIDEOUT_TWELVE and $681 with  SalvGarage. Be sure to replace $681 in the header with the actual handle of the specific garage. $681 was just an example from opcode.txt.

 

Edited by OrionSR
Link to comment
Share on other sites

sebejszczyn
Posted (edited)

Thank you for reply, I'll analyze this post and try to make things work somehow. I also noticed recently in lc.ini that "nbtgardoor=SalvGarage" which I guess it means SalvGarare replaces the nbtgardoor garage in normal VC.

Edited by sebejszczyn
Link to comment
Share on other sites

  • 2 weeks later...
sebejszczyn
Posted (edited)

It's been a while, and I couldn't find a proper solution, game crashing or nothing happens with different codes. Anyways I found out that they brought back some opcodes from GTAIII including the 0299: activate_garage. Tried to to this simplest way as possible:

 

0299: activate_garage 'SalvGarage'

 

or

 

0299: activate_garage "SalvGarage"

 

But I have crash at the end of loading game.

Edited by sebejszczyn
Link to comment
Share on other sites

The expected parameter is a handle of a garage - the global variable that was used to create the garage in main.scm.

 

Alternatively, you could probably get away with supplying the index of the garage, something that could be learned from a hex editor, or guessed at. If you try every value between 0 and... 12 or so, you're bound to stumble on the right one.

Link to comment
Share on other sites

sebejszczyn

I tried to put number values from 0 to 12 but everytime game gaves me couple of errors about "Incorrect opcode ID" then crashes. I've done some research in main.scm from the mod and I found some lines that are responsible for garage in missions:

 

02FA: garage $SALVATORES_GARAGE change_to_type 19   //GARAGE_FOR_SCRIPT_TO_OPEN_AND_CLOSE
0361: close_garage $SALVATORES_GARAGE
02FA: garage $SALVATORES_GARAGE change_to_type 21   //GARAGE_MISSION_KEEPCAR_REMAINCLOSED
021B: set_garage $SALVATORES_GARAGE to_accept_car $CARRY_CAR

 

Thank you for your help! I'll try again to do something with all those informations and codes, maybe someday I figure it out 😅 Maybe some of the creators of the mod will help, I don't know if anyone from those guys still checking the forums after DMCA takes.

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
 Share

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