Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Low Health
Re: Low Health [message #315858 is a reply to message #315780] Wed, 06 February 2008 14:52 Go to previous messageGo to previous message
Genesis2001
Messages: 1397
Registered: August 2006
Karma:
General (1 Star)
Angry

One mistake and spammed to death with complaints Sad

I was writing it notepad because I don't have my development environment at school :/

*hopefully fixed* :v If not, someone else can make it while I take the blame for bad scripting. :/

Header File:
class zbl_Health_Level : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
	int ID;
	bool SentHealth;
	bool SentArmour;
};


Source File:
void zbl_Health_Level::Created(GameObject *obj) {
	ID = Get_Player_ID(obj);
	SentHealth = false;
	SentArmour = false;
	Commands->Start_Timer(obj, this, 1.0f, 123);
}
void zbl_Health_Level::Timer_Expired(GameObject *obj, int number) {
	if (number == 123) {
		if (!SentHealth && !SentArmour) {
			if (Commands->Get_Health(obj) <= 25 && !SentHealth) {
				Commands->Create_2D_WAV_Sound("correction_3.wav"); // Change this
				char Msg1[150];
				sprintf(Msg1, "ppage %d Warning: Health Level Critical", ID);
				Console_Input(Msg1);
				SentHealth = true; // To avoid spamming the player! :/
			}
			else if (Commands->Get_Shield_Strength(obj) <= 50 && !SentArmour) {
				Commands->Create_2D_WAV_Sound("correction_3.wav"); // again, change this...
				char Msg1[150];
				sprintf(Msg1, "ppage %d Warning: Armour strength critical", ID);
				Console_Input(Msg1);
				SentArmour = true; // avoid spamming the player >_>
			}
			Sent = true;
			Commands->Start_Timer(obj, this, 1.0f, 123);
		}
		else { // already sent...Check to see if their health is above 25 and set it back to false
			if (Commands->Get_Health(obj) > 25) {
				SentHealth = false;
			}
			else if (Commands->Get_Shield_Strength(obj) > 50) {
				SentArmour = false;
			}
		}
	}
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GDI Guard Tower(s)?
Next Topic: RenX - protected models?
Goto Forum:
  


Current Time: Fri Sep 06 13:08:14 MST 2024

Total time taken to generate the page: 0.01178 seconds