Garages in GTA 2 Mission Scripts
This entire guide will detail on how to create an entire garage system, from how to make the garage in the map editor, doors and how to make it used in missions.
Parking
If you want to know how to make a garage actually take a car in for a mission, this is how to set it up:
PARK (car_name, door_name)
Set the car_name
to a previously declared car, and the door_name
to a previously made door (see below). An example:
PARK (enemy_limo, zaibatsu_garage)
In your map, you’ll need enough space for the car to go in nicely. If you have a single door, you’ll need one block on either side of the door and three blocks depth for long vehicles (a 3×3 area).
If you have a double door, you need two blocks on either side of the door and again three blocks depth for long vehicles (a 6×3 cube area). You must have these sizes (or larger) or else you might end up with an error. Once the car has entered, the car is effectively destroyed along with any other passengers. The player simply runs out of the garage.
The entrance must have nothing there, as the door is created in the script. An example:
You can then do a simple check in an IF
statement to see if the parking is complete, returns TRUE
if it has finished:
HAS_PARK_FINISHED ()
Doors
To make a fully working garage, you’ll need a door for it. Since you (should) have made the garage area in the map editor (see above), you just need to add the code before the LEVELSTART
command.
DECLARE_DOOR_INFO (frame_start, frame_end, speed)
The start and end frames are the tile numbers in the map editor, so in the bil.gmp map, the first tile would be 928
, whilst the last frame is 935
. The speed is then set to 2
which is reasonably fast. So for the above, the code would be:
DECLARE_DOOR_INFO (928, 935, 2)
Next up, we tell the game where the door will be placed. There are 3 flavours of doors:
DOOR_DATA name = STYLE (X,Y,Z)
(check_X,check_Y,check_Z, check_width,check_height)
FACE gfx_id OPEN_TYPE CLOSE_TYPE delay FLIP REVERSE
DOOR_DATA name = STYLE (X,Y,Z)
(check_X,check_Y,check_Z, check_width,check_height)
FACE gfx_id OPEN_TYPE CLOSE_TYPE delay FLIP REVERSE second_item
DOOR_DATA name = STYLE (X,Y,Z)
(check_X,check_Y,check_Z, check_width,check_height)
FACE gfx_id OPEN_TYPE CLOSE_TYPE delay FLIP REVERSE value
Value | Description | |
---|---|---|
name
| unique string | Identifies this door so you can apply commands to it. |
STYLE
| SINGLE
| One cube wide. |
DOUBLE
| Two cubes wide. Second cube is added on the clockwise side. | |
X,Y,Z
| 0 to 255
| Integer values of where to place the door. |
check_X,check_Y,check_Z
| 0.0 to 255.99
| Float values describing where the door check area will be. |
check_width,check_height
| 0.0 to edge of level?
| Float value of the trigger position for when the door opens. |
FACE
| TOP
| North |
BOTTOM
| South | |
LEFT
| West | |
RIGHT
| East | |
gfx_id
| 0 to 999
| Integer describing which DOOR_INFO to use for this door.
|
OPEN_TYPE
| ANY_PLAYER
| All human characters. |
ANY_CAR
| All vehicles. | |
ONE_CAR
| Use second_item for the name of car.
| |
ONE_MODEL
| Use second_item for the car type.
| |
ONE_CHAR_ON_FOOT
| Use second_item for the name of character.
| |
ANY_PLAYER_ONE_CAR
| Use second_item for the name of car driven by a player.
| |
CLOSE_TYPE
| CLOSE_NEVER
| Does not shut after being opened. |
CLOSE_TIME_DELAY
| Waits according to the value for delay .
| |
CLOSE_WHEN_CLEAR
| Shuts when nothing will get trapped. | |
CLOSE_WHEN_OPEN_RULE_FAILS
| Shuts when the OPEN_TYPE rule is not being fulfilled.
| |
delay
| 0 to 255
| An integer value to wait before the door closes. |
FLIP
| FLIP_RIGHT
| The right hand door images is graphically flipped. |
NOT_FLIPPED
| Default display. | |
REVERSE
| REVERSED
| For when two separate doors are on one block. |
NOT_REVERSED
| Normal. | |
second_item
| Name of an object | Used when open_type is neither ANY_CAR nor ANY_PLAYER .
|
value
| 0 to 255
| Reserved but not used - you do not need any sort of value for it. |
An example would be:
DOOR_DATA door_1 = DOUBLE (238,112,2)
(238.0,112.0,2.0, 4.0,2.0)
LEFT 0 ANY_PLAYER CLOSE_WHEN_OPEN_RULE_FAILS 0 FLIP_RIGHT NOT_REVERSED
Quite long for a door command, but it has to be done! If you want to open the door yourself, you have various commands at your dispsoal. Firstly, tell it the name of the door to make manual.
MAKE_DOOR_MANUAL (doorname)
Open the selected door:
OPEN_DOOR (doorname)
Close the selected door:
CLOSE_DOOR (doorname)
Or you can make the door back to being computer controlled with the commands above. This is the default state for all doors:
MAKE_DOOR_AUTOMATIC (doorname)
(Originally written by Chris “Pyro” Hockley and formatted by Ben “Cerbera” Millard with full permission.)