Multiplayer in GTA 2 Mission Scripts

After a discussion about mission templates, I wrote and tested the code below. It defines 6 players, 6 cars, a weapon and some general environment stuff. This can be used a basis for any level, without asking me.

It goes with an .mmp file to provide 1-6 player support with just 3 files. This will only work with GTA2 v11.3 by Vike or newer. Older GTA2 versions require 5 more .mmp files and up to 10 extra mission files!

Download the Multiplayer Template (4kB)
Updated on 17th April 2011.

You may change and share this template without asking me. I’m BenMillard in GTA 2 Game Hunter.

One Script to Rule Them All…

Create a text file and change it from untitled.txt to yourlevel.mis.

// GTA2 Test Script
// by Pyro & BenMillard, April 2011
// http://projectcerbera.com/gta/2/tutorials/multiplayer

// Weapons
// Note: This respawns instantly and gives maximum ammo.
GENERATOR rocket1 = (128.0,128.0) 0 COLLECT_02 0 0 99 // Rocket Launcher

// Player Cars:
PARKED_CAR_DATA p1car = (126.5,126.5) 35 225 VTYPE // Yellow
PARKED_CAR_DATA p2car = (126.5,129.5) 20 315 VTYPE // Green
PARKED_CAR_DATA p3car = (129.5,129.5) 28 045 VTYPE // Red
PARKED_CAR_DATA p4car = (129.5,126.5) 15 135 VTYPE // Orange
PARKED_CAR_DATA p5car = (128.0,130.2) 24 000 VTYPE // Blue
PARKED_CAR_DATA p6car = (125.8,128.0) 14 270 VTYPE // Dark Blue
// PARKED_CAR_DATA p7car = (125.8,128.0) 21 270 VTYPE // Grey

// Players
/*
 p1    p4
p6  RL = (128.0,128.0)
 p2 p5 p3
*/
PLAYER_PED p1 = (127.0,127.0,255.0) 07 045 // Yellow Scientist
PLAYER_PED p2 = (127.0,129.0,255.0) 11 135 // Green Loonie
PLAYER_PED p3 = (129.0,129.0,255.0) 10 225 // Red Russian
PLAYER_PED p4 = (129.0,127.0,255.0) 09 315 // Orange Krishna
PLAYER_PED p5 = (128.0,129.5,255.0) 05 180 // Blue Redneck
PLAYER_PED p6 = (126.5,128.5,255.0) 13 090 // Dark Blue Yakuza
// PLAYER_PED p7 = (126.5,128.5,255.0) 08 090 // Grey Zaibatsu

// Counters
COUNTER stage = 1



// End of objects...
LEVELSTART
// ...start of commands.



// Environment
SET_SHADING_LEVEL (20) // building sides
SET_AMBIENT_LEVEL (0.75, 0) // reduce after adding lights
SET_DIR_OF_TV_VANS (128.0,128.0) // savepoint or key location
DECLARE_POLICELEVEL (4) // 1 weak; 2 strong; 3 roadblocks; 4 SWAT; 5 FBI; 6 Army
// Note: Army in multiplayer needs Vike’s GTA2 v11.3 or newer.

// Weapons
SWITCH_GENERATOR (rocket1, ON)

// Starting Money
IF (CHECK_CHARACTER_HEALTH (p1, 0))
 ADD_SCORE (p1, 50000)
ENDIF
IF (CHECK_CHARACTER_HEALTH (p2, 0))
 ADD_SCORE (p2, 50000)
ENDIF
IF (CHECK_CHARACTER_HEALTH (p3, 0))
 ADD_SCORE (p3, 50000)
ENDIF
IF (CHECK_CHARACTER_HEALTH (p4, 0))
 ADD_SCORE (p4, 50000)
ENDIF
IF (CHECK_CHARACTER_HEALTH (p5, 0))
 ADD_SCORE (p5, 50000)
ENDIF
IF (CHECK_CHARACTER_HEALTH (p6, 0))
 ADD_SCORE (p6, 50000)
ENDIF

// Unlimited Standard Weapons
WHILE_EXEC (stage = 1)
 IF (CHECK_CHARACTER_HEALTH (p1, 0))
  GIVE_WEAPON (p1,     MACHINE_GUN, 99)
  GIVE_WEAPON (p1, ROCKET_LAUNCHER, 99)
  GIVE_WEAPON (p1,   FLAME_THROWER, 99)
  GIVE_WEAPON (p1,         MOLOTOV, 99)
 ENDIF
 IF (CHECK_CHARACTER_HEALTH (p2, 0))
  GIVE_WEAPON (p2,     MACHINE_GUN, 99)
  GIVE_WEAPON (p2, ROCKET_LAUNCHER, 99)
  GIVE_WEAPON (p2,   FLAME_THROWER, 99)
  GIVE_WEAPON (p2,         MOLOTOV, 99)
 ENDIF
 IF (CHECK_CHARACTER_HEALTH (p3, 0))
  GIVE_WEAPON (p3,     MACHINE_GUN, 99)
  GIVE_WEAPON (p3, ROCKET_LAUNCHER, 99)
  GIVE_WEAPON (p3,   FLAME_THROWER, 99)
  GIVE_WEAPON (p3,         MOLOTOV, 99)
 ENDIF
 IF (CHECK_CHARACTER_HEALTH (p4, 0))
  GIVE_WEAPON (p4,     MACHINE_GUN, 99)
  GIVE_WEAPON (p4, ROCKET_LAUNCHER, 99)
  GIVE_WEAPON (p4,   FLAME_THROWER, 99)
  GIVE_WEAPON (p4,         MOLOTOV, 99)
 ENDIF
 IF (CHECK_CHARACTER_HEALTH (p5, 0))
  GIVE_WEAPON (p5,     MACHINE_GUN, 99)
  GIVE_WEAPON (p5, ROCKET_LAUNCHER, 99)
  GIVE_WEAPON (p5,   FLAME_THROWER, 99)
  GIVE_WEAPON (p5,         MOLOTOV, 99)
 ENDIF
 IF (CHECK_CHARACTER_HEALTH (p6, 0))
  GIVE_WEAPON (p6,     MACHINE_GUN, 99)
  GIVE_WEAPON (p6, ROCKET_LAUNCHER, 99)
  GIVE_WEAPON (p6,   FLAME_THROWER, 99)
  GIVE_WEAPON (p6,         MOLOTOV, 99)
 ENDIF
ENDWHILE

LEVELEND

Change the locations to fit in your level. This can be used for any number of players because GTA2 only shows the players who have joined. In single player, only p1 will be shown.

Extra weapon and vehicles can be copied and pasted to fill up your map.

You have to compile your .mis into a .src for it to work. I use Delfi’s Mis Pad.

Multiplayer Map Packages (*.mmp)

Any number of players can be supported from a single .mmp file, so long as all players use Vike’s GTA2 v11.3 or newer.

For the mapname.mmp file, used only with Vike’s version:

[MapFiles]
GMPFile = mapname.gmp
STYFile = mapname.sty
SCRFile = mapname.scr
Description = My New Level

Single Player Missions

Your multiplayer level might have single player missions which might crash if other players are in the game. These must go in a separate .scr with a separate .mmp as well.

For the single-player mapname1p.mmp file:

[MapFiles]
GMPFile = mapname.gmp
STYFile = mapname.sty
SCRFile = mapname1p.scr
Description = My New Level 1 Player
PlayerCount = 1

For the multi-player mapname.mmp file:

[MapFiles]
GMPFile = mapname.gmp
STYFile = mapname.sty
SCRFile = mapname.scr
Description = My New Level

Older GTA2 Versions

These require a separate .mmp for each number of players. You can share the .scr and all other files.

For the 2-player mapname2p.mmp file:

[MapFiles]
GMPFile = mapname.gmp
STYFile = mapname.sty
SCRFile = mapname.scr
Description = My New Level 2 Players
PlayerCount = 2

For the 6-player mapname6p.mmp file:

[MapFiles]
GMPFile = mapname.gmp
STYFile = mapname.sty
SCRFile = mapname.scr
Description = My New Level 6 Players
PlayerCount = 6