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 previous message
Distrbd21 is currently offline  Distrbd21
Messages: 743
Registered: September 2008
Karma:
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [SSGM 4.0 Plugin] Screen Shake Console Command
Next Topic: [SSGM 4.0 Plugin] Reserved Slots
Goto Forum:
  


Current Time: Wed Nov 27 12:36:51 MST 2024

Total time taken to generate the page: 0.01035 seconds