
#Library "PLAYERESPID"
#Include "ZCommon.acs"

Script "PLAYERESPID" Enter
{
     Int PNum=PlayerNumber();
	While(PlayerNumber()==PNum)
    {
        Delay(1);
    }
}

Script "SetPlayerSpeed" (Int Speed)
{
    SetActorProperty(0,APROP_Speed,1.0*Speed/100);
}

Script "SetPlayerView" (Int ViewHeight)
{
    SetActorProperty(0,APROP_ViewHeight,1.0*ViewHeight);
} 

Script "SetPlayerHeight" (Int Height)
{
    SetActorProperty(0,APROP_Height,1.0*Height);
} 

Script "AutoSaveGame" Enter
{
        Delay(35*90);
        AutoSave();
		Print(s:"Game Saved");
		Restart;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////HP//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Script "ACSVialll_HP" (void)
{
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
}

Script "ACSCurita_HP" (void)
{
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(30);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
		Delay(35);
		HealThing(1,100);
}

Script "ACSPastillita_HP" (void)
{
		Delay(15);
		HealThing(1,100);
		Delay(15);
		HealThing(1,100);
		Delay(15);
		HealThing(1,100);
		Delay(15);
		HealThing(1,100);
		Delay(15);
		HealThing(1,100);
		Delay(20);
		HealThing(1,100);
		Delay(20);
		HealThing(1,100);
		Delay(20);
		HealThing(1,100);
		Delay(20);
		HealThing(1,100);
		Delay(20);
		HealThing(1,100);
		Delay(25);
		HealThing(1,100);
		Delay(25);
		HealThing(1,100);
		Delay(25);
		HealThing(1,100);
		Delay(25);
		HealThing(1,100);
		Delay(25);
		HealThing(1,100);
}

Script "ACSVacuna_HP" (void)
{
		Delay(5);
		HealThing(1,100); Delay(5); HealThing(1,100);
		Delay(5);
		HealThing(1,100); Delay(5); HealThing(1,100);
		Delay(5);
		HealThing(1,100); Delay(5); HealThing(1,100);
		Delay(5);
		HealThing(1,100); Delay(5); HealThing(1,100);
		Delay(5);
		HealThing(1,100); Delay(5); HealThing(1,100);
		Delay(10);
		HealThing(1,100); Delay(10); HealThing(1,100);
		Delay(10);
		HealThing(1,100); Delay(10); HealThing(1,100);
		Delay(10);
		HealThing(1,100); Delay(10); HealThing(1,100);
		Delay(10);
		HealThing(1,100); Delay(10); HealThing(1,100);
		Delay(10);
		HealThing(1,100); Delay(10); HealThing(1,100);
		Delay(15);
		HealThing(1,100); Delay(15); HealThing(1,100);
		Delay(15);
		HealThing(1,100); Delay(15); HealThing(1,100);
		Delay(15);
		HealThing(1,100); Delay(15); HealThing(1,100);
		Delay(20);
		HealThing(1,100); Delay(20); HealThing(1,100);
		Delay(25);
		HealThing(1,100); Delay(25); HealThing(1,100);
}

Script "desangracionACS" Enter
{
        Delay(4);
        If(CheckInventory("desangracion")>0)
        {
				If(CheckInventory("BENDAGEDURO")>0)
				{
                        TakeInventory("desangracion",999);
						TakeInventory("BENDAGEDURO",1);
                        Print(s:"Bleeding was prevented");
						Restart;
                }
		Else
		{
        Thing_Damage2 (0,1,"BleenDing");
		Print(s:"you're bleeding");
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		Delay(5);
		GiveInventory("CrossHairUnt",2);
		}
        }
        Restart;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////SPAM////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// 0.0027   = pitch 1.00		Amount:  100
// 0.0014   = pitch 0.50		Amount:  50
// 0.00027  = pitch 0.10		Amount:  10
// 0.00014  = pitch 0.005		Amount:  5

Script "RCorrectorACS" Enter
{
			Delay(1);
		If(CheckInventory("RCorrector")>=41)
		{
			SetActorPitch(0,GetActorPitch(0)+0.00028); //toma 0.10
			TakeInventory("RCorrector",12);
			Restart;
		}
		
		Else
		If(CheckInventory("RCorrector")>=10)
		{
			SetActorPitch(0,GetActorPitch(0)+0.00014); //toma 0.005
			TakeInventory("RCorrector",9);
			Restart;
		}
		
		Else
		If(CheckInventory("RCorrector")>0)
		{
			SetActorPitch(0,GetActorPitch(0)+0.000028); //toma 0.001
			TakeInventory("RCorrector",1);
			Restart;
		}
	}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////ITEMS////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Script "NightVisionConsumer" Enter
{
        Delay(35*2);

        If(CheckInventory("PowerLightAmp2"))
        {
                TakeInventory("Infrared_INV",1);

                If(!CheckInventory("Infrared_INV"))
                {
                        TakeInventory("PowerLightAmp2",999);
                        Print(s:" ");
                }
        }
        Restart;
}

Script "RadSuitConsumer" Enter
{
        Delay(35*1);

        If(CheckInventory("PowerIronFeet2"))
        {
                TakeInventory("RadSuit_INV",1);

                If(!CheckInventory("RadSuit_INV"))
                {
                        TakeInventory("PowerIronFeet2",999);
                        Print(s:" ");
                }
        }
        Restart;
}

Script "BlurConsumer" Enter
{
        Delay(35*1);
        If(CheckInventory("PowerInvisibility2"))
        {
                TakeInventory("BlurSphere_INV",1);
                If(!CheckInventory("BlurSphere_INV"))
                {
                        TakeInventory("PowerInvisibility2",999);
                        Print(s:" ");
                }
        }
        Restart;
}

Script "InvulConsumer" Enter
{
        Delay(20*1);

        If(CheckInventory("PowerInvulnerable2"))
        {
                TakeInventory("InvulnerabilitySphere_INV",1);
                If(!CheckInventory("InvulnerabilitySphere_INV"))
                {
                        TakeInventory("PowerInvulnerable2",999);
                        Print(s:" ");
                }
        }
        Restart;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////run test//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Script "RuningACS" Enter
{
        Delay(1);
		If(GetPlayerInput(-1,MODINPUT_BUTTONS)&BT_SPEED)
				{
                        GiveInventory("RunCheckItem",1);
						Restart;
                }
		TakeInventory("RunCheckItem",5);
        Restart;
}

Script "JumpACS" Enter
{
        Delay(1);
		If(GetPlayerInput(-1,MODINPUT_BUTTONS)&BT_JUMP)
				{
                        GiveInventory("CrossHairUnt",9);
						Delay(30);
						Restart;
                }
		Else
        Restart;
}

Script "CrouchACS" Enter
{
        Delay(1);
		If(GetPlayerInput(-1,MODINPUT_BUTTONS)&BT_CROUCH)
				{
                        TakeInventory("CrossHairUnt",1);
						GiveInventory("CrouchCheck",1);
						Delay(4);
						Restart;
                }
		Else
		TakeInventory("CrouchCheck",1);
        Restart;
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Script "MoveCheckACS" Enter
{
        Delay(1);
		int buttons = GetPlayerInput(-1, INPUT_BUTTONS);
		
		if (buttons & (BT_FORWARD|BT_BACK|BT_MOVELEFT|BT_MOVERIGHT))
			{
				If(GetPlayerInput(-1,MODINPUT_BUTTONS)&BT_CROUCH)
					{
						Restart;
					}
				Else
				If(CheckInventory("CrossHairUnt")>=5)
					{
						Restart;
					}
				Else
				GiveInventory("CrossHairUnt",1);
				Restart;
			}
		Else
		Restart;
}

Script "CrouchAimACS" Enter
{
        Delay(1);
		If(GetPlayerInput(-1,MODINPUT_BUTTONS)&BT_CROUCH)
			{
				Restart;
			}
		Else
		If(CheckInventory("CrossHairUnt")<=3)
			{
				GiveInventory("CrossHairUnt",1);
				Restart;
			}
		Else
		Restart;
}

///Script "DashACS" Enter
///{
///      Delay(1);
///   	If(GetPlayerInput(-1,MODINPUT_BUTTONS)&BT_SPEED)
///			{
///				playsound(0,"FORCE",3,1.0,0,ATTN_NONE);
///				ThrustThing(GetActorAngle(0) >> 8, 12, 1, 0);
///				Delay(45);
///				Restart;
///			}
///		Else
///		Restart;
///}








