Gangs in GTA 2 Coding
The cities in GTA 2 have three gangs who try to battle for the city, and they hate each other. Below is how to set up a gang in your city. To set up a gang, go into your map (via the compiler) and add a gang zone. It is not allowed to touch any of the edges otherwise it'll say it’s an invalid zone. So, make it one cell from the edge. Call it whatever name you like. In this example, I'll call them zaibgang and copgang.
In your script file, add this:
SET_GANG_INFO ( gangname , gangers_remap , basic_weapon , angry_weapon , hate_weapon , arrow_id , X , Y , Z , respect_value , car , car_remap )
Do this for all your gangs. The basic_weapon is used for killing other gangs’ members if they don’t like you (one or two bars). The angry_weapon is when you have butchered quite a few of them and hate_weapon is when the gang really hates the player! This is when the bar is flashing on the negative side. The arrow_id parameter is the colour of their arrow (further down page). The coordinates are to direct the player to one of their phones for info or something. The respect_value is how much the bar should change by when a gang member is killed by the player, usually set to 1, although some people have it higher.
The rest of the code is easy to follow. So, you could have something like this:
SET_GANG_INFO ( copgang , 0 , pistol , machine_gun , rocket_launcher , 4 , 12.5 , 6.5 , 2.0 , 1 , copcar , -1 )
And you need to repeat it for every gang you have.
Now, when you load up your map, you have the two gangs. But they don’t do anything do they? This is where you need to set the kill reaction. Add this just below your gang info:
SET_GANG_KILL_REACTION ( gangone , gangtwo , value )
The gangeone and gangtwo are for two of your created gangs. So, in my example, my code would look like this:
SET_GANG_KILL_REACTION ( zaibgang , copgang , 1 )
SET_GANG_KILL_REACTION ( copgang , zaibgang , 1 )
What this means is that copgang hates zaibgang and when the player shoots a zaibgang, respect from the copgang goes up by one. The second gang in the line hates the first gang in the line. So the first line means copgang hates zaibgang, and the second line is zaibgang hate copgang.
Sounds confusing, try it and see what happens! And now, for the arrow_id info:
| Arrow | Icon | |
|---|---|---|
1
| ||
2
| ||
3
| ||
4
| ||
5
| ||
6
| ||
7
|
Gang Cars
If you want gang cars driving around, you have to do a MAP_ZONE command (before the LEVELSTART command). Below is an example:
MAP_ZONE City01 = ( 1000 , 350 , 200 , 0 , 1000 , 100 , 100 , 100 , 700 , 0 , 450 )
If you check out page 22 of the scripting document, it tells you about what each value is.
Redneck Gang
The Redneck gang is a special gang in GTA 2 due to the fact they have red-haired and blonde-haired people walking around and part of the same gang. To make it work, just use the following code:
SET_GANG_INFO ( madgang , 6 , SHOTGUN , SHOTGUN , SHOTGUN , 0 , 0.0 , 0.0 , 0.0 , 0 , PICKUP , -1 )
SET_GANG_INFO ( madgang , 5 , SHOTGUN , SHOTGUN , SHOTGUN , 0 , 0.0 , 0.0 , 0.0 , 0 , PICKUP , -1 )
I've tried it with remap 5 on top, but only the red heads come out, so I assume it is highest number first, then lower. I've tried it with the police remaps too, but nothing works, and I think it’s special to this gang only. If you can work out if it works with other gangs, e-mail in and I'll try it out and it'll be added!
(Originally written by Chris “Pyro” Hockley and formatted by Ben “Cerbera” Millard with full permission.)