void Roll1()
{
   sys.println("Roll1 running"); // debug
   
   $Tport1.activate($player1);      // put the player behind the actors

   // $Camera4.activate($player1);  // Switch view
   // sys.wait(2);		 // duration of view

   //$Camera1.activate($player1);  // Switch view
   // sys.wait(10);		 // duration of view

   // $Camera5.activate($player1);  // Switch view
   // sys.wait(3);		 // duration of view
   
   sys.trigger($StartKasperConvo); // pass control to the conversation

}

void Roll2()
{
   $Camera2.activate($player1);  // Switch view
}

void Roll3()
{
   $Camera4.activate($player1);  // Switch view
   sys.wait(1);
}

void Roll4()
{
   $Camera3.activate($player1);  // Switch view
}

void Roll5()
{
   $Camera5.activate($player1);  // Switch view
}

void ConvoView()
{
   $Camera1.activate($player1);  // Switch view
}

void Return2Player()
{

   sys.println("Return2Player running"); // debug
   
   $Tport2.activate($player1);      // put the player back in the map

   $Camera1.activate($player1);  // Return control to player
}

void SendToConsole()
{
 	sys.print("\n\nYour script is running");
}

void auto_remove(entity ent_self)
{
	sys.println(ent_self.getName() + " has been killed.");
	sys.wait(10);
	ent_self.remove();			//remove the body after 10s
}

void spooky_door()
{
	$atdm_mover_door_4.Lock(); // MAYBE will close door too.
	sys.wait(1); // If so, wait for door to fully close. Value may need adjusting based on door's speed
	$atdm_mover_door_4.Close(); // Otherwise, close it now.
}

void ghost_chase()
{
	$church_basement_ghost.stopPatrol();
	$church_basement_ghost.setAlertLevel(5);
	sys.trigger($atdm_target_changetarget_ghostchase); //change basement ghost's target
	sys.trigger($atdm_target_changetarget_ghostpath1); //change targets of all basement path corners
	sys.trigger($atdm_target_changetarget_ghostpath2); //  --fixes bug caused by ghost being in search
	sys.trigger($atdm_target_changetarget_ghostpath3); //  mode when script is triggered leading to
	sys.trigger($atdm_target_changetarget_ghostpath4); //  no path change
	$church_basement_ghost.setKey("alter_idle", "1");
	sys.print("ghost_chase triggered");
}

void beast_office()
{
	$manbeast_patrol2.stopPatrol();
	$manbeast_patrol2.setAlertLevel(1.6);
	sys.trigger($atdm_target_changetarget_beastoffice);
	$manbeast_patrol2.setKey("alter_idle", "1");
	sys.print("\n\nManbeast 2 is now Agitated");
}

void endgame()
{
	$endgame_thug1.setAlertLevel(4);
	$endgame_thug2.setAlertLevel(4);
	$endgame_thug3.setAlertLevel(4);
	$endgame_thug4.setAlertLevel(4);
	$endgame_thugleader.setAlertLevel(4);
	$host_door.Close();
	$VaultDoor2.Open();
	$kasper_door.Open();
	$kasper_door2.Open();
	$kasper_door3.Open();
	$FootlockerLid_1.Unlock();
	$FootlockerLid_1.Open();
	sys.print("Endgame launched");
}

void FrobMuseumMap()
{
       // Put MapOfMuseum into inventory, replacing the frobbed item named MuseumDummyMap.
       // MapOfMuseum shows the museum map when used while in inventory.
       // Make sure HUD shows the map icon.

       $player1.replaceInvItem($MuseumDummyMap,$MapOfMuseum);
       $player1.setCurInvItem("Museum Map"); // provide inventory name, not item name
}

void FrobPlagueMap()
{

       $player1.replaceInvItem($PlagueMapDummy,$MapOfPlague);
       $player1.setCurInvItem("Plague Ward Map"); // provide inventory name, not item name
}
