-----------------------------------------------------------------------------
-- Site 5
-----------------------------------------------------------------------------

-- PostStage

function PostStage()
    EntGame.EnablePlayerControl(false);
    EntGame.ClearFlag(GF_READYTOSTART);
    EntGame.BindCameraToEntity("IntroCamera");
    end;     
    
-----------------------------------------------------------------------------    
-- Setup

function Setup()
    -- turn on the "Game running" menu - may not be needed for this game
    EntGame.PushMenu("MenuGameRunning");

    -- load world
    SetupWorld("Maps\\Site5\\Site5.ini", "","","");
    EntGame.CreatePlayerEntities();
    
	-- do any setup that is specifically for testing.
	if (EntGame.TestingLevels()) then
		Testing();
		end;  
		
	EntGame.SetGlobalDustColorInitial(1.0, 1, 1, 1);
    EntGame.SetGlobalDustColorFinal  (0.0, .8, .8, .8);
    
    EntGame.SetStageTimer(150);
    
    EntGame.LoadAnimal(AID_GOOSE);
    EntGame.LoadAnimal(AID_GROUSE);
	EntGame.LoadAnimal(AID_MOOSE);	
	EntGame.LoadAnimal(AID_ELK_M);
	EntGame.LoadAnimal(AID_ELK_F);
        
    -- setup tournament logic    
    EntGame.StagePrepare();           

    -- show the scene from the intro camera
    EntGame.BindCameraToEntity("IntroCamera");
    
    -- tell the game the world has loaded
    Entity.GameEventPre(Game.GetRootEntity(), GE_WORLDLOADED, 0);	

    -- wait until the intro dialog is dispatched
    while (EntGame.GetFlag(GF_READYTOSTART) == false) do
        Script.WaitFrame(1);
        end;

    -- do a fade out        
    FadeOut();
    Script.WaitSec(0.5);       
	
	end;
---------------------------------------------------------------------------------
function Intro()

	EntGame.PlaySong("Music\\HillbillyBeatdown.ogg");
     
   	EntGame.SpawnAnimalOnPath(AID_MOOSE, "ObservationPath", 0, ST_GRAZING, 5, 0, 0, 1.2); 
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "ObservationPath", 2, ST_GRAZING, 5, 0, 0, 1.2);  
   	EntGame.SpawnAnimalOnPath(AID_ELK_M, "ObservationPath", 1, ST_GRAZING, 5, 0, 0, 1.2);
	
	entTrainCamera = Entity.FindName(entRoot, "TrainCamera1");
	if (entTrainCamera) then
	    Camera.JumpToWaypoint(entTrainCamera, "TrainWptBB");
	    end;			
	entTrainCamera2 = Entity.FindName(entRoot, "TrainCamera2");
	if (entTrainCamera2) then
	    Camera.JumpToWaypoint(entTrainCamera2, "TrainWptGG");
	    end;	
	entTrainCamera3 = Entity.FindName(entRoot, "TrainCamera3");
	if (entTrainCamera3) then
	    Camera.JumpToWaypoint(entTrainCamera3, "TrainWptGG");
	    end;	
	entTrainCamera4 = Entity.FindName(entRoot, "TrainCamera4");
	if (entTrainCamera4) then
	    Camera.JumpToWaypoint(entTrainCamera4, "TrainWptGG");
	    end;
	entTrainCamera5 = Entity.FindName(entRoot, "TrainCamera5");
	if (entTrainCamera5) then
	    Camera.JumpToWaypoint(entTrainCamera5, "TrainWptGG");
	    end;
	entTrainCamera6 = Entity.FindName(entRoot, "TrainCamera6");
	if (entTrainCamera6) then
	    Camera.JumpToWaypoint(entTrainCamera6, "TrainWptGG");
	    end;
	entTrainCamera7 = Entity.FindName(entRoot, "TrainCamera7");
	if (entTrainCamera7) then
	    Camera.JumpToWaypoint(entTrainCamera7, "TrainWptGG");
	    end;
	entTrainCamera8 = Entity.FindName(entRoot, "TrainCamera8");
	if (entTrainCamera8) then
	    Camera.JumpToWaypoint(entTrainCamera8, "TrainWptGG");
	    end;
	entTrainCamera9 = Entity.FindName(entRoot, "TrainCamera9");
	if (entTrainCamera9) then
	    Camera.JumpToWaypoint(entTrainCamera9, "TrainWptGG");
	    end;
	entTrainCamera10 = Entity.FindName(entRoot, "TrainCamera10");
	if (entTrainCamera10) then
	    Camera.JumpToWaypoint(entTrainCamera10, "TrainWptGG");
	    end;
	entTrainCamera11 = Entity.FindName(entRoot, "TrainCamera11");
	if (entTrainCamera11) then
	    Camera.JumpToWaypoint(entTrainCamera11, "TrainWptGG");
	    end;	
	entTrainCamera12 = Entity.FindName(entRoot, "TrainCamera12");
	if (entTrainCamera12) then
	    Camera.JumpToWaypoint(entTrainCamera12, "TrainWptGG");
	    end;	
	entTrainCamera13 = Entity.FindName(entRoot, "TrainCamera13");
	if (entTrainCamera13) then
	    Camera.JumpToWaypoint(entTrainCamera13, "TrainWptGG");
	    end;	
	entTrainCamera14 = Entity.FindName(entRoot, "TrainCamera14");
	if (entTrainCamera14) then
	    Camera.JumpToWaypoint(entTrainCamera14, "TrainWptGG");
	    end;
	entTrainCamera15 = Entity.FindName(entRoot, "TrainCamera15");
	if (entTrainCamera15) then
	    Camera.JumpToWaypoint(entTrainCamera15, "TrainWptGG");
	    end;
		
     -- now, fade in, give the player control and turn the HUD on        
    EntGame.BindCameraToEntity("CountdownCamera3");
    FadeIn();                    
    Script.WaitSec(1.0);      
            
    -- "3"
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_3, 0);   
    Script.WaitSec(1.0);
    
    -- "2"
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_2, 0);   
    EntGame.BindCameraToEntity("CountdownCamera2");
    Script.WaitSec(1.0);
    
    -- "1"
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_1, 0);   
    EntGame.BindCameraToEntity("CountdownCamera1");
    Script.WaitSec(1.0);
    
    -- "HUNT!"    
	EntGame.DestroyAllAnimals()
    entCamera = Entity.FindName(entRoot, "MainCamera");    
	Camera.JumpToWaypoint(entCamera, "CamWptAA");
    Camera.SetSpeed(entCamera, 0.0, 0.01);        
    EntGame.BindCameraToEntity(entCamera);        
    EntGame.BindInputToEntity("Player1");
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_HUNT, 0);     
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_START, 0);

    end;
    

-----------------------------------------------------------------------------
-- Use this function for overriding various game parameters (i.e. weapon availability, etc.)
function Testing()
    EntGame.SetPlayerWeapon(0, WS_PISTOL, 	    WID_PISTOL_1);
	EntGame.SetPlayerWeapon(0, WS_SINGLE_RIFLE, WID_SINGLE_RIFLE_2);
    EntGame.SetPlayerWeapon(0, WS_SHOTGUN,	    WID_SHOTGUN_1);	
	EntGame.SetPlayerWeapon(0, WS_AUTO_RIFLE, 	WID_AUTO_RIFLE_1);	
	EntGame.SetPlayerWeapon(0, WS_BOW, 		    WID_BOW_1);
	EntGame.ResetWeaponIcons();
	end;
	
-----------------------------------------------------------------------------

function Part1()
	
	entTrainCamera = Entity.FindName(entRoot, "TrainCamera1");
	if (entTrainCamera) then
	    Camera.JumpToWaypoint(entTrainCamera, "TrainWptAA");
	    end;			
	entTrainCamera2 = Entity.FindName(entRoot, "TrainCamera2");
	if (entTrainCamera2) then
	    Camera.JumpToWaypoint(entTrainCamera2, "TrainWptGG");
	    end;	
	entTrainCamera3 = Entity.FindName(entRoot, "TrainCamera3");
	if (entTrainCamera3) then
	    Camera.JumpToWaypoint(entTrainCamera3, "TrainWptGG");
	    end;	
	entTrainCamera4 = Entity.FindName(entRoot, "TrainCamera4");
	if (entTrainCamera4) then
	    Camera.JumpToWaypoint(entTrainCamera4, "TrainWptGG");
	    end;
	entTrainCamera5 = Entity.FindName(entRoot, "TrainCamera5");
	if (entTrainCamera5) then
	    Camera.JumpToWaypoint(entTrainCamera5, "TrainWptGG");
	    end;
	entTrainCamera6 = Entity.FindName(entRoot, "TrainCamera6");
	if (entTrainCamera6) then
	    Camera.JumpToWaypoint(entTrainCamera6, "TrainWptGG");
	    end;
	entTrainCamera7 = Entity.FindName(entRoot, "TrainCamera7");
	if (entTrainCamera7) then
	    Camera.JumpToWaypoint(entTrainCamera7, "TrainWptGG");
	    end;
	entTrainCamera8 = Entity.FindName(entRoot, "TrainCamera8");
	if (entTrainCamera8) then
	    Camera.JumpToWaypoint(entTrainCamera8, "TrainWptGG");
	    end;
	entTrainCamera9 = Entity.FindName(entRoot, "TrainCamera9");
	if (entTrainCamera9) then
	    Camera.JumpToWaypoint(entTrainCamera9, "TrainWptGG");
	    end;
	entTrainCamera10 = Entity.FindName(entRoot, "TrainCamera10");
	if (entTrainCamera10) then
	    Camera.JumpToWaypoint(entTrainCamera10, "TrainWptGG");
	    end;
	entTrainCamera11 = Entity.FindName(entRoot, "TrainCamera11");
	if (entTrainCamera11) then
	    Camera.JumpToWaypoint(entTrainCamera11, "TrainWptGG");
	    end;	
	entTrainCamera12 = Entity.FindName(entRoot, "TrainCamera12");
	if (entTrainCamera12) then
	    Camera.JumpToWaypoint(entTrainCamera12, "TrainWptGG");
	    end;	
	entTrainCamera13 = Entity.FindName(entRoot, "TrainCamera13");
	if (entTrainCamera13) then
	    Camera.JumpToWaypoint(entTrainCamera13, "TrainWptGG");
	    end;	
	entTrainCamera14 = Entity.FindName(entRoot, "TrainCamera14");
	if (entTrainCamera14) then
	    Camera.JumpToWaypoint(entTrainCamera14, "TrainWptGG");
	    end;
	entTrainCamera15 = Entity.FindName(entRoot, "TrainCamera15");
	if (entTrainCamera15) then
	    Camera.JumpToWaypoint(entTrainCamera15, "TrainWptGG");
	    end;
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha5", 0, ST_WPT_RUN, 0, 0, 0, 1.2);  
   	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha1", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
   	Script.WaitSec(.5);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha2", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	Script.WaitSec(.5);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha5", 0, ST_WPT_RUN, 0, 0, 0, 1.2);  
   	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha1", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 2, 1, 0, 1.2);
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 2, 1, 1, .6);	
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 0, 2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 0, 0, 2, .5);
		
	EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath4", 0, ST_WPT_RUN, 0, 0, 0, 1.5); 
	Script.WaitSec(.4);
	
	--POWERUP!!!
	Grouse = EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath4", 0, ST_WPT_RUN, 0, 0, 0, 1.1); 
	EntGame.CreateAnimalPowerUp(Grouse, PID_WILEY_VISION_50);	
	
	Script.WaitSec(1);
	EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath4", 0, ST_WPT_RUN, 0, 0, 0, 1.5);  
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha3", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	Script.WaitSec(1);
	
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath3", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	Animal.SetElvOffset(a, -.5); 
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha4", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	
	Script.WaitSec(.3);

	-- Get pointer to camera that train is following.
	entTrainCamera2 = Entity.FindName(entRoot, "TrainCamera2");
	if (entTrainCamera2) then
	    Camera.JumpToWaypoint(entTrainCamera2, "TrainWptAA");
	    end;			
	
	Script.WaitSec(3.7);
	
	-- Get pointer to camera that train is following.
	entTrainCamera3 = Entity.FindName(entRoot, "TrainCamera3");
	if (entTrainCamera3) then
	    Camera.JumpToWaypoint(entTrainCamera3, "TrainWptAA");
	    end;	
	
	Script.WaitSec(3.7);
	
	-- Get pointer to camera that train is following.
	entTrainCamera4 = Entity.FindName(entRoot, "TrainCamera4");
	if (entTrainCamera4) then
	    Camera.JumpToWaypoint(entTrainCamera4, "TrainWptAA");
	    end;
		
	Script.WaitSec(2.3);
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha2", 0, ST_WPT_RUN, 0, 0, 0, 1.5);
	Script.WaitSec(.5);
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha3", 0, ST_WPT_RUN, 0, 0, 0, 1.2);

	--POWERUP!!!
	Elk = EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha4", 0, ST_WPT_RUN, 0, 0, 0, 1.5);
	EntGame.CreateAnimalPowerUp(Elk, PID_1_5X_SCORE);
	
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath1", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	Animal.SetElvOffset(a, 0); 
    
	Script.WaitSec(.9);
	
	-- Get pointer to camera that train is following.
	entTrainCamera5 = Entity.FindName(entRoot, "TrainCamera5");
	if (entTrainCamera5) then
	    Camera.JumpToWaypoint(entTrainCamera5, "TrainWptAA");
	    end;	
	
	Script.WaitSec(.6);
    
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 0, 1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 0, 0, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 0, 1, 1, .6);	
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 0, 2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 0, 0, 2, .5);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha22", 0, 1, 1, 1, .4);	
    
    a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath3", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	Animal.SetElvOffset(a, -.5); 
	
    Script.WaitSec(1.6);
	
	-- Get pointer to camera that train is following.
	entTrainCamera6 = Entity.FindName(entRoot, "TrainCamera6");
	if (entTrainCamera6) then
	    Camera.JumpToWaypoint(entTrainCamera6, "TrainWptAA");
	    end;	
	
	Script.WaitSec(3.7);

	-- Get pointer to camera that train is following.
	entTrainCamera7 = Entity.FindName(entRoot, "TrainCamera7");
	if (entTrainCamera7) then
	    Camera.JumpToWaypoint(entTrainCamera7, "TrainWptAA");
	    end;	
	
	Script.WaitSec(.7);
	
	--POWERUP!!!
    Grouse = EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath2", 0, ST_POPUP, 1, 0, 0, 1); 
	EntGame.CreateAnimalPowerUp(Grouse, PID_WILEY_VISION_50);	
    Animal.FaceEntity(Grouse, entCamera);
   
	Script.WaitSec(3);
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha9", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha5", 0, ST_WPT_RUN, 0, 0, 0, .85);
		
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath1", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	Animal.SetElvOffset(a, -.5); 
	
	Script.WaitSec(.5);
		
	-- Get pointer to camera that train is following.
	entTrainCamera8 = Entity.FindName(entRoot, "TrainCamera8");
	if (entTrainCamera8) then
	    Camera.JumpToWaypoint(entTrainCamera8, "TrainWptAA");
	    end;			
	
	Script.WaitSec(2.5);
	
	--PREDATOR #1
	a = EntGame.SpawnAnimalOnPath(AID_MOOSE, "FollowPathAlpha9",0, ST_WPT_RUN, 1,0,0,1.2);
	Animal.FaceEntity(a, entCamera );
	Animal.SetChargeWhenShot(a, true);	
	Animal.SetAttackType(a, ATK_STRAFE);
	Animal.SetStrafeAttackDist(a, 8);
	Animal.SetStrafeAttackDelay(a, .5);
	Animal.SetStaticAttackDist(a, 8);
	Animal.SetStaticAttackDelay(a, .5);
	Animal.SetPostAttackRand(a, false);
	Animal.SetPostAttackDir(a, 45);	
	
	Script.WaitSec(2);			
		
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha24", 0, 0, 1, 0, 1.2);
	
    Script.WaitSec(.25);
	
	-- Get pointer to camera that train is following.
	entTrainCamera9 = Entity.FindName(entRoot, "TrainCamera9");
	if (entTrainCamera9) then
	    Camera.JumpToWaypoint(entTrainCamera9, "TrainWptAA");
	    end;
		
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha24", 0, 0, 0, -1, .88);
    Script.WaitSec(.25);
	
	--POWERUP!!!
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha24", 0, 0, 1, 1, .6);	
	EntGame.CreateAnimalPowerUp(Goose, PID_4X_MAGAZINE);
	
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha24", 0, 0, 2, 0, .88);
	
    end;
    
-----------------------------------------------------------------------------

function Part2()

	--Camera.SetSpeed(entCamera, 0.0, 0.1);	    
	--Camera.JumpToWaypoint(entCamera, "CamWptAA");
	
	Camera.SetSpeed(entCamera, 2.0, 0.1);
	Camera.StopAtWaypoint(entCamera, "CamWptGG");
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha1", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha2", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	Script.WaitSec(4);
	
	-- Get pointer to camera that train is following.
	entTrainCamera10 = Entity.FindName(entRoot, "TrainCamera10");
	if (entTrainCamera10) then
	    Camera.JumpToWaypoint(entTrainCamera10, "TrainWptAA");
	    end;
		
	Script.WaitSec(.25);
	
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath14", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	
	Script.WaitSec(4);
	
	--POWERUP!!!
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath14", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	EntGame.CreateAnimalPowerUp(a, PID_1_5X_SCORE);
	
	Script.WaitSec(.5);
	
	-- Get pointer to camera that train is following.
	entTrainCamera11 = Entity.FindName(entRoot, "TrainCamera11");
	if (entTrainCamera11) then
	    Camera.JumpToWaypoint(entTrainCamera11, "TrainWptAA");
	    end;
		
	Script.WaitSec(.5);
	
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha3", 2, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha3", 2, ST_WPT_RUN, 0, 0, -2, 1.33);
	
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 1, -1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 0, 0, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 1, 1, 1, .6);	
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 0, -2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 1, 0, 2, .5);
	
    Script.WaitSec(2.75);	

	a = EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha3",0, ST_WPT_RUN, 0,0,0,1.3);
	Animal.FaceEntity(a, entCamera );
	Script.WaitSec(.25);
	
	-- Get pointer to camera that train is following.
	entTrainCamera12 = Entity.FindName(entRoot, "TrainCamera12");
	if (entTrainCamera12) then
	    Camera.JumpToWaypoint(entTrainCamera12, "TrainWptAA");
	    end;	
		
	Script.WaitSec(2.75);
    EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha3", 2, ST_WPT_RUN, 0, 0, 0, 1.2);
    Script.WaitSec(2);
	
	-- Get pointer to camera that train is following.
	entTrainCamera13 = Entity.FindName(entRoot, "TrainCamera13");
	if (entTrainCamera13) then
	    Camera.JumpToWaypoint(entTrainCamera13, "TrainWptAA");
	    end;	
		
	Script.WaitSec(1); 	
	
	--POWERUP!!!
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 0, 1, 0, 1.2);
	EntGame.CreateAnimalPowerUp(Goose, PID_2X_FIRE_RATE);
	
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 0, 0, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 0, 1, 1, .6);	
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 0, 2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 0, 0, 2, .5);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha23", 0, 1, 1, 1, .4);	

	Script.WaitSec(1.75);
	
	-- Get pointer to camera that train is following.
	entTrainCamera14 = Entity.FindName(entRoot, "TrainCamera14");
	if (entTrainCamera14) then
	    Camera.JumpToWaypoint(entTrainCamera14, "TrainWptAA");
	    end;
		
	Script.WaitSec(.75);
	    			
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath13", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	
	Script.WaitSec(2.5);
		
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha6", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha6", 0, ST_WPT_RUN, -1, 0, -1, 1.2);
	
	Script.WaitSec(.5);
	
	-- Get pointer to camera that train is following.
	entTrainCamera15 = Entity.FindName(entRoot, "TrainCamera15");
	if (entTrainCamera15) then
	    Camera.JumpToWaypoint(entTrainCamera15, "TrainWptAA");
	    end;	
		
	Script.WaitSec(1.5);
		
	--PREDATOR #2	
	a = EntGame.SpawnAnimalOnPath(AID_MOOSE, "FollowPathAlpha6",0, ST_WPT_RUN, 1,0,0,1.2);
	Animal.FaceEntity(a, entCamera );
	Animal.SetAutoChargeDist(a, 30);
	Animal.SetChargeWhenShot(a, true);	
	Animal.SetAttackType(a, ATK_STRAFE);
	Animal.SetStrafeAttackDist(a, 8);
	Animal.SetStrafeAttackDelay(a, .5);
	Animal.SetStaticAttackDist(a, 8);
	Animal.SetStaticAttackDelay(a, .5);
	Animal.SetPostAttackRand(a, false);
	Animal.SetPostAttackDir(a, 45);	
	
	Script.WaitSec(2.5);
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha10", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha7", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
 
	Script.WaitSec(4);
		
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 0, 1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 1, 0, -1, .88);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha10", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 0, 1, 1, .6);	
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha7", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 1, 2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 0, 1, 2, .5);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 1, 1, 1, .4);	
	
	--POWERUP!!!
	Elk = EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha10", 0, ST_WPT_RUN, 0, 0, 0, 1);
	EntGame.CreateAnimalPowerUp(Elk, PID_WILEY_VISION_100);

	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha7", 0, ST_WPT_RUN, 0, 0, 0, 1);
	
	Script.WaitSec(4);
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 0, 1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 1, 0, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 0, 1, 1, .6);	
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 1, 2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 0, 1, 2, .5);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha25", 0, 1, 1, 1, .4);	
	Script.WaitSec(4.5);

	--PREDATOR #3
	a = EntGame.SpawnAnimalOnPath(AID_MOOSE, "FollowPathAlpha13",0, ST_WPT_RUN, 4,0,0,1.3);
	Animal.FaceEntity(a, entCamera );
	Animal.SetAutoChargeDist(a, 50);
	Animal.SetChargeWhenShot(a, true);	
	Animal.SetAttackType(a, ATK_STRAFE);
	Animal.SetStrafeAttackDist(a, 8);
	Animal.SetStrafeAttackDelay(a, .5);
	Animal.SetStaticAttackDist(a, 8);
	Animal.SetStaticAttackDelay(a, .5);
	Animal.SetPostAttackRand(a, false);
	Animal.SetPostAttackDir(a, 45);	
	
	Script.WaitSec(1);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha12", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha12", 0, ST_WPT_RUN, 1, 0, 2, 1.0);
	
	--POWERUP!!!
	Elk = EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha10", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	EntGame.CreateAnimalPowerUp(Elk, PID_2X_RELOAD_RATE);
	
	Script.WaitSec(2.5);

	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha11", 0, ST_WPT_RUN, 0, 0, -1, .9);	
	
	Script.WaitSec(3.5);
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 0, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 1, .6);	
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 2, .5);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 1, 1, .4);	
    
	Script.WaitSec(2);
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath15", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
    Script.WaitSec(4);
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath6", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	Script.WaitSec(2);
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath7", 0, ST_POPUP, 3, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	Script.WaitSec(2);
	
	--POWERUP!!!
    Grouse = EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath9", 0, ST_POPUP, 2, 0, 0, 1);      
    Animal.FaceEntity(Grouse, entCamera);
	EntGame.CreateAnimalPowerUp(Grouse, PID_WILEY_VISION_50);
	
    Script.WaitSec(2);
    a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath8", 0, ST_POPUP, 3, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
    Script.WaitSec(2);
    a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath12", 0, ST_POPUP, 2, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
    Script.WaitSec(1);
   	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha14", 0, ST_WPT_RUN, 0, 0, 0, 1.0);
    a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath7", 0, ST_POPUP, 2, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);	
	
	Script.WaitSec(1);
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha14", 0, ST_WPT_RUN, 0, 0, 2, 1.0);
	Script.WaitSec(1.5);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha14", 0, ST_WPT_RUN, 0, 0, 0, 1.0);
	Script.WaitSec(3.6);
	
  	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath16", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
    
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 0, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 1, .6);	
    Script.WaitSec(.5);    
	
	--POWERUP!!!
	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 2, 0, .88);
	EntGame.CreateAnimalPowerUp(Goose, PID_2X_MAGAZINE);
	
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 2, .5);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 1, 1, .4);
	
    EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha15", 0, ST_WPT_RUN, -3, 0, -3, 1.2);
    Script.WaitSec(.5);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha15", 0, ST_WPT_RUN, 0, 0, 0, 1.1);
	Script.WaitSec(1.2);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha16", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	
	Script.WaitSec(6.5);
		
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 2, 1, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 1, .6);	
    Script.WaitSec(.5);    
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 2, 0, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, -2, 1, 2, .5);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 1, 1, .4);	
        
	--PREDATOR #4
	a = EntGame.SpawnAnimalOnPath(AID_MOOSE, "FollowPathAlpha16",0, ST_WPT_RUN, 1,0,0,1.3);
	Animal.FaceEntity(a, entCamera );
	Animal.SetAutoChargeDist(a, 15.0);
	Animal.SetAttackType(a, ATK_STATIC);
	Animal.SetStaticAttackDist(a, 4.5);
	Animal.SetStaticAttackDelay(a, 1.0);	
	Animal.SetAttackRepeat(a, 2);
	Animal.SetPostAttackRand(a, false);
	Animal.SetPostAttackDir(a, -90);
	
	Script.WaitSec(5);
	
    end;
        
-----------------------------------------------------------------------------

function Part3()
	
	--Camera.SetSpeed(entCamera, 0.0, 0.1);	    
	--Camera.JumpToWaypoint(entCamera, "CamWptGG");
	
	--POWERUP!!!
	Elk = EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha17", 0, ST_WPT_RUN, 0, 0, -1, .9);
	EntGame.CreateAnimalPowerUp(Elk, PID_WILEY_VISION_50);
	
	Script.WaitSec(.5);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha18", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	Script.WaitSec(.5);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha19", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath17", 0, ST_POPUP, 4, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
    
	Script.WaitSec(6);
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 0, 1.2);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 2, 3, -1, .88);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 0, 1, 1, .6);	
    Script.WaitSec(.5);    
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 2, 0, .88);
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, -2, -2, 2, .5);
    Script.WaitSec(.5);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, -.5, 1, .4);
    
    Script.WaitSec(1.5);
	
	--POWERUP!!!
	a=EntGame.SpawnAnimalOnPath(AID_GROUSE, "MeerkatPath17", 0, ST_POPUP, 2, 0, 0, 1);      
    Animal.FaceEntity(a, entCamera);
	EntGame.CreateAnimalPowerUp(a, PID_1_5X_SCORE);
	
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha17", 0, ST_WPT_RUN, 0, 0, -1, .9);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha18", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	Script.WaitSec(.5);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha19", 0, ST_WPT_RUN, 0, 0, 0, 1.2);
	Script.WaitSec(2);
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, -1, 0, 1, 1);	
    Script.WaitSec(.5);    
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, -2, 0, .9);
    Script.WaitSec(.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, -2, -1, 2, .8);
    Script.WaitSec(1.25);
    EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, 2, 1, .7);
	Script.WaitSec(1);
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, -1, 0, 1, 1);	
    Script.WaitSec(.5);    
	EntGame.SpawnBirdOnPath(AID_GOOSE, "FollowPathAlpha26", 0, 1, -2, 0, .9);
	EntGame.SpawnAnimalOnPath(AID_ELK_F, "FollowPathAlpha19", 0, ST_WPT_RUN, 0, 0, -1, 1.3);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha20", 0, ST_WPT_RUN, 0, 0, 0, 1.1);
	Script.WaitSec(1.25);
	EntGame.SpawnAnimalOnPath(AID_ELK_M, "FollowPathAlpha21", 0, ST_WPT_RUN, 1, 0, 1, 1.0);
	
    end;
       
-----------------------------------------------------------------------------

-- Main entry point
   
Setup();   
Intro();
Part1();   
Part2();   
Part3();   

