
tracers()
{
	level endon("wwx_gameover");

	ix = 0;
	iy = 0;
	iz = 0;

	wait randomInt(20) + 5;

	while(!level.wwx_gameover)
	{
		delay = level.wwx_tracersdelaymin + randomint(level.wwx_tracersdelaymax - level.wwx_tracersdelaymin);
		if(level.wwx_flakison) delay = randomInt(2) + 1;
		wait delay;

		iSide = randomInt(4);
		switch (iSide)
		{
			case 0:
				ix = level.wwx_mapArea_Min[0];
				iy = level.wwx_mapArea_Min[1] + randomInt(int(level.wwx_mapArea_Max[1] - level.wwx_mapArea_Min[1]));
				break;
			case 1:
				ix = level.wwx_mapArea_Max[0];
				iy = level.wwx_mapArea_Min[1] + randomInt(int(level.wwx_mapArea_Max[1] - level.wwx_mapArea_Min[1]));
				break;
			case 2:
				ix = level.wwx_mapArea_Min[0] + randomInt(int(level.wwx_mapArea_Max[0] - level.wwx_mapArea_Min[0]));
				iy = level.wwx_mapArea_Min[1];
				break;
			case 3:
				ix = level.wwx_mapArea_Min[0] + randomInt(int(level.wwx_mapArea_Max[0] - level.wwx_mapArea_Min[0]));
				iy = level.wwx_mapArea_Max[1];
				break;
		}
			
		//set the height as the spawnpoint level - 100
		spawnpoints = getentarray("mp_dm_spawn", "classname");
		if(!spawnpoints.size) spawnpoints = getentarray("mp_tdm_spawn", "classname");
		if(!spawnpoints.size) spawnpoints = getentarray("mp_ctf_spawn_allied", "classname");
		if(!spawnpoints.size) spawnpoints = getentarray("mp_ctf_spawn_axis", "classname");
		if(!spawnpoints.size) spawnpoints = getentarray("mp_sd_spawn_attacker", "classname");
		if(!spawnpoints.size) spawnpoints = getentarray("mp_sd_spawn_defender", "classname");
		iz = spawnpoints[0].origin[2] - 100;

		pos = (ix, iy, iz);

		if(level.wwx_tracers_sound)
		{
			tracer = spawn( "script_model", pos);
			wait 0.05;
			tracer playSound("tracer_fire");
			wait 0.5;
			playfx(level.wwx_effect["tracer"], pos);
			wait 3;
			tracer delete();
		}
		else playfx(level.wwx_effect["tracer"], pos);
	}
}

flakfx()
{
	level endon("wwx_gameover");
	level endon("stop_flak");
	level.wwx_flakison = true;

	while(level.wwx_flakison)
	{
		// wait a random delay
		delay = level.wwx_flakfxdelaymin + randomint(level.wwx_flakfxdelaymax - level.wwx_flakfxdelaymin);
		wait delay;

		if(!level.wwx_flakfx)
		{
			if(!level.wwx_axisapinsky && !level.wwx_allieapinsky && !level.wwx_paxisapinsky && !level.wwx_pallieapinsky)
				level.wwx_flakison = false;
		}
	
		// spawn object that is used to play sound
		flak = spawn ( "script_model", ( 0, 0, 0) );

		//get a random position
		xpos = level.wwx_playArea_Min[0] + randomInt(level.wwx_playArea_Width);
		ypos = level.wwx_playArea_Min[1] + randomInt(level.wwx_playArea_Length);
		zpos =  level.wwx_mapArea_Max[2] - randomInt(100);	

		position = ( xpos, ypos, zpos);

		flak.origin = position;
		wait .05;
		
		// play effect
		flak playsound("flak_explosion");

		playfx(level.wwx_effect["flak_flash"], position);
		wait 0.25;
		playfx(level.wwx_effect["flak_smoke"], position);
		wait 0.25;
		playfx(level.wwx_effect["flak_dust"], position);
		wait 0.25;

		flak delete();
	}
}
