Object, weapon and power-up placement (GTA2)

Main Page > GTA2 > Modding Tutorial > Creating objects, pick-ups and weapons


This chapter is about creating objects, such as weapons, power-ups or generic objects. This is done with the same command.

OBJ_DATA

OBJ_DATA name = ( X.x , Y.y , Z.z ) rotation object ammo 
Name An unique name
( X.x , Y.y , Z.z ) The coordinates
Rotation The rotation of the object. This is normally '0' when placing weapons or power-ups.
object Which object, weapon or power-up you want to create. See the code lists below.
ammo The amount of ammo you want when placing a weapon. Leave this out if you're placing an object or a power-up.

This command goes before LEVELSTART

Examples

If you want to create an instant vehicle bomb at the coordinates 119, 54, 2, the command will look like this:

OBJ_DATA instantbomb = ( 119.5 , 54.5 , 2.0 ) 0 COLLECT_23 1 

And if you want to create a suitcase at 107, 67, 3, rotated 45 degrees, the command will look like this:

OBJ_DATA suitcase = ( 107.5 , 67.5 , 3.0 ) 45 BRIEFCASE

GENERATORs

You'll often want to create a respawning pick-up. This is done with GENERATORs. Generators are slightly more complicated than normal OBJ_DATA commands and consist of two parts. The first part looks like this:

GENERATOR name = ( X.x , Y.y , Z.z ) rotation pickup_type timer_min timer_max ammo 
Name An unique name. You'll need this name later, so choose recognisable names.
( X.x , Y.y , Z.z ) The coordinates
Rotation The rotation of the weapon.
pickup_type The weapon or power-up type you want to spawn.
timer_min The minimum amount of cycles before the weapon can respawn. 1800 cycles is about one minute.
timer_max The maximum amount of cycles before the weapon can respawn.
ammo The amount of ammo. Leave out if you're creating a power-up.

This part of the generator command only declares where the generator should be and what it should create. Therefore, it goes before LEVELSTART. Generators are turned of by default and have to be turned on with a command after LEVELSTART.

SWITCH_GENERATOR ( generator_name , ON/OFF/value ) 
generator_name The name of the generator you've used earlier.
ON/OFF/value With "ON" and "OFF" you can activate or deactivate the generator. You can also give the GENERATOR a value to make it create a set amount of weapons before it shuts itself down.

Note that GTA2 cannot handle more than 120 GENERATORs.

Example

If you want to create a shotgun with 15 ammo at the coordinates 131, 98, 2, which respawns at least every two minutes, the command will look like this:

GENERATOR respawningshotgun = ( 131.5 , 98.5 , 2.0 ) 0 COLLECT_06 3000 3600 15

LEVELSTART

SWITCH_GENERATOR ( respawningshotgun , ON )

LEVELEND

Code lists

This list contains all objects which can be used in GTA2. A lot of objects are remnants of unused features and may be glitchy. GTA Scripting.doc also mentions the objects CROSS, GRAVE and FBI BLOCK, but these objects aren't recognised by the compiler.

Weapons

Weapon Code Code (moving)
Pistol COLLECT_00 MOVING_COLLECT_00
S-Uzi machine gun COLLECT_01 MOVING_COLLECT_01
Rocket launcher COLLECT_02 MOVING_COLLECT_02
Electrogun COLLECT_03 MOVING_COLLECT_03
Molotov cocktails COLLECT_04 MOVING_COLLECT_04
Grenades COLLECT_05 MOVING_COLLECT_05
Shotgun COLLECT_06 MOVING_COLLECT_06
Electro baton COLLECT_07 MOVING_COLLECT_07
Flame thrower COLLECT_08 MOVING_COLLECT_08
Silenced S-Uzi machine gun COLLECT_09 MOVING_COLLECT_09
Dual pistol COLLECT_10 MOVING_COLLECT_10
Empty slot: yellow L COLLECT_11 MOVING_COLLECT_11
Empty slot: yellow M COLLECT_12 MOVING_COLLECT_12
Empty slot: yellow N COLLECT_13 MOVING_COLLECT_13
Empty slot: yellow O COLLECT_14 MOVING_COLLECT_14
Vehicle bomb COLLECT_15 MOVING_COLLECT_15
Vehicle oil slick COLLECT_16 MOVING_COLLECT_16
Vehicle mines COLLECT_17 MOVING_COLLECT_17
Vehicle machine guns COLLECT_18 MOVING_COLLECT_18
Vehicle rocket launcher COLLECT_19 MOVING_COLLECT_19
Vehicle water canon COLLECT_20 MOVING_COLLECT_20
Vehicle flame thrower COLLECT_21 MOVING_COLLECT_21
Armed Land Roamer machine gun COLLECT_22 MOVING_COLLECT_22
Instant vehicle bomb COLLECT_23 MOVING_COLLECT_23

Power-ups

Power-up Code Code (moving)
Empty slot: blue J COLLECT_24 MOVING_COLLECT_24
Empty slot: blue K COLLECT_25 MOVING_COLLECT_25
Empty slot: blue L COLLECT_26 MOVING_COLLECT_26
Empty slot: blue M COLLECT_27 MOVING_COLLECT_27
Multiplier +1 COLLECT_28 MOVING_COLLECT_28
Life +1 COLLECT_29 MOVING_COLLECT_29
Health COLLECT_30 MOVING_COLLECT_30
Armor COLLECT_31 MOVING_COLLECT_31
Get outta jail freecard COLLECT_32 MOVING_COLLECT_32
Cop bribe COLLECT_33 MOVING_COLLECT_33
Invulnerability* COLLECT_34 MOVING_COLLECT_34
Double damage COLLECT_35 MOVING_COLLECT_35
Fast reload COLLECT_36 MOVING_COLLECT_36
Electrofingers COLLECT_37 MOVING_COLLECT_37
Respect! COLLECT_38 MOVING_COLLECT_38
Invisibility COLLECT_39 MOVING_COLLECT_39
Instant gang COLLECT_40 MOVING_COLLECT_40

Objects

Object Code
BENCH Bench, only movable with a car.
BIN Garbage bin, almost unmovable.
BIN_LID lid of a garbage bin, only movable on foot.
BLASTER Ghetto blaster with sound
BLOOD Blood stain of GTA1.
BONUS_TOKEN GTA2 Bonus badge
BOMB Bomb HUD image
BOXES Two cardboard boxes. Fall apart when you drive or walk over them.
BRIEFCASE Briefcase in blue circle.
CAR_SHOP Max Paynt, see Scripten car shops
CONE traffic cone, movable.
CRATE Crate. Falls apart when you drive or walk over it.
FOOTY Soccer ball, movable.
HARDBOX Box, movable
HYDRANT Pipe, unmovable.
HYDRANT_LID Lid of a pipe, movable.
HYDRANT_UNLID Pipe without lid, unmovable.
INVISIBLE_TARGET Invisible target for Tanks
INVISIBLE_DESTRUCTIBLE Invisible roadblock
INVISIBLE_DEAD Wrecked invisible roadblock
MINE Vehicle mine
NEWSDIS News stand, movable
OIL Vehicle oil slick
ANIMATING_OIL Animation of a vehicle oil slick
OILDRUM Oil barrel, movable.
PACKAGE Package, movable.
PHONE Standard (blue) telephone
GREEN_PHONE Green telephone
YELLOW_PHONE Yellow telephone
RED_PHONE Red telephone
POWERGEN Generator
POWERGEN_DEAD Wrecked generator
RED_FOOTPRINTS Two red footprints
REMOTE RC Badge
ROADBLOCK Roadblock, only movable by car.
RUBBISH Rubbish. Falls apart when you drive or walk over it.
TRAFFIC_LIGHT Stoplicht, blijft op rood staan.
TYRE Autoband, verplaatsbaar met een auto of te voet.
TUNNEL_BLOCKER Train tunnel block: only trains can pass through it.
KILL_FRENZY Kill Frenzy bagde
Modding tutorials of Grand Theft Auto 2
Mapping Map Editor · Buildings · Roads · Water & animations · Slopes · Flat tiles · Collision info · Level edge · Zones · Putting a level ingame
Scripting Declarering: Main script · Script Compiler · Code lists · Commands · Vehicles · Objects · Sounds · Characters
Programming: IF · WHILE · COUNTERs · Subroutines · THREAD TRIGGERs · Kill Frenzies
Both Manual · Lighting · Car shops · Cranes & crushers · Gangs · Subway · Multiplayer levels
File types .gci · .gmp · .gxt · .mis · .mmp · .scr · .seq · .tmp · .sty
Other Texting · Physics · Creating vehicles · Terminology · Installing levels