adding new GameType - help!


(MNunes7) #1

[/i]Hi there!
What do i have to do to add a new gametype? like Team Deathmach…

Thanks!
Miguel


(Lanz) #2

Start with adding the new gametype to the gametype_t enum in bg_public.h, like this for example:


typedef enum {
	GT_SINGLE_PLAYER,
	GT_COOP,
	GT_WOLF,
	GT_WOLF_STOPWATCH,
	GT_WOLF_CAMPAIGN,	// Exactly the same as GT_WOLF, but uses campaign roulation (multiple maps form one virtual map)
	GT_WOLF_LMS,
	GT_WOLF_POWERBALL,	// Lanz
	GT_WOLF_CTF,		// Lanz
	GT_MAX_GAME_TYPE
} gametype_t;

Then it’s just a question of adding the code special to your mod and use if (g_gametype.integer == GT_WOLF_???) around it so it only excecutes when your gametype is running or make sure it’s not executed sometimes.

Here’s a simple example taken randomly from my code:


	// Lanz: Check for win by reaching score limit in powerball and ctf
	if (g_gametype.integer >= GT_WOLF_POWERBALL && g_scorelimit.integer) {
		if (!level.teamWinTime) {
			if (level.teamScores[TEAM_AXIS] != level.teamScores[TEAM_ALLIES]) {
				if (level.teamScores[TEAM_AXIS] >= g_scorelimit.integer) {
					level.teamWinTime = level.time;
					level.pbWinningTeam = TEAM_AXIS;
					return;
				} else if (level.teamScores[TEAM_ALLIES] >= g_scorelimit.integer) {
					level.teamWinTime = level.time;
					level.pbWinningTeam = TEAM_ALLIES;
					return;
				}
			}	
 .....

etc etc…


(MNunes7) #3

at ET source right?


(Lanz) #4

Yeah in the ET source files.


(FREAK!!!) #5

don’t forget add these new gametypes on the clientside and the uim so you can start/find games from the menu, and not only use the console.