sebejszczyn Posted August 10 Share Posted August 10 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 More sharing options...
OrionSR Posted August 11 Share Posted August 11 (edited) 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 August 11 by OrionSR Link to comment Share on other sites More sharing options...
sebejszczyn Posted August 13 Author Share Posted August 13 (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 August 13 by sebejszczyn Link to comment Share on other sites More sharing options...
sebejszczyn Posted August 25 Author Share Posted August 25 (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 August 25 by sebejszczyn Link to comment Share on other sites More sharing options...
OrionSR Posted August 25 Share Posted August 25 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 More sharing options...
sebejszczyn Posted August 25 Author Share Posted August 25 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now