inside my .cpp
/////////////////////////
/////////////////////////
//// 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,10.0f,3);
Commands->Start_Timer(obj,this,17.5f,4);
Commands->Start_Timer(obj,this,25.5f,5);
Commands->Start_Timer(obj,this,50.0f,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_bomb.txt");
}
if (number == 4){
Commands->Create_2D_WAV_Sound("mx0_a-10_166.wav");
}
if (number == 5){
Commands->Create_Explosion("Air_Explosion_Death",position,a101);
float buildinghealth = Commands->Get_Health(thebuilding);
Commands->Set_Health(thebuilding,(buildinghealth/2));
Commands->Destroy_Object(a101);
}
if (number == 6)
{
Remove_Script(obj,"reb_GDI_a10_strike");
}
}
/////////////////////////
/////////////////////////
//// 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,10.0f,3);
Commands->Start_Timer(obj,this,23.5f,4);
Commands->Start_Timer(obj,this,25.5f,5);
Commands->Start_Timer(obj,this,50.0f,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_bomb.txt");
}
if(number == 4){
Commands->Create_2D_WAV_Sound("m00itoc_010in_ners_snd.wav");
}
if(number == 5){
Commands->Create_Explosion("Air_Explosion_Death",position,a101);
float buildinghealth = Commands->Get_Health(thebuilding);
Commands->Set_Health(thebuilding,(buildinghealth/2));
}
if (number == 6)
{
Remove_Script(obj,"reb_Nod_Jet_strike");
}
}
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","");
GameObject * 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 0;
}
the .h
/////////////////////////
/////////////////////////
//// GDI A10 strike /////
//// 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;
};
GameObject * Get_Random_Building(int Team);
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"
; ****************************** Primary Destroyed
1000000 Destroy_Object, 11
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"
; ****************************** Primary Destroyed
1000000 Destroy_Object, 11