Pyroscourge: For testing conveniences, I've implemented a working Buddha check. This will allow players to survive more than one hit.
Code: Select all
////////////////////////////////////////////////////////////////////////////////
///////////////////////////Damage///////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
int DPlayerAngle;
int DPlayerPitch;
int RecentDamage;
int BuddhaHealthCheck;
Script 16600 (int Damage)
{
//PrintBold(s:"Debug");
DPlayerAngle = GetActorAngle(1000);
DPlayerPitch = GetActorPitch(1000);
if(Damage <= 1) //takes 2 hits to kill.
{
//2 second invuln after 1 damage.
if(RecentDamage == 1)
{
Terminate;
}
//PrintBold(s:"Damage == 1");
if(Health > 1)
{
//PrintBold(s:"Health equaled 2");
Health = 1;
RecentDamage = 1;
SetActorAngle(1000,DPlayerAngle+(Random(Random(-0.075,-0.025),Random(0.025,0.075))));
SetActorPitch(1000,DPlayerPitch+(Random(Random(-0.075,-0.025),Random(0.025,0.075))));
Thing_Damage(1000,50,0);
Acs_NamedExecute("DamageTimer",0);
}
else
{
if (CheckFlag(1000,"NODAMAGE"))
{
//PrintBold(s:"Immune");
Acs_NamedExecute("DamageTimer",0);
Terminate;
}
BuddhaHealthCheck = GetActorProperty(1000,APROP_Health); //Record current HP here.
SetActorProperty(1000,APROP_Health,1); //Set health to 1.
Thing_Damage(1000,50,0); //If they live, it's simple: they have buddha mode on.
if (GetActorProperty(1000,APROP_Health) > 0)
{
//PrintBold(s:"Saved");
SetActorProperty(1000,APROP_Health,BuddhaHealthCheck); //Restore it, because otherwise bad things will happen if buddha mode is turned off (so much for health regen.)
Acs_NamedExecute("DamageTimer",0);
Terminate;
}
//PrintBold(s:"Health equaled 1");
Health = 0;
Acs_Terminate(16500,0);
SetActorAngle(1000,DPlayerAngle+(Random(Random(-0.075,-0.025),Random(0.025,0.075))));
SetActorPitch(1000,DPlayerPitch+(Random(Random(-0.075,-0.025),Random(0.025,0.075))));
//Thing_Destroy(1000,0);
GiveInventory("TargetDead",1);
Delay(105);
SetHudSize(370,290,1);
HudMessageBold(s:"Game Over";HUDMSG_FADEINOUT,1,CR_PURPLE,185.0,100.0,999999.0,2.0,999999.0);
Delay(140);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(2);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(35);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
}
}
else if (Damage == 2) //Damage equals 2 or higher instant death
{
if (CheckFlag(1000,"NODAMAGE"))
{
//PrintBold(s:"Immune");
Acs_NamedExecute("DamageTimer",0);
Terminate;
}
BuddhaHealthCheck = GetActorProperty(1000,APROP_Health);
SetActorProperty(1000,APROP_Health,1);
Thing_Damage(1000,50,0);
if (GetActorProperty(1000,APROP_Health) > 0)
{
//PrintBold(s:"Saved");
SetActorProperty(1000,APROP_Health,BuddhaHealthCheck);
Acs_NamedExecute("DamageTimer",0);
Terminate;
}
//PrintBold(s:"Health equaled 1");
Health = 0;
Acs_Terminate(16500,0);
SetActorAngle(1000,DPlayerAngle+(Random(-0.075,0.075)));
SetActorPitch(1000,DPlayerPitch+(Random(-0.075,0.075)));
Thing_Destroy(1000,0);
GiveInventory("TargetDead",1);
Delay(105);
SetHudSize(370,290,1);
HudMessageBold(s:"Game Over";HUDMSG_FADEINOUT,1,CR_PURPLE,185.0,100.0,999999.0,2.0,999999.0);
Delay(140);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(2);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(35);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
}
else
{
Health = 0;
Acs_Terminate(16500,0);
SetActorAngle(1000,DPlayerAngle+(Random(-0.075,0.075)));
SetActorPitch(1000,DPlayerPitch+(Random(-0.075,0.075)));
Thing_Destroy(1000,0);
GiveInventory("TargetDead",1);
Delay(105);
SetHudSize(370,290,1);
HudMessageBold(s:"Game Over";HUDMSG_FADEINOUT,1,CR_PURPLE,185.0,100.0,999999.0,2.0,999999.0);
Delay(140);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(2);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(35);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(3);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_PURPLE,185.0,100.0,0.0);
Delay(1);
HudMessageBold(s:"Game Over";HUDMSG_PLAIN,1,CR_BLACK,185.0,100.0,0.0);
}
}
Consider using instant death as 3 instead of 2 for teleporting the actor and then killing them, such as Eye's red fade, Smile's suction, etc. This allows for much easier testing of things without the risk of dying and breaking god/buddha.
Another thing: Add "Death:" above your "Remove:" states with A_JumpIf(health <= 0,2) above it for all monsters, followed by A_ChangeFlag("COUNTKILL",0) to fix the kill count issues. This also ensures they all die and go to the remove state without leaving a bunch of messed up kill count numbers.
Some characters like the Eyes will need another A_JumpIf(health <= 0,2) over the script execution if you want to stop them from enacting it. I don't know why you gave Smile a crash state, but there's no reason for it to have one, especially if you intend to kill it off somehow.