Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » AirStrike ported to 4.0
AirStrike ported to 4.0 [message #471796] Tue, 17 July 2012 05:57 Go to next message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma: 0
Colonel

I finaly ported over reborns airstrike script.

AirStrike Script
void DSG_GDI_a10_strike::Created(GameObject *obj) {
Commands->Create_2D_WAV_Sound("m00evan_dsgn0073i1evan_snd.wav");
		Console_Input("msg Warning!!!");
		Console_Input("msg A-10 strike inbound at Nod's position");

		GameObject *BuildingObj = Get_Random_Building(0);
                BuildingID = Commands->Get_ID(BuildingObj);
		A10ID = Commands->Get_ID(Commands->Create_Object("Invisible_Object",Commands->Get_Position(BuildingObj)));

		Commands->Start_Timer(obj,this,3.0f,1);
		Commands->Start_Timer(obj,this,6.0f,2);
		Commands->Start_Timer(obj,this,9.0f,3);
		Commands->Start_Timer(obj,this,10.0f,4);
		Commands->Start_Timer(obj,this,17.5f,5);
		Commands->Start_Timer(obj,this,25.5f,6);
}

void DSG_GDI_a10_strike::Timer_Expired(GameObject *obj, int number) {
GameObject *thebuilding = Commands->Find_Object(BuildingID);
GameObject *a101 = Commands->Find_Object(A10ID);

Vector3 position = Commands->Get_Position(thebuilding);

	if (number == 1){
Commands->Create_2D_WAV_Sound("m00evan_dsgn0014i1evan_snd.wav");
	}
	if (number == 2){
Commands->Create_2D_WAV_Sound("m00evan_dsgn0066i1evan_snd.wav");
	}
	if (number == 3){
		Commands->Attach_Script(a101,"Test_Cinematic","a-10_1.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","a-10_2.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","a-10_3.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","a-10_4.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","a-10_5.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","a-10_6.txt");
	}
	if (number == 4){
		Commands->Attach_Script(a101,"Test_Cinematic","A-10_bomb.txt");
	}
	if (number == 5){
		    Commands->Create_2D_WAV_Sound("mx0_a-10_166.wav");
			Commands->Attach_Script(a101,"Test_Cinematic","a-10_1.txt");
            Commands->Attach_Script(a101,"Test_Cinematic","a-10_4.txt");
            Commands->Attach_Script(a101,"Test_Cinematic","a-10_5.txt");
            Commands->Attach_Script(a101,"Test_Cinematic","a-10_6.txt");
	}
	if (number == 6){
			Commands->Create_Explosion("Air_Explosion_Death",position,a101);
			Commands->Attach_Script(a101,"Test_Cinematic","a-10_2.txt");
			Commands->Attach_Script(a101,"Test_Cinematic","a-10_3.txt");

		float buildinghealth = Commands->Get_Health(thebuilding);
		Commands->Set_Health(thebuilding,(buildinghealth/2));
		Commands->Destroy_Object(a101);

	}
}

ScriptRegistrant<DSG_GDI_a10_strike> DSG_GDI_a10_strike_Registrant("DSG_GDI_a10_strike","");

void DSG_Nod_Jet_strike::Created(GameObject *obj) {
		Commands->Create_2D_WAV_Sound("m00evan_dsgn0073i1evan_snd.wav");
		Console_Input("msg Warning!!!");
		Console_Input("msg Lear Jet strike inbound at GDI's position");

		GameObject *BuildingObj = Get_Random_Building(1);
                BuildingID = Commands->Get_ID(BuildingObj);
		A10ID = Commands->Get_ID(Commands->Create_Object("Invisible_Object",Commands->Get_Position(BuildingObj)));

		Commands->Start_Timer(obj,this,3.0f,1);
		Commands->Start_Timer(obj,this,6.0f,2);
		Commands->Start_Timer(obj,this,9.0f,3);
		Commands->Start_Timer(obj,this,10.0f,4);
		Commands->Start_Timer(obj,this,23.5f,5);
		Commands->Start_Timer(obj,this,25.5f,6);
}

void DSG_Nod_Jet_strike::Timer_Expired(GameObject *obj, int number) {

GameObject *thebuilding = Commands->Find_Object(BuildingID);
GameObject *a101 = Commands->Find_Object(A10ID);

Vector3 position = Commands->Get_Position(thebuilding);

	if(number == 1){

		Commands->Create_2D_WAV_Sound("m00gnod_hesx0007r3nors_snd.wav");
	}
	if(number == 2){
		Commands->Create_2D_WAV_Sound("m00evan_dsgn0014i1evan_snd.wav");
	}
	if(number == 3){
		Commands->Attach_Script(a101,"Test_Cinematic","jet_1.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_2.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_3.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_4.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_5.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_6.txt");
	}
	if(number == 4){
		Commands->Attach_Script(a101,"Test_Cinematic","Jet_bomb.txt");
	}
	if(number == 5){
		Commands->Create_2D_WAV_Sound("m00itoc_010in_ners_snd.wav");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_1.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_2.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_6.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_3.txt");
		Commands->Attach_Script(obj,"reb_Nod_Jet_strike7","");
	}
	if(number == 6){
		Commands->Create_Explosion("Air_Explosion_Death",position,a101);
		Commands->Attach_Script(a101,"Test_Cinematic","jet_6.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_3.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_4.txt");
		Commands->Attach_Script(a101,"Test_Cinematic","jet_5.txt");

		float buildinghealth = Commands->Get_Health(thebuilding);
		Commands->Set_Health(thebuilding,(buildinghealth/2));
	}
}

ScriptRegistrant<DSG_Nod_Jet_strike> DSG_Nod_Jet_strike_Registrant("DSG_Nod_Jet_strike","");


AirStrike code for your .h

class DSG_GDI_a10_strike : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
	int BuildingID;
	int A10ID;
};



class DSG_Nod_Jet_strike : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
	int BuildingID;
	int A10ID;
};


Get random building code, goes in engine_game.cpp

GameObject SCRIPTS_API *Get_Random_Building(int Team) {
	SList<GameObject> Buildings;
	SLNode<BuildingGameObj> *x = GameObjManager::BuildingGameObjList.Head();
	while (x)
	{
		GameObject *obj = (GameObject *)x->Data();
		if (obj && (Get_Object_Type(obj) == Team) && !Is_Building_Dead(obj)) {
			Buildings.Add_Head(obj);
		}
		x = x->Next();
	}
	if (!Buildings.Is_Empty()) {
		SLNode<GameObject> *x =  Buildings.Head();
		int Rand = Commands->Get_Random_Int(0,Buildings.Get_Count());
		int Counter = 0;
		while (x)
		{
			GameObject *o = x->Data();
			if(o && Rand == Counter)
			{
				return o;
			}
			Counter ++;
			x = x->Next();
		}	
		return NULL;
	}
	return NULL;
}


and this in engine_game.h for it to work

GameObject SCRIPTS_API *Get_Random_Building(int Team);


Link to Cin text.

http://dsgaming.us/distrbd21/AirStrike.zip

I believe that is all, If I forgot something let me know.

And yes I changed reb to DSG, as a worked hard to port it over with the help of these guys.

EDIT: When I get the Cin to work right with the planes looped I will update this topic.

for now just use this instead.

Reborn:

They just stay there, but no loop?

That makes sense I guess, it's just stuck on the last frame of the animation...

They are all real objects, so you can destroy them. I can't remember from memory what the right syntax is, but it is most likely something simple like destroy_object;

Or you could attach a script to it that destroys the object after x amount of time...

void reb_timed_destroy::Created(GameObject *obj){
Commands->Start_Timer(obj,this,31.0f,1);
}

void reb_timed_destroy::Timer_Expired(GameObject *obj, int number){
	if(number ==1){
Commands->Destroy_Object(obj);
	}
}



ScriptRegistrant<reb_timed_destroy> reb_timed_destroy_Registrant("reb_timed_destroy","");



class reb_timed_destroy : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
};



Just change the float value 31.0f to however many seconds you want it to wait until it destroys the object it is attached to.


Credits go to.
Reborn for making the script.
robbyke for helping with the Get_Random_Building to somewhat work.
JonWil for helping me fix the Get_Randdom_Building to work with 4.0
And me for porting it over to 4.0.

Quote:

Note to anyone that thinks I'm a pro at C++ OR Perl I'm not, all I do is what I can to get things working for the rest of the community, if you don't like it to fucking bad cause I'm gonna do it anyway...


Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide

[Updated on: Tue, 17 July 2012 06:38]

Report message to a moderator

Re: AirStrike ported to 4.0 [message #471799 is a reply to message #471796] Tue, 17 July 2012 07:05 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
i know the fix for the loop thing Smile



-1 Play_Animation, 8, "X1A_FP10_A0.X1A_FP10_A0" , 0


use the zero to stop animations from looping one to make them loop



-1 Play_Animation, 7, "VF_GDI A10.VF_GDI A10" , 1


this one needs a loop else the plane wont be rendered




that should fix the plane loop flying over and over again


Owner of kambot TT server

kambot.freeforums.org
Re: AirStrike ported to 4.0 [message #471816 is a reply to message #471796] Tue, 17 July 2012 10:32 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

This is actually pretty cool, I remember seeing this airstrike plugin when he released it but I never personally used it. Hopefully some more people will use it.

I do find it entertaining that you renamed this to DSG even though you didn't change a SINGLE line of code in the actual airstrike files other than renaming the reb_airstrike to DSG_airstrike. Sounds like "porting" to me. (there is a different Get_Random_Building function, but someone else made that)


-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

[Updated on: Tue, 17 July 2012 14:40]

Report message to a moderator

Re: AirStrike ported to 4.0 [message #471832 is a reply to message #471796] Tue, 17 July 2012 15:37 Go to previous messageGo to next message
Xpert is currently offline  Xpert
Messages: 1588
Registered: December 2005
Location: New York City
Karma: 0
General (1 Star)
Can't really call it porting.


Could of also used Find_Random_Preset_By_Team or Find_Random_Preset and check if it's a building object.

There's also a Find_Building_By_Team and a Find_Building_By_Preset in 4.0 already. I don't know why jonwil didn't just point you to that, lol.


http://i32.photobucket.com/albums/d42/XpertMaverick/xpertyankee.jpg

Creator of NetGuard, an IRC network regulator.
Developer of the CloudyServ 0.982-X project.
Developer of the CloudyServ Ren-X bot.

Part time streamer - https://twitch.tv/gg_wonder
Re: AirStrike ported to 4.0 [message #471840 is a reply to message #471832] Tue, 17 July 2012 17:01 Go to previous messageGo to next message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma: 0
Colonel

Xpert wrote on Tue, 17 July 2012 17:37

Can't really call it porting.


Could of also used Find_Random_Preset_By_Team or Find_Random_Preset and check if it's a building object.

There's also a Find_Building_By_Team and a Find_Building_By_Preset in 4.0 already. I don't know why jonwil didn't just point you to that, lol.


Thought about those I might look into that.


Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
Re: AirStrike ported to 4.0 [message #471848 is a reply to message #471840] Tue, 17 July 2012 17:43 Go to previous messageGo to next message
Xpert is currently offline  Xpert
Messages: 1588
Registered: December 2005
Location: New York City
Karma: 0
General (1 Star)
Distrbd21 wrote on Tue, 17 July 2012 20:01

Xpert wrote on Tue, 17 July 2012 17:37

Can't really call it porting.


Could of also used Find_Random_Preset_By_Team or Find_Random_Preset and check if it's a building object.

There's also a Find_Building_By_Team and a Find_Building_By_Preset in 4.0 already. I don't know why jonwil didn't just point you to that, lol.


Thought about those



You probably didn't know they exist.


http://i32.photobucket.com/albums/d42/XpertMaverick/xpertyankee.jpg

Creator of NetGuard, an IRC network regulator.
Developer of the CloudyServ 0.982-X project.
Developer of the CloudyServ Ren-X bot.

Part time streamer - https://twitch.tv/gg_wonder
Re: AirStrike ported to 4.0 [message #471855 is a reply to message #471848] Tue, 17 July 2012 18:52 Go to previous messageGo to next message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma: 0
Colonel

Xpert wrote on Tue, 17 July 2012 19:43

Distrbd21 wrote on Tue, 17 July 2012 20:01

Xpert wrote on Tue, 17 July 2012 17:37

Can't really call it porting.


Could of also used Find_Random_Preset_By_Team or Find_Random_Preset and check if it's a building object.

There's also a Find_Building_By_Team and a Find_Building_By_Preset in 4.0 already. I don't know why jonwil didn't just point you to that, lol.


Thought about those



You probably didn't know they exist.

I did know they did, I'm not a dumbass I know how to read.

And thats it I'm done helping out the community if they need something they can come find me and ask.

All you guys do is bitch when someone else does something that you didn't, instead of bitching you should do it yourself.


And reborn hasn't said a dam thing to me about changing it, if he does I would be more then happy to change it back..



Live Your Life Not Some one Else's.| Sharing Is Caring

http://dsgaming.us/distrbd21/Distrbd21%20siggy.png

Cookie Jar

Suicide
Re: AirStrike ported to 4.0 [message #471860 is a reply to message #471796] Tue, 17 July 2012 19:58 Go to previous messageGo to next message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
dont even get why you guys are falling over something like a function name.....


he didnt make a plugin about it so why even bother to talk about that....



dont like the rename copy the code name it back wow


i ported over the same code and tbh that airstrike thing takes more than just that code in the original post was even noted that that code wasnt 100% and the txt files needed were bugged

gratz guys you just chased of someone that did dirty work for you.....


am i glad i only come to ask help and not post my code (which i actually can)


Owner of kambot TT server

kambot.freeforums.org
Re: AirStrike ported to 4.0 [message #471862 is a reply to message #471860] Tue, 17 July 2012 21:32 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

robbyke wrote on Tue, 17 July 2012 21:58

dont even get why you guys are falling over something like a function name.....


he didnt make a plugin about it so why even bother to talk about that....



dont like the rename copy the code name it back wow


i ported over the same code and tbh that airstrike thing takes more than just that code in the original post was even noted that that code wasnt 100% and the txt files needed were bugged

gratz guys you just chased of someone that did dirty work for you.....


am i glad i only come to ask help and not post my code (which i actually can)

Do you know why all the JFW scripts are named as such?

Because he made them

You can get upset and say I'm being a jackass, I DID say that this is indeed a good script and hopefully somebody will find a use for it (because to simulate an airstrike in Renegade is not very easy), I'm just pointing out that the only lines of code changed from the original is literally the change of name. Forgive me for pointing that out.


-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

[Updated on: Tue, 17 July 2012 21:34]

Report message to a moderator

Re: AirStrike ported to 4.0 [message #471873 is a reply to message #471796] Wed, 18 July 2012 04:37 Go to previous message
robbyke is currently offline  robbyke
Messages: 348
Registered: September 2010
Location: Belgium
Karma: 0
Recruit
i know that the names of scripts are from the people that wrote them i also know that ALOT of scripts are made double or even triple because those scripters dont do enough effort like some others to search for already existing code


and why is there a need to point such a dumb detail it isnt like he asked TT to import that script

and if the ppl from TT consider it a port they can just rename it back if they import it into scripts.dll


Owner of kambot TT server

kambot.freeforums.org
Previous Topic: [SSGM 4.0 Plugin] Screen Shake Console Command
Next Topic: [SSGM 4.0 Plugin] Reserved Slots
Goto Forum:
  


Current Time: Tue Dec 03 12:19:10 MST 2024

Total time taken to generate the page: 0.01375 seconds