I created a function that calls in paratroopers/reinforcements.
I used a chat hook to call the function, but it could be called in a number of ways in-game.
Here is a link to a short small movie of it working in-game:
http://www.mp-gaming.com/reborn/movies/para.wmv
And here is how I made it work:
void reb_Nod_reinforcements::Created(GameObject *obj) {
Vector3 position = Commands->Get_Position(obj);
GameObject *flare = Commands->Create_Object("Signal_Flares",position);
flareID = Commands->Get_ID(flare);
Commands->Attach_Script(flare,"JFW_Disable_Physical_Collision","");
Commands->Create_2D_WAV_Sound("m00gnod_secx0007r3nors_snd.wav");
Console_Input("msg Nod reinforcements have been called in!");
Console_Input(StrFormat("ppage %d [Mission controll] You have called in reinforcements, friendly soldiers will be arriving at your position soon.",Get_Player_ID(obj)).c_str());
Commands->Start_Timer(obj,this,3.0f,1);
Commands->Start_Timer(obj,this,6.0f,2);
Commands->Start_Timer(obj,this,9.0f,3);
}
void reb_Nod_reinforcements::Timer_Expired(GameObject *obj, int number) {
GameObject *flare = Commands->Find_Object(flareID);
if(number == 1){
Commands->Create_2D_WAV_Sound("m00gnod_kill0020a3nors_snd.wav");
Commands->Attach_Script(flare,"Test_Cinematic","Nod_Paratroopers.txt");
}
if(number == 2){
Console_Input("msg Nod reinforcements are arriving!");
}
if(number == 3){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0009i1evag_snd.wav");
}
}
void reb_GDI_reinforcements::Created(GameObject *obj) {
Vector3 position = Commands->Get_Position(obj);
GameObject *flare = Commands->Create_Object("Signal_Flares",position);
flareID = Commands->Get_ID(flare);
Commands->Attach_Script(flare,"JFW_Disable_Physical_Collision","");
Commands->Create_2D_WAV_Sound("m00gnod_secx0007r3nors_snd.wav");
Console_Input("msg GDI reinforcements have been called in!");
Console_Input(StrFormat("ppage %d [Mission controll] You have called in reinforcements, friendly soldiers will be arriving at your position soon.",Get_Player_ID(obj)).c_str());
Commands->Start_Timer(obj,this,3.0f,1);
Commands->Start_Timer(obj,this,6.0f,2);
Commands->Start_Timer(obj,this,9.0f,3);
}
void reb_GDI_reinforcements::Timer_Expired(GameObject *obj, int number) {
GameObject *flare = Commands->Find_Object(flareID);
if(number == 1){
Commands->Create_2D_WAV_Sound("m00gnod_kill0020a3nors_snd.wav");
Commands->Attach_Script(flare,"Test_Cinematic","GDI_Paratroopers.txt");
}
if(number == 2){
Console_Input("msg GDI reinforcements are arriving!");
}
if(number == 3){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0009i1evag_snd.wav");
}
}
ScriptRegistrant<reb_Nod_reinforcements> reb_Nod_reinforcements_Registrant("reb_Nod_reinforcements","");
ScriptRegistrant<reb_GDI_reinforcements> reb_GDI_reinforcements_Registrant("reb_GDI_reinforcements","");
class reb_Nod_reinforcements : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
int flareID;
};
class reb_GDI_reinforcements : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
int flareID;
};
The real work is done by the cinematic file that test_cinematic makes use of.
The cinematic files look like this:
Nod version
;_________________________________________
;
; 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 11: C130 Nod Troop Parachute drop ************************
; ****************************** Nod Chinook
-1 Create_Real_Object, 1, "Nod_Cargo_Plane"
-1 Play_Animation, 1, "v_Nod_cplane.v_Nod_cplane", 1
-1 Play_Animation, 1, "v_Nod_cplane.X5D_C130Anim", 1
-1 Attach_To_Bone, 1, 2, "BN_chinook_1"
-280 Destroy_Object, 1
; ****************************** Path
-1 Create_Object, 2, "X5D_Chinookfly", 0, 0, 0, 0
-1 Play_Animation, 2, "X5D_Chinookfly.X5D_Chinookfly", 1
-280 Destroy_Object, 2
-1 Attach_To_Bone, 1, 2, "BN_chinook_1"
; ****************************** Parachute_1
-169 Create_Object, 3, "X5D_Parachute", 0, 0, 0, 0
-169 Play_Animation, 3, "X5D_Parachute.X5D_ParaC_1", 1
-260 Destroy_Object, 3
; ****************************** Parachute_2
-179 Create_Object, 4, "X5D_Parachute", 0, 0, 0, 0
-179 Play_Animation, 4, "X5D_Parachute.X5D_ParaC_2", 1
-270 Destroy_Object, 4
; ****************************** Parachute_3
-198 Create_Object, 5, "X5D_Parachute", 0, 0, 0, 0
-198 Play_Animation, 5, "X5D_Parachute.X5D_ParaC_3", 1
-280 Destroy_Object, 5
; ****************************** Box 1
-145 Create_Object, 6, "X5D_Box01", 0, 0, 0, 0
-145 Play_Animation, 6, "X5D_Box01.X5D_Box01", 1
-260 Destroy_Object, 6
; ****************************** Box 2
-155 Create_Object, 7, "X5D_Box02", 0, 0, 0, 0
-155 Play_Animation, 7, "X5D_Box02.X5D_Box02", 1
-270 Destroy_Object, 7
; ****************************** Box 3
-165 Create_Object, 8, "X5D_Box03", 0, 0, 0, 0
-165 Play_Animation, 8, "X5D_Box03.X5D_Box03", 1
-280 Destroy_Object, 8
;******************************* Soldiers
-145 Create_Real_Object, 9, "Nod_Minigunner_3Boss_alt", 6, "Box01"
-145 Attach_Script, 9, "M11_C130_Dropoff_Dude_JDG", ""
;-145 Attach_Script, 9, "M01_Hunt_The_Player_JDG", ""
-145 Attach_Script, 9, "M00_No_Falling_Damage_DME", ""
-145 Attach_To_Bone, 9, 6, "Box01"
-145 Play_Animation, 9, "H_A_X5D_ParaT_1", 0
-255 Attach_To_Bone, 9, -1, "Box01"
;-280 Attach_Script, 9, "M01_Hunt_The_Player_JDG", ""
-155 Create_Real_Object, 10, "Nod_RocketSoldier_3Boss", 7, "Box02"
-155 Attach_Script, 10, "M11_C130_Dropoff_Dude_JDG", ""
;-155 Attach_Script, 10, "M01_Hunt_The_Player_JDG", ""
-155 Attach_Script, 10, "M00_No_Falling_Damage_DME", ""
-155 Attach_To_Bone, 10, 7, "Box02"
-155 Play_Animation, 10, "H_A_X5D_ParaT_2", 0
-265 Attach_To_Bone, 10, -1, "Box02"
;-280 Attach_Script, 10, "M01_Hunt_The_Player_JDG", ""
-165 Create_Real_Object, 11, "Nod_RocketSoldier_3Boss", 8, "Box03"
-165 Attach_Script, 11, "M11_C130_Dropoff_Dude_JDG", ""
;-165 Attach_Script, 11, "M01_Hunt_The_Player_JDG", ""
-165 Attach_Script, 11, "M00_No_Falling_Damage_DME", ""
-165 Attach_To_Bone, 11, 8, "Box03"
-165 Play_Animation, 11, "H_A_X5D_ParaT_3", 0
-275 Attach_To_Bone, 11, -1, "Box03"
;-280 Attach_Script, 11, "M01_Hunt_The_Player_JDG", ""
GDI version
;_________________________________________
;
; 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 11: C130 Nod Troop Parachute drop ************************
; ****************************** Nod Chinook
-1 Create_Real_Object, 1, "GDI_Transport_Helicopter_Flyover"
-1 Play_Animation, 1, "v_Nod_cplane.v_Nod_cplane", 1
-1 Play_Animation, 1, "v_Nod_cplane.X5D_C130Anim", 1
-1 Attach_To_Bone, 1, 2, "BN_chinook_1"
-280 Destroy_Object, 1
; ****************************** Path
-1 Create_Object, 2, "X5D_Chinookfly", 0, 0, 0, 0
-1 Play_Animation, 2, "X5D_Chinookfly.X5D_Chinookfly", 1
-280 Destroy_Object, 2
-1 Attach_To_Bone, 1, 2, "BN_chinook_1"
; ****************************** Parachute_1
-169 Create_Object, 3, "X5D_Parachute", 0, 0, 0, 0
-169 Play_Animation, 3, "X5D_Parachute.X5D_ParaC_1", 1
-260 Destroy_Object, 3
; ****************************** Parachute_2
-179 Create_Object, 4, "X5D_Parachute", 0, 0, 0, 0
-179 Play_Animation, 4, "X5D_Parachute.X5D_ParaC_2", 1
-270 Destroy_Object, 4
; ****************************** Parachute_3
-198 Create_Object, 5, "X5D_Parachute", 0, 0, 0, 0
-198 Play_Animation, 5, "X5D_Parachute.X5D_ParaC_3", 1
-280 Destroy_Object, 5
; ****************************** Box 1
-145 Create_Object, 6, "X5D_Box01", 0, 0, 0, 0
-145 Play_Animation, 6, "X5D_Box01.X5D_Box01", 1
-260 Destroy_Object, 6
; ****************************** Box 2
-155 Create_Object, 7, "X5D_Box02", 0, 0, 0, 0
-155 Play_Animation, 7, "X5D_Box02.X5D_Box02", 1
-270 Destroy_Object, 7
; ****************************** Box 3
-165 Create_Object, 8, "X5D_Box03", 0, 0, 0, 0
-165 Play_Animation, 8, "X5D_Box03.X5D_Box03", 1
-280 Destroy_Object, 8
;******************************* Soldiers
-145 Create_Real_Object, 9, "GDI_Ignatio_Mobius", 6, "Box01"
-145 Attach_Script, 9, "M11_C130_Dropoff_Dude_JDG", ""
;-145 Attach_Script, 9, "M01_Hunt_The_Player_JDG", ""
-145 Attach_Script, 9, "M00_No_Falling_Damage_DME", ""
-145 Attach_To_Bone, 9, 6, "Box01"
-145 Play_Animation, 9, "H_A_X5D_ParaT_1", 0
-255 Attach_To_Bone, 9, -1, "Box01"
;-280 Attach_Script, 9, "M01_Hunt_The_Player_JDG", ""
-155 Create_Real_Object, 10, "GDI_MiniGunner_3Boss", 7, "Box02"
-155 Attach_Script, 10, "M11_C130_Dropoff_Dude_JDG", ""
;-155 Attach_Script, 10, "M01_Hunt_The_Player_JDG", ""
-155 Attach_Script, 10, "M00_No_Falling_Damage_DME", ""
-155 Attach_To_Bone, 10, 7, "Box02"
-155 Play_Animation, 10, "H_A_X5D_ParaT_2", 0
-265 Attach_To_Bone, 10, -1, "Box02"
;-280 Attach_Script, 10, "M01_Hunt_The_Player_JDG", ""
-165 Create_Real_Object, 11, "GDI_RocketSoldier_3Boss", 8, "Box03"
-165 Attach_Script, 11, "M11_C130_Dropoff_Dude_JDG", ""
;-165 Attach_Script, 11, "M01_Hunt_The_Player_JDG", ""
-165 Attach_Script, 11, "M00_No_Falling_Damage_DME", ""
-165 Attach_To_Bone, 11, 8, "Box03"
-165 Play_Animation, 11, "H_A_X5D_ParaT_3", 0
-275 Attach_To_Bone, 11, -1, "Box03"
;-280 Attach_Script, 11, "M01_Hunt_The_Player_JDG", ""
Whilst this function is used to make a reinforcement mod, you could easily adapt it so you can call any other cinematic file.
Here is the chat hook I used to test the mod in-game:
class NodreChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Commands->Attach_Script(obj,"reb_Nod_reinforcements","");
}
};
ChatCommandRegistrant<NodreChatCommand> NodreChatCommandReg("!nodre",CHATTYPE_TEAM,0,GAMEMODE_AOW);
class GDIreChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Commands->Attach_Script(obj,"reb_GDI_reinforcements","");
}
};
ChatCommandRegistrant<GDIreChatCommand> GDIreChatCommandReg("!gdire",CHATTYPE_TEAM,0,GAMEMODE_AOW);
[Updated on: Fri, 30 January 2009 14:43] by Moderator Report message to a moderator
|