

SCRIPT 256 ENTER
{
// Assign each player a TID.
   Thing_ChangeTID(0, 1000 + PlayerNumber());
}

SCRIPT 257 ENTER // Player's recovery rate based on skill level
{
 
 delay(NaturalPowerRecoverRate);
 GiveActorInventory(PlayerNumber()+1000,"GodAmmo", 1);
 //GiveInventory("GodAmmo", 1);
 if (GameSkill () == SKILL_VERY_EASY || GameSkill () == SKILL_VERY_HARD)
 	 { TakeActorInventory(PlayerNumber()+1000,"GodAmmo", 1); }
 restart;
}

SCRIPT 327 OPEN		// Changes recovery rate based on game skill
{
	if (GameSkill () == SKILL_VERY_EASY)
 	 { NaturalPowerRecoverRate = 7; }

	else if (GameSkill () == SKILL_EASY)
 	 { NaturalPowerRecoverRate = 11; }

	else if (GameSkill () == SKILL_NORMAL)
	 { NaturalPowerRecoverRate = 15; }

	else if (GameSkill () == SKILL_HARD)
	 { NaturalPowerRecoverRate = 19; }

	else if (GameSkill () == SKILL_VERY_HARD)
 	{ NaturalPowerRecoverRate = 23; }
}

SCRIPT 328 OPEN		// Changes damage rate based on game skill
{
	if (GameSkill () == SKILL_VERY_EASY)
 	 { LifeDrainRate = 9; }

	else if (GameSkill () == SKILL_EASY)
 	 { LifeDrainRate = 7; }

	else if (GameSkill () == SKILL_NORMAL)
	 { LifeDrainRate = 5; }

	else if (GameSkill () == SKILL_HARD)
	 { LifeDrainRate = 3; }

	else if (GameSkill () == SKILL_VERY_HARD)
 	{ LifeDrainRate = 1; }
}

SCRIPT 329 OPEN		// Changes recovery rate based on game skill
{
	if (GameSkill () == SKILL_VERY_EASY)
	{ LifeRecoverRate = 1; PowerRecoverRate = 1; }

	else if (GameSkill () == SKILL_EASY)
 	 { LifeRecoverRate = 2; PowerRecoverRate = 2; }

	else if (GameSkill () == SKILL_NORMAL)
	 { LifeRecoverRate = 3; PowerRecoverRate = 3; }

	else if (GameSkill () == SKILL_HARD)
	 { LifeRecoverRate = 4; PowerRecoverRate = 4; }

	else if (GameSkill () == SKILL_VERY_HARD)
 	{ LifeRecoverRate = 5; PowerRecoverRate = 5; }
}

SCRIPT 330 OPEN		// Changes luck based on game skill
{
	if (GameSkill () == SKILL_VERY_EASY)
 	 { luck = 5; }

	else if (GameSkill () == SKILL_EASY)
 	 { luck = 4; }

	else if (GameSkill () == SKILL_NORMAL)
	 { luck = 3; }

	else if (GameSkill () == SKILL_HARD)
	 { luck = 2; }

	else if (GameSkill () == SKILL_VERY_HARD)
 	{ luck = 1; }
}

SCRIPT 331 ENTER 	// Rolling health for each player
{
   if (CheckActorInventory(PlayerNumber()+1000, "LifeCounter") > 0)
       {
	GiveActorInventory(PlayerNumber()+1000, "Health", 1);
	TakeActorInventory(PlayerNumber()+1000, "LifeCounter", 1);
       }
   //gives an interval between recovery.  Length depends on difficulty.
   delay(LifeRecoverRate);
   restart;
}

SCRIPT 332 ENTER 	// Rolling power for each player
{
   if (CheckActorInventory(PlayerNumber()+1000,"PowerCounter") > 0)
       {
	GiveActorInventory(PlayerNumber()+1000, "GodAmmo", 4);
	TakeActorInventory(PlayerNumber()+1000, "PowerCounter", 1);
	if (GameSkill () == SKILL_VERY_EASY || GameSkill () == SKILL_VERY_HARD)
 	 { TakeActorInventory(PlayerNumber()+1000,"GodAmmo", 4); }
        //heka_gain[0] --;
       }
   //gives an interval between recovery.  Length depends on difficulty.
   delay(PowerRecoverRate);
   restart;
}

//THIS WOULD BE FOR IF ROLLING HEALTH AND POWER DOWNWARDS IS IMPLEMENTED
/*
SCRIPT 333 ENTER 	// Rolling health for each player
{
   if (health_drain[PlayerNumber()] > 0)
       {
	TakeActorInventory(PlayerNumber()+1000, "Health", 1);
	health_drain[0] --;
       }
   //gives an interval between recovery.  Length depends on difficulty.
   delay(LifeDrainRate);
   restart;
}

SCRIPT 334 ENTER 	// Rolling heka for each player
{
   if (heka_drain[PlayerNumber()] > 0)
       {
	TakeActorInventory(PlayerNumber()+1000, "GodAmmo", 4);
        heka_gain[0] --;
       }
   //gives an interval between recovery.  Length depends on difficulty.
   delay(PowerDrainRate);
   restart;
}
*/

SCRIPT 339 RESPAWN
{
// Reassigns each player a TID after death.
   Thing_ChangeTID(0, 1000 + PlayerNumber());
}

script 340 DEATH // Player drops vital stuff when they die
{
/*
   for (int count = 0; count <=8; count++)
     if (Random(0,1) == 0)
       Thing_Spawn(1000+PlayerNumber(), T_BANANA, 0, 0);
   
       if (CheckInventory("Ankh"))
            Thing_Spawn(1000+PlayerNumber(), T_ANKH, 0, 0); 
       if (CheckInventory("Pentagram"))
            Thing_Spawn(1000+PlayerNumber(), T_PENTAGRAM, 0, 0);
       if (CheckInventory("Windbag"))
            Thing_Spawn(1000+PlayerNumber(), T_WINDBAG, 0, 0);
       if (CheckInventory("WarpOwl"))
            Thing_Spawn(1000+PlayerNumber(), T_OWL, 0, 0);
       if (CheckInventory("BowOfNit"))
            Thing_Spawn(1000+PlayerNumber(), T_BOW, 0, 0);
       if (CheckInventory("ScarabLauncher"))
            Thing_Spawn(1000+PlayerNumber(), T_SL, 0, 0);
       if (CheckInventory("KittenCannon"))
            Thing_Spawn(1000+PlayerNumber(), T_KC, 0, 0);
*/
		while (CheckInventory("DinkyKey") > 0)
		{
			takeInventory("DinkyKey",1);
			Spawn("DinkyKey",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),0,0);
		}
		
		while (CheckInventory("GemKeyRed") > 0)
		{
			takeInventory("GemKeyRed",1);
			Spawn("GemKeyRed",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),0,0);
		}
		
		while (CheckInventory("GemKeyGreen") > 0)
		{
			takeInventory("GemKeyGreen",1);
			Spawn("GemKeyGreen",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),0,0);
		}
		
		while (CheckInventory("GemKeyBlue") > 0)
		{
			takeInventory("GemKeyBlue",1);
			Spawn("GemKeyBlue",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),0,0);
		}
		
		while (CheckInventory("GemKeyCyan") > 0)
		{
			takeInventory("GemKeyCyan",1);
			Spawn("GemKeyCyan",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),0,0);
		}
		
		while (CheckInventory("GemKeyMagenta") > 0)
		{
			takeInventory("GemKeyMagenta",1);
			Spawn("GemKeyMagenta",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),0,0);
		}
		
		while (CheckInventory("GemKeyYellow") > 0)
		{
			takeInventory("GemKeyYellow",1);
			Spawn("GemKeyYellow",getActorX(ActivatorTID()), getActorY(ActivatorTID()), getActorZ(ActivatorTID()),0,0);
		}
}