Creating gangs (GTA2)
Gangs are very important in GTA2. To create them, you first need to create a level big enough for gangs. For this tutorial, the test level has been expanded to have enough room for a gang.
First, we are going to determine which area of the map will become a gang turf by creating a gang zone. Place the zone exactly over the area you want the gang to control, but make sure there's at least one complete circle of roads within the zone. This is important because gang cars may not spawn if there isn't a circle in the gang zone.
Give the zone a clear name, because you'll need to refer to it in the script. The first four letters of the name must be unique for every gang. The gang zone of our test gang could have the name "testgang".
To control the ammount of gang members and gang cars in the map, you'll need to add a information zone. Place this zone over the gang zone and give it an unique, clear name. The information zone in this tutorial could be called "testinfo".
Gangs can have multiple gang and information zones. You can give zones of the same type the same name if there's no need for multiple codes.
Scripting gang characteristics
The gang zone tells the game there's a gang in that area, but not what gang. This is declared with the SET_GANG_INFO in the script. Add the following command to your script:
SET_GANG_INFO ( gang_zone , outfit , weapon1 , weapon2 , weapon3 , ID , X.x , Y.y , Z.z , respect , car , car_color )
|gang_zone||The name of the gang zone you added with the map editor|
|outfit||The outfit of the gang members|
|weapon1||The weapon gang members always carry|
|weapon2||The weapon gang members use when they have -3 respect for you.|
|weapon3||The weapon gang members use when they have -5 respect for you.|
|ID||The ID of the gang. This sets the color, arrow and icon of the gang.|
|X.x , Y.y , Z.z||The coordinates of the center of the gang. The arrow points to this location, so it normally should be where the info telephone is.|
|respect||The ammount of respect which will change when you kill a gang member, ranging from -100 to 100. The default value is 1.|
|car||The gang car the gang should use. This doesn't have to be a standard gang car, but you can't use cars with a designated function, like Cop Cars or Tanks. Also, make sure the icon fits on top of the car.|
|car_color||The color of the gang car.|
If you want to create a Zaibatsu gang with 244, 108, 2 as center, the code will be:
SET_GANG_INFO ( zaibatsugang , 8 , PISTOL , MACHINE_GUN , ROCKET_LAUNCHER , 3 , 110.5 , 75.5 , 3.0 , 1 , VTYPE , 2 )
To set the "rivalry" between the gangs, you use the following command:
SET_GANG_KILL_REACTION ( gang1 , gang2 , respect )
|gang1||The name of the gang which gang member gets killed. The first four letters must be identical to the first four of the gang zone.|
|gang2||The name of the gang which respect should change. The first four letters must be identical to the first four of the gang zone.|
|respect||The ammount of respect which will change, ranging from -100 to 100. The default value is 1.|
This is a SET command, and therefore goes after LEVELSTART
If you have three gangs, of which the Loonies hate the Zaibatsu, the Zaibatsu hate the Yakuza and the Yakuza hate the Loonies, the commands will be:
SET_GANG_KILL_REACTION ( Zaibatsugang , Looniegang , 1 ) SET_GANG_KILL_REACTION ( Yakuzagang , Zaibatsugang , 1 ) SET_GANG_KILL_REACTION ( Looniegang , Yakuzagang , 1 )
Scripting zone info
You now have functional gangs, but you may want to change the ammount of gang members, cars, police, normal pedestrians, etc. in your gang area. This can be done with this command:
MAP_ZONE zone_name = ( car_ratio , good_cars, bad_cars , cop_cars , ped_ratio , pickpockets , car_thiefs , elvis , gang_members , cops , gang_cars )
|zone_name||The name of the information zone you created with the map editor|
|car_ratio||The total ammount of cars that should drive in this zone. The maximum is 1000|
|good_cars||The ammount of "good" cars|
|bad_cars||The ammount of "bad" cars|
|cop_cars||The ammount of Cop Cars|
|ped_ratio||The total ammount of pedestrians that should drive in this zone. The maximum is 1000|
|pickpockets||The ammount of pickpockets|
|car_thiefs||The ammount of car thiefs|
|elvis||The ammount of Elvis-chains|
|gang_members||The ammount of gang members. If there is no gang zone covering this area, generic non-hostile gang members wil be created.|
|cops||The ammount of cops patrolling the area. If there is no wanted level, no cops will spawn and this value will be added to the normal ped ratio.|
|gang_cars||The ammount of gang cars. If there is no gang zone covering this area, no gang cars will spawn and this value will be added to the "average" car ratio.|
The variables "average_cars" and "normal_peds" are calculated with the next formula:
- 1000 - (
gang_cars) = average_cars
- 1000 - (
gang_members) = normal_peds
So, the sum of all ped variables and the sum of all car variables must both add up to 1000.
This command goes before LEVELSTART. Of course, you can use this command for any area in your level, not just gang area's.
If you want a rich neighbourhood with lots of nice cars and a low crime rate, the command could look like this:
MAP_ZONE starfishisland = ( 1000 , 600, 200 , 100 , 1000 , 20 , 20 , 100, 0 , 100 , 0 )
If you want to create a ghetto with roaming gang members, crappy cars and few cops patrolling the area, the command could look like this:
MAP_ZONE Littlehaiti = ( 1000 , 150, 300 , 10 , 1000 , 200 , 100 , 10 , 500 , 10 , 400 )
Changing MAP_ZONE ratios
It is possible to change the ratios of a MAP_ZONE midgame. To do this, you first have to declare a zone with this command:
After that, you can change it's values with the following commands after LEVELSTART:
SET_CARDENSITY ( zone_name , value ) SET_GOODCAR_RATIO ( zone_name , value ) SET_BADCAR_RATIO ( zone_name , value ) SET_POLICECAR_RATIO ( zone_name , value ) SET_PEDDENSITY ( zone_name , value ) SET_MUGGER_RATIO ( zone_name , value ) SET_CARTHIEF_RATIO ( zone_name , value ) SET_ELVIS_RATIO ( zone_name , value ) SET_GANG_RATIO ( zone_name , value ) SET_POLICEPED_RATIO ( zone_name , value )
- It's possible to create more or less than three gangs. You can also create "invisible" gangs, without a respect-o-meter and icon. To do this, you have to set the respect values to '0' and give it ID 8. Invisible gangs are used for the gang on Mad Island in the Industrial District and the inmates of the Alma Mater State Prison in the Residential District.
- It is possible to create gangs in multiplayer levels, but their weapon will not change when their respect for you drops.
|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|