Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [script]AirStrike function  () 1 Vote
[script]AirStrike function [message #301136] Wed, 05 December 2007 05:34 Go to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I made an airstrike funtion. Again I called it via a chat hook but it can be called in a number of ways.
The function chooses a working enemy building at random (this part is thanks to WhiteDragon, you have no idea how long and how many attempts it took to actually get that part right). Then either Nod lear jets or a10 bombers start flying over. One of them drops off a small payload to the random building an causes it to lose 50% of it's health.
The sounds and the rest of the planes flying over make it really realistic to be honest, I think it's quite smooth.

I set the a10 and lear jet to un-teamed via the objects.gm file because they count towards the vehichle limit otherwise. There are other ways of getting around that, but this seemed easiest.
I think I remember a slight issue with it with regards to the cinematics looping after being called. I'm sure that's just changing a 1 to a 0 in the text file somewhere after the animation.

Here's a video of it, it's 21mb long, but you should get a half decent download speed. It's worth watching even if you arean't going to put it on your server, just to see it in-game. It's a bit long, and I sound half asleep (because I was), but it's fun to see if you havn't before:

http://www.mp-gaming.com/reborn/movies/air_strike2.wmv


Here's how I made it work:

/////////////////////////
/////////////////////////
//// GDI A10 strike /////
/////////////////////////
/////////////////////////


void reb_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 reb_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);

	}
}


/////////////////////////
/////////////////////////
//// Nod Jet strike /////
/////////////////////////
/////////////////////////



void reb_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 reb_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<reb_GDI_a10_strike> reb_GDI_a10_strike_Registrant("reb_GDI_a10_strike","");

ScriptRegistrant<reb_Nod_Jet_strike> reb_Nod_Jet_strike_Registrant("reb_Nod_Jet_strike","");


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



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


This goes in the engine_gm.cpp file, and is worth making a topic about all by itself. WhiteDragon made the final solution after some really good coders looked at the problem. The function returns a working building for the team specified at random:


GameObject * Get_Random_Building(int Team) {
	std::vector<GameObject*> Buildings;
	GenericSLNode *x = BuildingGameObjList->HeadNode;
	while (x != 0) {
		GameObject *obj = (GameObject *)x->NodeData;
		if (obj && (Get_Object_Type(obj) == Team || Team == 2) && !Is_Building_Dead(obj)) {
			Buildings.push_back(obj);
		}
		x = x->NodeNext;
	}
	if (!Buildings.empty()) {
		int Rand = Commands->Get_Random_Int(0,Buildings.size());
		return Buildings[Rand];
	}
	return 0;
}


GameObject * Get_Random_Building(int Team);


Here are the conematic files that are called:

Jet_bomb.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 1: Solo A10 X1A_FP10_A0  ************************
;  This is a solo A10.  
; 
;***************************************************************************************


; ****************************** Vehicle

-1	Create_Object,	7, 	"v_jet"
-1    	Attach_Script,          7, "M01_Flyover_Generic_Script_JDG", "FUSELAGE"
-1	Play_Animation,		7, "VF_GDI A10.VF_GDI A10", 1
-470	Destroy_Object,		7

; ****************************** Flying Animation

-1	Create_Object,		8, "X1A_FP10_A0"
-1	Play_Animation,		8, "X1A_FP10_A0.X1A_FP10_A0", 1
-470	Destroy_Object,		8
-1	Attach_To_Bone,		7, 8, "BN_FP10_A0"

; ****************************** Nuke Cloud



; ****************************** Nuke Smoke

-495	Create_Object,		9, "ag_nuke_smoke"
-500	Destroy_Object,		9

; ****************************** Signal Flare

-1	Create_Real_Object,	10, "Refinery_Evac_Point"
-450	Destroy_Object,		10

;******************************* A-10 Bomb Drop

-380	Create_Object,		11, "X5D_PARACHUTE",
-380	Play_Animation,		11, "X5D_PARACHUTE.X5D_PARAC_2"


A-10_bomb.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 1: Solo A10 X1A_FP10_A0  ************************
;  This is a solo A10.  
; 
;***************************************************************************************


; ****************************** Vehicle

-1	Create_Object,	7, 	"VF_GDI A10"
-1    	Attach_Script,          7, "M01_Flyover_Generic_Script_JDG", "FUSELAGE"
-1	Play_Animation,		7, "VF_GDI A10.VF_GDI A10", 1
-470	Destroy_Object,		7

; ****************************** Flying Animation

-1	Create_Object,		8, "X1A_FP10_A0"
-1	Play_Animation,		8, "X1A_FP10_A0.X1A_FP10_A0", 1
-470	Destroy_Object,		8
-1	Attach_To_Bone,		7, 8, "BN_FP10_A0"

; ****************************** Nuke Cloud



; ****************************** Nuke Smoke

-495	Create_Object,		9, "ag_nuke_smoke"
-500	Destroy_Object,		9

; ****************************** Signal Flare

-1	Create_Real_Object,	10, "Refinery_Evac_Point"
-450	Destroy_Object,		10

;******************************* A-10 Bomb Drop

-380	Create_Object,		11, "X5D_PARACHUTE",
-380	Play_Animation,		11, "X5D_PARACHUTE.X5D_PARAC_2"


jet_1.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 3: HOVERCRAFT EXPLODE AT BEACH  ************************



; ****************************** Character Bone

-1	Create_Real_Object,	1, "Nod_Jet"
-1	Play_Animation,		1, "vf_gdi a10.vf_gdi a10", 1
-600	destroy_object,		1

; ****************************** Path

-1	Create_Object,		2, "X3_a10_dep1",			0, 0, 0, 0
-1	Play_Animation,		2, "X3_a10_dep1.X3_a10_dep1", 1
-600 	Destroy_Object,		2
-1	Attach_To_Bone,		1, 2, "BN_a-10_004"


Jet_2.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 3: HOVERCRAFT EXPLODE AT BEACH  ************************



; ****************************** Character Bone

-1	Create_Real_Object,	1, "Nod_Jet"
-1	Play_Animation,		1, "vf_gdi a10.vf_gdi a10", 1
-1200	destroy_object,		1

; ****************************** Path

-1	Create_Object,		2, "X3_a10_dep2",			0, 0, 0, 0
-1	Play_Animation,		2, "X3_a10_dep2.X3_a10_dep2", 1
-1200 	Destroy_Object,		2
-1	Attach_To_Bone,		1, 2, "BN_a-10_005"


Jet_3.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 3: HOVERCRAFT EXPLODE AT BEACH  ************************



; ****************************** Character Bone

-1	Create_Real_Object,	1, "Nod_Jetr"
-1	Play_Animation,		1, "vf_gdi a10.vf_gdi a10", 1
-600	destroy_object,		1

; ****************************** Path

-1	Create_Object,		2, "X3_a10_strk1",			0, 0, 0, 0
-1	Play_Animation,		2, "X3_a10_strk1.X3_a10_strk1", 1
-600 	Destroy_Object,		2
-1	Attach_To_Bone,		1, 2, "BN_a-10_000"


Jet_4.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 3: HOVERCRAFT EXPLODE AT BEACH  ************************



; ****************************** Character Bone

-1	Create_Real_Object,	1, "Nod_Jet"
-1	Play_Animation,		1, "vf_gdi a10.vf_gdi a10", 1
-600	destroy_object,		1

; ****************************** Path

-1	Create_Object,		2, "X3_a10_strk2",			0, 0, 0, 0
-1	Play_Animation,		2, "X3_a10_strk2.X3_a10_strk2", 1
-600 	Destroy_Object,		2
-1	Attach_To_Bone,		1, 2, "BN_a-10_001"


Jet_5.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 3: HOVERCRAFT EXPLODE AT BEACH  ************************



; ****************************** Character Bone

-1	Create_Real_Object,	1, "Nod_Jet"
-1	Play_Animation,		1, "vf_gdi a10.vf_gdi a10", 1
-600	destroy_object,		1

; ****************************** Path

-1	Create_Object,		2, "X3_a10_strk3",			0, 0, 0, 0
-1	Play_Animation,		2, "X3_a10_strk3.X3_a10_strk3", 1
-600 	Destroy_Object,		2
-1	Attach_To_Bone,		1, 2, "BN_a-10_002"


Jet_6.txt
;_________________________________________
;
; Available Cinematic Script Commands
;
; time/frame	Create_Object,	id (slot), preset_name, x, y, z, facing, animation
; id can be -1 to mean do not store this object, and do not destroy
; 0 Create_Object, 0, .44 Magnum, 0, 0, 0, 180, "Human.jump"
;
; time/frame	Destroy_Object, id (slot)
; 0 Destroy_Object, 0
;
; time/frame	Play_Animation, id (slot), animation_name, looping, sub_obj_name
; 0 Play_Animation, 0, "Human.Jump", false
;
; time/frame	Control_Camera,	id ( slot )
; use id -1 for disabling control;
; note this will also disable star control and disbale the hud
; 0 Control_Camera,	0
;
;_________________________________________

;*******************  CHEAT SHEET ******************************

;Start frame	create_object	slot number	model	x,y,z,facing	animation name( model*hierarchy*.anim )
;Start frame	Play_Animation 	slot number	anim name ( model*hierarchy*.anim )	looping		Sub Object
;Start frame	Play_Audio	wave filename	slot number	bone name
;								* no slot # / bone name = 2D Audio
;0= NO LOOP ( kills object when finshed )	1= LOOP

;************************* LEVEL 3: HOVERCRAFT EXPLODE AT BEACH  ************************



; ****************************** Character Bone

-1	Create_Real_Object,	1, "Nod_Jet"
-1	Play_Animation,		1, "vf_gdi a10.vf_gdi a10", 1
-600	destroy_object,		1

; ****************************** Path

-1	Create_Object,		2, "X3_a10_strk4",			0, 0, 0, 0
-1	Play_Animation,		2, "X3_a10_strk4.X3_a10_strk4", 1
-600 	Destroy_Object,		2
-1	Attach_To_Bone,		1, 2, "BN_a-10_003"


The a-10_1(2,3,4,5,6) are the exact same as this, other then object created should be changed from "Nod_Jet" to "GDI_A10_Flyover".

I hope you like it, and if you want to reply, I suggest no quotng Razz



[Updated on: Fri, 30 January 2009 14:16] by Moderator

Report message to a moderator

Re: AirStrike function [message #301139 is a reply to message #301136] Wed, 05 December 2007 05:42 Go to previous messageGo to next message
cpjok is currently offline  cpjok
Messages: 425
Registered: September 2007
Karma: 0
Commander
Hey Rborn I Watched The Video It Is Good How Do I Add It To M y Server
Re: AirStrike function [message #301141 is a reply to message #301136] Wed, 05 December 2007 05:54 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)
I made it specifically for SSGM, so your server would need to be running that.
You need to download the source code to SSGM that comes with the binaries anyway. You can find this on the www.black-cell.net downloads page here http://black-cell.net/downloads/index.php?act=category&id=6
(you will want the win32 version).

Then you open up the .sln file located in the source code folder with microsoft visual studio. If you do not have visual studio installed and set up, then you can see this post here created by JohnWill for exactly that purpose:
http://www.renegadeforums.com/index.php?t=msg&goto=296486&rid=3415&s rch=express#msg_296486

You add most of the code to the gm_main.cpp file, but there is some that goes in the gm_main.h file and the engine_gm.cpp and the engine_gm.h file.
Obviously you need to compile it aswell.

The cinematics need to be copy/pasted into there own .txt files and named what I have put just above the code tags and placed in your servers data folder.

You could call the function with a chat hook for testing, but ideally you will call the function some other way to add to gameplay.

chat hook example:

class GDIa10ChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
		Commands->Attach_Script(obj,"reb_GDI_a10_strike","");
	}
};
ChatCommandRegistrant<GDIa10ChatCommand> GDIa10ChatCommandReg("!a10g",CHATTYPE_TEAM,0,GAMEMODE_AOW);

class NodjetChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
		Commands->Attach_Script(obj,"reb_Nod_Jet_strike","");
	}
};
ChatCommandRegistrant<NodjetChatCommand> NodjetChatCommandReg("!a10n",CHATTYPE_TEAM,0,GAMEMODE_AOW);



Re: AirStrike function [message #301142 is a reply to message #301136] Wed, 05 December 2007 06:20 Go to previous messageGo to next message
cpjok is currently offline  cpjok
Messages: 425
Registered: September 2007
Karma: 0
Commander
I Run SSGM And Lua Plugin V2.0

so do i follow the tutorial you sent in last post
Re: AirStrike function [message #301143 is a reply to message #301136] Wed, 05 December 2007 06:39 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)
This code is c++ not LUA, but the LUA plug-in will not harm it in any-way.

If you get visual studio and the code to the right places. compile it and put it on your server then yes, you will be able to use the script.



Re: AirStrike function [message #301153 is a reply to message #301136] Wed, 05 December 2007 07:11 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
lol whats with the sharing reborn Tell Me Thumbs Up

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: AirStrike function [message #301161 is a reply to message #301136] Wed, 05 December 2007 07:52 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
Hm, reborn are you done with renegade, or why are you realising all your code?

Bückstabü!
Re: AirStrike function [message #301164 is a reply to message #301136] Wed, 05 December 2007 08:07 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)
I'm not done with renegade. I am hoping to set a trend.

If someone uses this code and the people in there server are happy with it then that's cool.
If someone reads this and thinks of a way to adapt it to suit there needs then that's cool too.
If it encourages others to post stuff then I might learn something, or it might give me inspiration, that's awesome.
There are allot of reasons to release the code, I could go on for a long time talking about the pro's. I can't really see any cons. Sure I might have had a unique feature for my server. But I don't really think it matters how cool your server is, people only seem to join the a0 servers anyway.
Besides, then people would only get to experiance it in one server.

Plus, I am not the greatest programmer there is. Infact I am probably one of the most newbie programmers here. I really won't dispute that, there are allot better coders then me here. Allot better. So if I post this then there might be someone who see's it and makes it better. Whether they do it out of kindness, ego, boredom or whatever it doesn't really bother me. But they might make it more efficient, or have a better idea and make something more awesome.

I have seen this kind of sharing, helping and collaberation on other game forums. Granted, they had more people that actually knew how to code, but it was really impressive to see people helping eachother out. There's few people here that do that. I don't know why. If I can encourage others to do the same then I will be really really pleased with myself.



Re: AirStrike function [message #301166 is a reply to message #301136] Wed, 05 December 2007 08:11 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
youre posting commands that i already have... ps. i have 3 diffrent airstrukes Very Happy
Re: AirStrike function [message #301167 is a reply to message #301166] Wed, 05 December 2007 08:12 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)
MadRockz wrote on Wed, 05 December 2007 10:11

youre posting commands that i already have... ps. i have 3 diffrent airstrukes Very Happy


Seeing as how anybody can now have an airstrike, and with the source code they can mix it up a bit. Why don't you release yours too? In Love



Re: AirStrike function [message #301169 is a reply to message #301136] Wed, 05 December 2007 08:17 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
cuz i dont wanted that all server have it, later all server´s will be the same. Then nobody get´s his 0wn Ideas... Smile oh and its only for lua cuz i still cant add scripts to scripts.dll Very Happy

[Updated on: Wed, 05 December 2007 08:18]

Report message to a moderator

Re: AirStrike function [message #301170 is a reply to message #301169] Wed, 05 December 2007 08: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)
MadRockz wrote on Wed, 05 December 2007 10:17

cuz i dont wanted that all server have it, later all server´s will be the same. Then nobody get´s his 0wn Ideas... Smile


That's the spirit.



Re: AirStrike function [message #301174 is a reply to message #301136] Wed, 05 December 2007 08:25 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
if all servers starting to be same im going to work on my new Renegade Mode ... Sarcasm
Re: AirStrike function [message #301182 is a reply to message #301136] Wed, 05 December 2007 08:35 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
What you should do is when you call a function which is supposed to return a pointer to something, check the pointer to make sure it isn't NULL.
GameObject *a101 = Commands->Find_Object(A10ID);
if(!a101)
{
   //an error 
}

[Updated on: Wed, 05 December 2007 08:36]

Report message to a moderator

Re: AirStrike function [message #301189 is a reply to message #301136] Wed, 05 December 2007 08:57 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
Quote:

But I don't really think it matters how cool your server is, people only seem to join the a0 servers anyway.


I think you are wrong, i dont have a really good a00 nick, but my server is unique and therefore popular.

But its your code and your spent time, i can only say.
Thx reborn for the code, i will add it to my aow mod. Sarcasm


Bückstabü!
Re: AirStrike function [message #301194 is a reply to message #301136] Wed, 05 December 2007 09:05 Go to previous messageGo to next message
bisen11 is currently offline  bisen11
Messages: 797
Registered: December 2004
Karma: 0
Colonel
Haven't watched the video yet so I don't know if it already does this. But perhaps you can make a way so that it doesn't work when there are enemy sam sites or something. But other than that, great job.

http://i6.photobucket.com/albums/y206/bisen11/bisensubzerosig2.jpg
Re: AirStrike function [message #301196 is a reply to message #301136] Wed, 05 December 2007 09:08 Go to previous messageGo to next message
crazfulla is currently offline  crazfulla
Messages: 667
Registered: September 2006
Location: Aotearoa
Karma: 0
Colonel
This would be good incorperated with Hex's Vet scriptys.

IE

Once you get promoted to level 3 or whatever, you gain access to the Airstrike Command which can be used once every 5 mins or so.

The existing !veh and !weap etc are pretty lame tbh.


"GEoDLeto wrote:"

so what you are saying it is gonna take even longer before this thing is finished
So the topic title should be changed to: a sucky little "teaser" from C&C Reborn has been released

"halo2pac wrote:"

Unless they are girls, I am not going to bone them.

[Updated on: Wed, 05 December 2007 09:11]

Report message to a moderator

Re: AirStrike function [message #301233 is a reply to message #301196] Wed, 05 December 2007 12:40 Go to previous messageGo to next message
The Elite Officer is currently offline  The Elite Officer
Messages: 602
Registered: September 2007
Location: Chapel Hill, North Caroli...
Karma: 0
Colonel
Can this be used in MP ractiece, and if so (or if not) how would I get it to work on my renegade FDS, and lol would it work in demo or SS? Thanks...

The reason Uranus is tilted 90 degrees is because god got angry and kicked it over.....
Re: AirStrike function [message #301308 is a reply to message #301136] Wed, 05 December 2007 16:52 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
Quote:

Jet_3.txt


There is a wrong "Nod_Jetr"


Bückstabü!
Re: AirStrike function [message #301315 is a reply to message #301308] Wed, 05 December 2007 17:10 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)
The Elite Officer wrote on Wed, 05 December 2007 14:40

Can this be used in MP ractiece, and if so (or if not) how would I get it to work on my renegade FDS, and lol would it work in demo or SS? Thanks...


It might working in multiplayer practice if you mod your client scripts.dll to include this. I haven't tried doing that. But I guess it could be possible to have all the features of SSGM in your single player mission and mulptiplay practice.

I have no idea if it would work in the demop, I don;t know how much things differ. Tjere might be addresses and stuff that have changed that the rest of SSGM relies on. Show the code to the people who are making that demo server regulator thing, they might have a better clue.


cAmpa wrote on Wed, 05 December 2007 18:52

Quote:

Jet_3.txt


There is a wrong "Nod_Jetr"


Thanks man Smile



Re: AirStrike function [message #301319 is a reply to message #301136] Wed, 05 December 2007 17:29 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3555
Registered: February 2003
Karma: 0
General (3 Stars)

None of the scripts.dll code is compatible with the demo version of renegade.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: AirStrike function [message #301321 is a reply to message #301136] Wed, 05 December 2007 17:47 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
mhmm, after the attack, all the a10 and jets are looping and looping and looping.

I think u forgot to kill the objects after attack?


Bückstabü!
Re: AirStrike function [message #301324 is a reply to message #301321] Wed, 05 December 2007 17:58 Go to previous messageGo to next message
raven
Messages: 595
Registered: January 2007
Location: Toronto, Ontario
Karma: 0
Colonel
cAmpa wrote on Wed, 05 December 2007 18:47

mhmm, after the attack, all the a10 and jets are looping and looping and looping.

I think u forgot to kill the objects after attack?



I found the same thing..

and as a result of this the team in which the vehicles belong to are at their vehicle limit..lol


-Jelly Administrator
-Exodus Administrator
Re: AirStrike function [message #301327 is a reply to message #301136] Wed, 05 December 2007 18:23 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)
read you buggers Razz

Quote:


I set the a10 and lear jet to un-teamed via the objects.gm file because they count towards the vehichle limit otherwise. There are other ways of getting around that, but this seemed easiest.
I think I remember a slight issue with it with regards to the cinematics looping after being called. I'm sure that's just changing a 1 to a 0 in the text file somewhere after the animation.




Re: AirStrike function [message #301328 is a reply to message #301136] Wed, 05 December 2007 18:26 Go to previous messageGo to previous message
raven
Messages: 595
Registered: January 2007
Location: Toronto, Ontario
Karma: 0
Colonel
LOL, completely missed that Very Happy

Thanks Reborn!


-Jelly Administrator
-Exodus Administrator
Previous Topic: [skin]Codename Havoc - hotwire replacement
Next Topic: [script]Parachute function
Goto Forum:
  


Current Time: Thu Mar 28 03:52:28 MST 2024

Total time taken to generate the page: 0.01921 seconds