//************************//
//**--ITEMS AND THINGS--**//
//************************//

SCRIPT 300 (int cost) //ankh
{
int health = GetActorProperty(ActivatorTID(), APROP_HEALTH);
ActivatorSound("ACTIVATE",127);
DELAY(24);
if (health > 255)
 {
  ActivatorSound("ANKH_FAIL",127);
  print(s:"YOU ARE ALREADY AT MAX HEALTH!");
  GiveInventory("Ankh", 1);
}
else
if (CheckInventory("GodAmmo") > cost)
 {
	ActivatorSound("ANKH_WORK",127);
	TakeInventory("GodAmmo", cost);
	if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
		GiveInventory("LifeCounter",64);
	else
		GiveInventory("Health", 64);
	//GiveInventory("Ankh", 1);
}

else
 {
	//THIS WILL BE USED FOR PLAYER CLASSES WHO ARE NOT AKHETS
	
	ActivatorSound("ANKH_FAIL",127);
        print(s:"NOT ENOUGH POWER");
	GiveInventory("Ankh", 1);
 }
}

SCRIPT 301 (int stringNum) //prints a stock string to the player
{
	switch(stringNum)
	{
		case 0:
				//print(s:"This feature is unavailable in this version.");
				print(s:"THIS FEATURE IS UNAVAILABLE IN THIS VERSION.");
				break;
		case 1:
				print(s:"YOU DON'T HAVE ENOUGH POWER TO ACTIVATE THIS.");
				break;
		case 2:
				print(s:"USE THIS TO SKY CLIMB AND DO A SECOND JUMP WHILE IN MID-AIR.  (AKA, TRY USING THIS IN MID-JUMP)");
				break;
		case 3:
				print(s:"MUST BE IN MORTAL DANGER TO ACTIVATE THIS.");
				break;
		case 4:
				print(s:"YOU DON'T HAVE ENOUGH POWER AND YOU'RE NOT IN MORTAL DANGER.");
				break;
		default:
				//print(s:"This string doesn't exist.  Programmer, you must have put in the wrong number.  You bad, bad scripter.");
				print(s:"THIS STRING DOESN'T EXIST.  PROGRAMMER, YOU MUST HAVE PUT IN THE WRONG NUMBER.  YOU BAD, BAD SCRIPTER.");
				break;
	}
}

SCRIPT 302 (VOID) // Flashdark Light Activate
{
	Spawn ("FlashDarkLight", getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()) , (ActivatorTid() + 8), 0);

	for (int count = 0; count < 1024; count++)
	{
		SetActorPosition((ActivatorTid() + 8), GetActorX(ActivatorTID()), GetActorY(ActivatorTID()), GetActorZ(ActivatorTID()), 0);
		delay(1);
	}

	Thing_Remove ((ActivatorTid() + 8));
}

SCRIPT 303 (VOID) //Pentagram
{
if (CheckInventory("GodAmmo") < 1024)
 {
  ActivatorSound("PENTA_USE",127);
  if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
		GiveInventory("PowerCounter",64);
  else
		GiveInventory("GodAmmo", 256);
}
else
 {
  print(s:"YOU CAN'T GO PAST 1024 YOU NINNY!");
  GiveInventory("Pentagram", 1);
 }
}

SCRIPT 304 (VOID) // Kamikaze Activate
{
	SetResultValue(0);
    printbold(s:"3");
	delay(32);
	printbold(s:"2");
	delay(32);
	printbold(s:"1");
	delay(32);
	printbold(s:"");
	SetResultValue(1);
	DamageThing(256);
	SpawnProjectile(0, "KamikazeBlast", 0, 0, 0, 0, 0);
}

SCRIPT 305 (VOID) // SeppukuSpell
{
	DamageThing(256);
}

SCRIPT 306 (VOID) // Drink Water Jar
{
 ActivatorSound("EAT",127);
 Delay(16);
 ActivatorSound("EAT",127);
 Delay(16);
 ActivatorSound("EAT",127);
 if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
		GiveInventory("LifeCounter",256);
 else
		GiveInventory("Health", 256);
 GiveInventory("Jar", 1);
 Delay(16);
 ActivatorSound("BELCH",127);
}

SCRIPT 307 (VOID) // Drink Latte Jar
{
 ActivatorSound("EAT",127);
 Delay(16);
 ActivatorSound("EAT",127);
 Delay(16);
 ActivatorSound("EAT",127);
 if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
		GiveInventory("PowerCounter",256);
 else
		GiveInventory("GodAmmo", 1024);
 GiveInventory("Jar", 1);
 Delay(16);
 ActivatorSound("BELCH",127);
}

SCRIPT 308 (VOID) // Drink Banana Milk Jar
{
 ActivatorSound("EAT",127);
 Delay(16);
 ActivatorSound("EAT",127);
 Delay(16);
 ActivatorSound("EAT",127);
 if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
 {
		GiveInventory("LifeCounter",256);
 		GiveInventory("PowerCounter",256);
 }
 else
 {
		GiveInventory("Health", 256);
		GiveInventory("GodAmmo", 1024);
 }
 GiveInventory("Jar", 1);
 Delay(16);
 ActivatorSound("BELCH",127);
}

SCRIPT 309 (VOID) // Drink Heka Juice
{
 GiveInventory("Jar", 1);
 print(s:"YUCK!  NASTY!  WHY DID I DRINK THAT?");
}

SCRIPT 311 (VOID) //King of Denile's freezing sound wave
{
 SetActorProperty(0, 1, PROP_FROZEN);
 delay(35*(random(0,10)));
 SetActorProperty(0, 0, PROP_FROZEN);
}

SCRIPT 312 (int JumpForce)	//A double jump.  This is used for the sky climb ability.
{
 ActivatorSound("*jump",127);
 ThrustThingZ(0,JumpForce,0,0);
}

SCRIPT 313(int state)	//Sets a player to a particular state
{
	switch(state)
	{
		case 0:
				SetActorState (0, "see");
				break;
		case 1:
				SetActorState (0, "meditate");
				break;
		case 2:
				SetActorState (0, "reflect");
				break;
		default:
				SetActorState (0, "see");
				break;
	}
}

/*

SCRIPT 313 (VOID) // Arrow pickup
{
        TakeInventory("ArrowBag", 1);
	GiveInventory("ArrowAmmo", 25);
	if (GameSkill () == SKILL_VERY_EASY || GameSkill () == SKILL_VERY_HARD)
 	 { TakeInventory("ArrowAmmo", 25); }
}

SCRIPT 317 (VOID) // Scarab pickup
{
        TakeInventory("Scarab", 1);
	GiveInventory("ScarabAmmo", 3);
	if (GameSkill () == SKILL_VERY_EASY || GameSkill () == SKILL_VERY_HARD)
 	 { TakeInventory("ScarabAmmo", 3); }
}

SCRIPT 318 (VOID) // Scarab Bag pickup
{
        TakeInventory("ScarabBag", 1);
	GiveInventory("ScarabAmmo", 20);
	if (GameSkill () == SKILL_VERY_EASY || GameSkill () == SKILL_VERY_HARD)
 	 { TakeInventory("ScarabAmmo", 20); }
}

SCRIPT 319 (VOID) // Kitten pickup
{
        TakeInventory("Mau", 1);
	GiveInventory("KittyAmmo", 1);
	if (GameSkill () == SKILL_VERY_EASY || GameSkill () == SKILL_VERY_HARD)
 	 { TakeInventory("KittyAmmo", 1); }
}

SCRIPT 320 (VOID) // Catbox pickup
{
        TakeInventory("CatBox", 1);
	GiveInventory("KittyAmmo", 5);
	if (GameSkill () == SKILL_VERY_EASY || GameSkill () == SKILL_VERY_HARD)
 	 { TakeInventory("KittyAmmo", 5); }
}
*/
SCRIPT 321 (VOID) // Silver Broomstick pickup
{
    TakeInventory("SilverBroomstick", 1);
	SetPlayerProperty(0,1,PROP_FLIGHT);
	delay(35*35);
	print(s:"SILVER BROOMSTICK POWER BEGINS TO WANE");
	delay(35*10);
	SetPlayerProperty(0,0,PROP_FLIGHT);
	ActivatorSound("DOWN",127);
}

SCRIPT 322 (VOID) // Invisibility Glasses Activate
{
        TakeInventory("RamessesEgo", 1);
	SetPlayerProperty(0,1,PROP_INVULNERABILITY);
	delay(35*35);
	print(s:"RAMESSES EGO POWER BEGINS TO WANE");
	delay(35*10);
	SetPlayerProperty(0,0,PROP_INVULNERABILITY);
	ActivatorSound("DOWN",127);
}

SCRIPT 323 (VOID) // Hero's Light Activate
{
	Spawn ("heroLight", getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()) , (ActivatorTid() + 8), 0);

	for (int count = 0; count < 1024; count++)
	{
		SetActorPosition((ActivatorTid() + 8), GetActorX(ActivatorTID()), GetActorY(ActivatorTID()), GetActorZ(ActivatorTID()), 0);
		delay(1);
	}

	Thing_Remove ((ActivatorTid() + 8));
}

SCRIPT 324 (VOID) // Windbag Activate
{
        TakeInventory("RamessesEgo", 1);
	SetPlayerProperty(0,1,PROP_INVULNERABILITY);
	delay(35*35);
	print(s:"RAMESSES EGO POWER BEGINS TO WANE");
	delay(35*10);
	SetPlayerProperty(0,0,PROP_INVULNERABILITY);
	ActivatorSound("DOWN",127);
}

SCRIPT 325 (VOID) // Ovine Clone Activate
{
        TakeInventory("RamessesEgo", 1);
	SetPlayerProperty(0,1,PROP_INVULNERABILITY);
	delay(35*35);
	print(s:"RAMESSES EGO POWER BEGINS TO WANE");
	delay(35*10);
	SetPlayerProperty(0,0,PROP_INVULNERABILITY);
	ActivatorSound("DOWN",127);
}

SCRIPT 326 (VOID) // Ramesses Ego Activate
{
        TakeInventory("RamessesEgo", 1);
	SetPlayerProperty(0,1,PROP_INVULNERABILITY);
	delay(35*35);
	print(s:"RAMESSES EGO POWER BEGINS TO WANE");
	delay(35*10);
	SetPlayerProperty(0,0,PROP_INVULNERABILITY);
	ActivatorSound("DOWN",127);
}

SCRIPT 337 (VOID) // UNUSABLE ITEM
{ 
GiveInventory("Jar", 1);
}

/*
SCRIPT 338 (VOID) //Coconut
{
        TakeInventory("Coconut", 1);
        if (GameType () != GAME_NET_DEATHMATCH)
  	{
		GiveInventory("LifeCounter", += 128;
		GiveInventory("PowerCounter", += 512;
	}
	else
	{
		GiveInventory("Health", 128);
		GiveInventory("GodAmmo", 512);
	}
	
}
*/

//Morph a player
SCRIPT 341 (int morph) // Golden Apple Activate
{
	int morphed;
	switch(morph)
	{
		case 0:
			morphed = UnMorphActor(0);
			TakeInventory("StatusChild", 1);
			break;
		case 1:
			//TakeInventory("AppleOfYouth", 1);
			GiveInventory("StatusChild",1);
			
			str currentClass;
			str newClass;
			switch (PlayerClass(PlayerNumber()))
			{
				case CLASS_ADULT_MALE_AKHET:
					newClass = "AdolescentMaleAkhetPlayer";
					currentClass = "AdultMaleAkhetPlayer";
					break;
				case CLASS_ADULT_FEMALE_AKHET:
					newClass = "AdolescentFemaleAkhetPlayer";
					currentClass = "AdultFemaleAkhetPlayer";
					break;
				default:
					newClass = "AdolescentMaleAkhetPlayer";
					currentClass = "AdultMaleAkhetPlayer";
					break;
			} 
			morphed = MorphActor(0, newClass, "", -1, 0, "", "");

			delay(32*24);
			print(s:"YOU ARE BEGINNING TO FEEL OLDER...");
			delay(32*8);
			int morphed2 = UnMorphActor(0);
			TakeInventory("StatusChild", 1);
			break;
		default:
			morphed = UnMorphActor(0);
			break;
	}
}

SCRIPT 342 (VOID) //Eye of Horus
{
	Spawn ("EyeCamera", getActorX(ActivatorTID()), getActorY(ActivatorTID()), (getActorZ(ActivatorTID() + 72)) , (ActivatorTid() + 16), 0);
	SetActorAngle ((ActivatorTid() + 16), 0.25); 

	bool end = false;
	int buttons;

	SetPlayerProperty(0,1,PROP_TOTALLYFROZEN); 
	ChangeCamera((ActivatorTID() + 16), 0, 0);

	  while (end == false)
  	  {
    		buttons = GetPlayerInput(-1, INPUT_BUTTONS);
		if (buttons & BT_FORWARD)
		{
			if (GetActorAngle((ActivatorTID() + 16) == 0.25))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) - 1, GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.5))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) - 1, GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.75))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) + 1, GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 1.0))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) + 1, GetActorY(ActivatorTID() + 16) , GetActorZ(ActivatorTID() + 16), 0);
		}

		if (buttons & BT_BACK)
		{
			if (GetActorAngle((ActivatorTID() + 16) == 0.25))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) + 1, GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.5))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) + 1, GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.75))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) - 1, GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 1.0))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) - 1, GetActorY(ActivatorTID() + 16) , GetActorZ(ActivatorTID() + 16), 0);
		}

		if (buttons & BT_MOVELEFT)
		{
			if (GetActorAngle((ActivatorTID() + 16) == 0.25))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) - 1, GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.5))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) + 1, GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.75))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) + 1, GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 1.0))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) - 1, GetActorZ(ActivatorTID() + 16), 0);
		}

		if (buttons & BT_MOVERIGHT)
		{
			if (GetActorAngle((ActivatorTID() + 16) == 0.25))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) + 1, GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.5))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) - 1, GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 0.75))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16) - 1, GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16), 0);

			else if (GetActorAngle((ActivatorTID() + 16) == 1.0))
				SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16) + 1, GetActorZ(ActivatorTID() + 16), 0);
		}

		if (buttons & BT_JUMP)
			SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16) + 1, 0);

		if (buttons & BT_CROUCH)
			SetActorPosition((ActivatorTid() + 16), GetActorX(ActivatorTID() + 16), GetActorY(ActivatorTID() + 16), GetActorZ(ActivatorTID() + 16) - 1, 0);
    		
		if (buttons & BT_LEFT)
		{
			if (GetActorAngle((ActivatorTID() + 16) == 1.0))
				SetActorAngle((ActivatorTid() + 16),0.75);

			if (GetActorAngle((ActivatorTID() + 16) == 0.75))
				SetActorAngle((ActivatorTid() + 16),0.5);

			if (GetActorAngle((ActivatorTID() + 16) == 0.5))
				SetActorAngle((ActivatorTid() + 16),0.25);

			if (GetActorAngle((ActivatorTID() + 16) == 0.25))
				SetActorAngle((ActivatorTid() + 16),1.0);
			
			delay(8);
		}

		if (buttons & BT_RIGHT)
		{
			if (GetActorAngle((ActivatorTID() + 16) == 1.0))
				SetActorAngle((ActivatorTid() + 16),0.25);

			if (GetActorAngle((ActivatorTID() + 16) == 0.25))
				SetActorAngle((ActivatorTid() + 16),0.5);

			if (GetActorAngle((ActivatorTID() + 16) == 0.5))
				SetActorAngle((ActivatorTid() + 16),0.75);

			if (GetActorAngle((ActivatorTID() + 16) == 0.75))
				SetActorAngle((ActivatorTid() + 16),1.0);
			
			delay(8);
		}

		if (buttons & BT_USE)
       			end = true;
		delay(1);
  	  }
	SetPlayerProperty(0,0,PROP_TOTALLYFROZEN); 
	ChangeCamera(0, 0, 0);
	Thing_Remove ((ActivatorTid() + 16));
}

//SpeedCurse
//Changes speed of an actor for an amount of time
SCRIPT 346(int actorType, int speed, int duration)
{
	if(actorType == 0)
	{
		//speedCursePlayer();
		if(speed == 0)
		{
			SetActorProperty(0, APROP_Speed, 0.5);
			giveInventory("StatusSlow",1);
			delay(random(256,4096));
			takeInventory("StatusSlow",1);
		}
		else if (speed == 1)
		{
			SetActorProperty(0, APROP_Speed, 1.0);
			takeInventory("StatusSlow",1);
			takeInventory("StatusFast",1);
		}
		else if (speed == 2)
		{
			SetActorProperty(0, APROP_Speed, 2.0);
			giveInventory("StatusFast",1);
			delay(duration);
			takeInventory("StatusFast",1);
		}
		//speedCurseCure();
		SetActorProperty(0, APROP_Speed, 1.0);
	}
	else if(actorType == 1)
		SetActorProperty(0, APROP_Speed, 6.0);
		//speedCurseEnemy();
}

function void speedUpPlayer(VOID)
{
	SetActorProperty(0, APROP_Speed, 2.0);
}

function void speedCursePlayer(VOID)
{
	SetActorProperty(0, APROP_Speed, 0.5);
}

function void speedCurseEnemy(VOID)
{
	SetActorProperty(0, APROP_Speed, 8);
	//speedCurseCureSlowly(normalSpeed);
}

function void speedCurseCure(VOID)
{
	SetActorProperty(0, APROP_Speed, 1.0);
}

SCRIPT 347(int race)	//Use an ancient cuneiform
{
	/*
	switch(PlayerClass(PlayerNumber()))
	{
		case CLASS_ADULT_MALE_AKHET :
		case CLASS_ADULT_FEMALE_AKHET :
			//print(s:"Try spawning a cuneiform");
			Spawn("CuneiformAkhet",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()) , (ActivatorTid() + 8), 0);
			break;
		default :
			//print(s:"Try spawning a cuneiform");
			Spawn("CuneiformAkhet",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()) , (ActivatorTid() + 8), 0);
			break;
	}
	*/
	switch(race)
	{
		case 0 :	//player is an akhet
			Spawn("CuneiformAkhet",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()) , (ActivatorTid() + 8), 0);
			break;
		case 1 :	//player is a gaian
			SpawnProjectile(PlayerNumber()+1000, "CuneiformGaian", 0, 32, 32, 800, 0);
			break;
		default :
			//print(s:"Try spawning a cuneiform");
			Spawn("CuneiformAkhet",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()) , (ActivatorTid() + 8), 0);
			break;
	}
}

SCRIPT 348 ENTER	//Sacred Lotus and other status things that could activate at given time intervals
{
	if (CheckInventory("SacredLotus") > 0)
	{
		if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) == 0)
		{
			print(s:"");
		}
		else if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) > 0)
		{
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 64)
			{
				if(random(0,15) == 0)
				{
					giveInventory("Health",random(64,256));
					giveInventory("GodAmmo",random(0,64));
					takeInventory("SacredLotus",1);
					print(s:"SAVED BY THE SACRED LOTUS!");
				}
			}
			
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 48)
			{
				if(random(0,7) == 0)
				{
					giveInventory("Health",random(64,256));
					giveInventory("GodAmmo",random(0,128));
					takeInventory("SacredLotus",1);
					print(s:"SAVED BY THE SACRED LOTUS!");
				}
			}
			
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 32)
			{
				if(random(0,3) == 0)
				{
					giveInventory("Health",random(64,256));
					giveInventory("GodAmmo",random(0,256));
					takeInventory("SacredLotus",1);
					print(s:"SAVED BY THE SACRED LOTUS!");
				}
			}
				
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 16)
			{
				if(random(0,1) == 0)
				{
					giveInventory("Health",random(64,256));
					giveInventory("GodAmmo",random(0,512));
					takeInventory("SacredLotus",1);
					print(s:"SAVED BY THE SACRED LOTUS!");
				}
			}
				
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 8)
			{
					giveInventory("Health",random(64,256));
					giveInventory("GodAmmo",random(0,1024));
					takeInventory("SacredLotus",1);
					print(s:"SAVED BY THE SACRED LOTUS!");
			}
		}
	}
	
	//---------------------------------
	//Blue lotus for Shake and Cinnamon
	//---------------------------------
	
	if (CheckInventory("BlueLotus") > 0)
	{
		if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) == 0)
		{
			print(s:"");
		}
		else if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) > 0)
		{
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 32)
			{
				if(random(0,63) == 0)
				{
					giveInventory("Health",random(16,64));
					giveInventory("GodAmmo",random(0,32));
					//takeInventory("SacredLotus",1);
					print(s:"YOUR INNER LOTUS GIVES YOU NEW LIFE.");
				}
			}
			
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 16)
			{
				if(random(0,31) == 0)
				{
					giveInventory("Health",random(32,96));
					giveInventory("GodAmmo",random(0,64));
					//takeInventory("SacredLotus",1);
					print(s:"YOUR INNER LOTUS GIVES YOU NEW LIFE.");
				}
			}
			
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 8)
			{
				if(random(0,15) == 0)
				{
					giveInventory("Health",random(48,128));
					giveInventory("GodAmmo",random(0,128));
					//takeInventory("SacredLotus",1);
					print(s:"YOUR INNER LOTUS GIVES YOU NEW LIFE.");
				}
			}
				
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 4)
			{
				if(random(0,7) == 0)
				{
					giveInventory("Health",random(64,144));
					giveInventory("GodAmmo",random(0,256));
					//takeInventory("BlueLotus",1);
					print(s:"YOUR INNER LOTUS GIVES YOU NEW LIFE.");
				}
			}
				
			if(getActorProperty(1000+PlayerNumber(),APROP_HEALTH) <= 2)
			{
				if(random(0,3) == 0)
				{
					giveInventory("Health",random(80,160));
					giveInventory("GodAmmo",random(0,512));
					//takeInventory("BlueLotus",1);
					print(s:"YOUR INNER LOTUS GIVES YOU NEW LIFE.");
				}
			}
		}
	}
	
	//------------------------------------------
	//Player has Pneumonoultramicroscopicsilicovolcanoconiosis
	//------------------------------------------
	if (CheckInventory("StatusP45") > 0)
	{
		switch(random(0,767))
		{
			//player is cured
			case 0:
					TakeInventory("StatusP45",1);
					break;
			case 1:
			case 2:
					DamageThing(random(13,16));
					break;
			case 3:
			case 4:
			case 5:
			case 6:
					DamageThing(random(9,12));
					break;
			case 7:
			case 8:
			case 9:
			case 10:
			case 11:
			case 12:
			case 13:
			case 14:
			case 15:
			case 16:
					DamageThing(random(5,8));
					break;
			case 17:
			case 18:
			case 19:
			case 20:
			case 21:
			case 22:
			case 23:
			case 24:
			case 25:
			case 26:
			case 27:
			case 28:
			case 29:
			case 30:
			case 31:
			case 32:
					DamageThing(random(1,4));
					break;
			default:
					break;
		}
	}
	
	delay(1);
	restart;
}

SCRIPT 349(VOID)
{
	//giveInventory("WarpOwl",1);
	if(ThingCountName("OwlSpot",695) == 0)
	{
		//Spawn (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
		Spawn("OwlSpot",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),695,0);
		AmbientSound("HOOT",127);
		//Spawn(9044,getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),696,0);
	}
	else if(ThingCountName("OwlSpot",695) > 0)
	{
		if(checkInventory("godAmmo") >= 128)
		{
			takeInventory("godAmmo",128);
			TeleportOther(ActivatorTID(), 695, 1);
			//Teleport(0,695);
			delay(1);
			thing_Remove(695);
		}
		else if(checkInventory("godAmmo") < 128)
			print(s:"NOT ENOUGH POWER");
	}
}

/*
SCRIPT 350 (VOID) //Apple
{
        TakeInventory("Banana", 1);
	if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
	{
		GiveInventory("LifeCounter", += 24;
		GiveInventory("PowerCounter", += 96;
	}
	else
	{
		GiveInventory("Health", 24);
		GiveInventory("GodAmmo", 96);
	}
	
}

SCRIPT 351 (VOID) //Pomegranate
{
        TakeInventory("Banana", 1);
	if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
	{
		GiveInventory("LifeCounter", += 48;
		GiveInventory("PowerCounter", += 192;
	}
	else
	{
		GiveInventory("Health", 48);
		GiveInventory("GodAmmo", 192);
	}
	
}
*/

SCRIPT 352 (VOID) //Blue Ankh
{
int health = GetActorProperty(ActivatorTID(), APROP_HEALTH);
ActivatorSound("ACTIVATE",127);
DELAY(24);
if (health > 255)
 {
  ActivatorSound("ANKH_FAIL",127);
  print(s:"YOU ARE ALREADY AT MAX HEALTH!");
  //GiveInventory("BlueAnkh", 1);
}
else
if (CheckInventory("GodAmmo") > 128)
 {
  if (CheckInventory("BlueAnkh") < 1)
    {
	ActivatorSound("ANKH_WORK",127);
	TakeInventory("GodAmmo", 128);
	if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
		GiveInventory("LifeCounter",64);
	else
		GiveInventory("Health", 64);
	//GiveInventory("BlueAnkh", 1);
}
  else
       {
	ActivatorSound("ANKH_WORK",127);
	ActivatorSound("HEAL_1",127);
	TakeInventory("GodAmmo", 128);
	if (GameType () != GAME_NET_DEATHMATCH && GameType () != GAME_NET_COOPERATIVE)
		GiveInventory("LifeCounter",64);
	else
		GiveInventory("Health", 64);
 }
}
else
 {
	ActivatorSound("ANKH_FAIL",127);
        print(s:"NOT ENOUGH HEKA");
	//GiveInventory("BlueAnkh", 1);
 }
}

//For items that last an amount of time and then get deactivated.
SCRIPT 353(int delayTime,int item)
{
	switch(item)
	{
		case 0:
			print(s:"YOU ARE INVISIBLE!");
			delay(delayTime);
			giveInventory("DisguiseDeactivate",1);
			break;
		default:
			print(s:"YOU ARE INVISIBLE!");
			delay(delayTime);
			giveInventory("DisguiseDeactivate",1);
			break;
	}
}

//Morph a player into a berserker
SCRIPT 355 (int morph) // Berserker Activate
{
	int morphed;
	switch(morph)
	{
		case 0:
			morphed = UnMorphActor(0);
			//TakeInventory("StatusChild", 1);
			break;
		case 1:
			//TakeInventory("AppleOfYouth", 1);
			//GiveInventory("StatusChild",1);
			
			str currentClass;
			str newClass;
			switch (CheckInventory("GenderFemale"))
			{
				case 0:
					newClass = "RedBerserkerPlayer";
					currentClass = "AdultMaleMidgardianPlayer";
					break;
				case 1:
					newClass = "YellowBerserkerPlayer";
					currentClass = "AdultFemaleMidgardianPlayer";
					break;
				default:
					newClass = "RedBerserkerPlayer";
					currentClass = "AdultMaleMidgardianPlayer";
					break;
			} 
			morphed = MorphActor(0, newClass, "", -1, 0, "", "");

			delay(32*24);
			print(s:"YOU ARE BEGINNING TO CALM DOWN...");
			delay(32*8);
			int morphed2 = UnMorphActor(0);
			//TakeInventory("StatusChild", 1);
			break;
		default:
			morphed = UnMorphActor(0);
			break;
	}
}