Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [Script] zbl_Building_Attack_Announce
[Script] zbl_Building_Attack_Announce [message #371667] Wed, 11 February 2009 17:11 Go to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
.h
class zbl_Building_Attack_Announce : public ScriptImpClass
{
	bool announced;
	int team;
public:
	void Created(GameObject *o);
	void Damaged(GameObject *o, GameObject *d, float damage);
	void Timer_Expired(GameObject *o, int num);
};


.cpp

void zbl_Building_Attack_Announce::Created(GameObject *o)
{
	announced = 0;
	team = Get_Int_Parameter("Object_Team");
}
void zbl_Building_Attack_Announce::Damaged(GameObject *o, GameObject *d, float damage)
{
	if (!announced)
	{
		unsigned int r = 255, g = 255, b = 255;
		char Announce[256];
		sprintf(Announce, "Warning - The %s is under attack!", Get_Parameter("Translated"));
		Send_Message_Team(team, r, g, b, Announce);
		Create_2D_Sound_Team(Get_Parameter("Sound"), team);
		announced = 1;
		Commands->Start_Timer(o, this, Get_Float_Parameter("Interval"), 123);
	}
}
void zbl_Building_Attack_Announce::Timer_Expired(GameObject *o, int num)
{
	if (num == 123)
	{
		if (announced)
		{
			announced = 0;
		}
	}
}


Toggle Spoiler



Parameters:

Object_Team:int - The team the object belongs to.
Interval:float - The interval at which to announce "<building> is under attack!"
Sound:string - The sound file to play for the team, e.g. "Warning - Nod Airstrip Under Attack!" etc
Translated:string - The Translated Screenname of the object (what you want the object to be called)


The "Translated" parameter is there because I didn't want to look for a translation function nor include one for getting the preset's screenname. If another coder finds one, you're more than welcome to replace this parameter with that function call. Wink

[Updated on: Thu, 12 February 2009 10:29]

Report message to a moderator

Re: [Script] zbl_Building_Attack_Announce [message #371705 is a reply to message #371667] Wed, 11 February 2009 20:17 Go to previous messageGo to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
Nice man.
Re: [Script] zbl_Building_Attack_Announce [message #371755 is a reply to message #371667] Thu, 12 February 2009 06:18 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Pretty cool man, nice.
Just a couple of suggestions that might be nice for people...

Make the variables for r,g,b input parameters so people can send different colored messages. This is helpful for mods where the team colours are different to Red and Yellow, White messages are boring. Razz
Also, allow the user to choose between a team message and a global message, and a team sound, or a global sound.



Re: [Script] zbl_Building_Attack_Announce [message #371781 is a reply to message #371755] Thu, 12 February 2009 09:55 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
reborn wrote on Thu, 12 February 2009 06:18

Pretty cool man, nice.
Just a couple of suggestions that might be nice for people...

Make the variables for r,g,b input parameters so people can send different colored messages. This is helpful for mods where the team colours are different to Red and Yellow, White messages are boring. Razz
Also, allow the user to choose between a team message and a global message, and a team sound, or a global sound.



Razz All I did was clone what Renegade does already, but what Renegade does for only buildings, this works for anything. Razz


EDIT: Reborn, you can always just use "Get_Team_Color()" :/

unsigned int R, G, B; //might need to be pointers, but unsure - lol
Get_Team_Color(0, &R, &G, &B);

[Updated on: Thu, 12 February 2009 10:30]

Report message to a moderator

Re: [Script] zbl_Building_Attack_Announce [message #372340 is a reply to message #371781] Mon, 16 February 2009 06:03 Go to previous messageGo to next message
rrutk is currently offline  rrutk
Messages: 617
Registered: June 2007
Karma: 0
Colonel
yes, and please, someone fix those bugs with the message_send_custom_xx scripts on custom! (they show only the numeral message and color doesnt work too)

scripts 4.0 should include the bugfixed versions!

We should have a simple WORKING script: Display_Message_Custom_Team_Sound (to display a textmessage for seperated NOD/GDI teams on custom and play a sound).

[Updated on: Mon, 16 February 2009 06:07]

Report message to a moderator

Re: [Script] zbl_Building_Attack_Announce [message #372398 is a reply to message #372340] Mon, 16 February 2009 15:46 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
rrutk wrote on Mon, 16 February 2009 06:03

We should have a simple WORKING script: Display_Message_Custom_Team_Sound (to display a textmessage for seperated NOD/GDI teams on custom and play a sound).


Just FYI...

JFW_Message_Send_Custom
Display_Message - the message to display
Red/Blue/Green - RGB colour codes to send a coloured message
Sound - Sound to play
Message - Custom event to trigger on
Delete - Whether to delete itself after it's been sent. (defaults to false(0) I think...)
Re: [Script] zbl_Building_Attack_Announce [message #372399 is a reply to message #372398] Mon, 16 February 2009 15:53 Go to previous messageGo to next message
rrutk is currently offline  rrutk
Messages: 617
Registered: June 2007
Karma: 0
Colonel
Zack wrote on Mon, 16 February 2009 17:46

rrutk wrote on Mon, 16 February 2009 06:03

We should have a simple WORKING script: Display_Message_Custom_Team_Sound (to display a textmessage for seperated NOD/GDI teams on custom and play a sound).


Just FYI...

JFW_Message_Send_Custom
Display_Message - the message to display
Red/Blue/Green - RGB colour codes to send a coloured message
Sound - Sound to play
Message - Custom event to trigger on
Delete - Whether to delete itself after it's been sent. (defaults to false(0) I think...)


this script is bugged. like written. try to use it.

[Updated on: Mon, 16 February 2009 15:54]

Report message to a moderator

Re: [Script] zbl_Building_Attack_Announce [message #372709 is a reply to message #371667] Fri, 20 February 2009 05:30 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Very nice Rocked Over
Re: [Script] zbl_Building_Attack_Announce [message #372727 is a reply to message #372399] Fri, 20 February 2009 08:16 Go to previous message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
rrutk wrote on Mon, 16 February 2009 15:53

Zack wrote on Mon, 16 February 2009 17:46

rrutk wrote on Mon, 16 February 2009 06:03

We should have a simple WORKING script: Display_Message_Custom_Team_Sound (to display a textmessage for seperated NOD/GDI teams on custom and play a sound).


Just FYI...

JFW_Message_Send_Custom
Display_Message - the message to display
Red/Blue/Green - RGB colour codes to send a coloured message
Sound - Sound to play
Message - Custom event to trigger on
Delete - Whether to delete itself after it's been sent. (defaults to false(0) I think...)


this script is bugged. like written. try to use it.



I have used it. Wilost0rm has used. He recommended it to me. It's used several times on his server-side mod for C&C_GDI_Survival. It must be how you're using it. Unless Wilo can confirm your statement..
Previous Topic: [skin] New Nuke Explosion
Next Topic: [skin] Blue Doors
Goto Forum:
  


Current Time: Wed Dec 04 12:43:20 MST 2024

Total time taken to generate the page: 0.00729 seconds