Home » Renegade Discussions » Mod Forum » ion storm effect function
ion storm effect function [message #300900] |
Tue, 04 December 2007 04:06 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
I created a function that looks like an ion storm to clients.
To fully appreciate it the client needs to have bhs.dll, as I make use of the fog. But it still looks pretty cool without the fog to be honest.
I was going to put this into an AOW mod I was working on, I still might in time, but I really need to take care of some things first.
Here's a link to a movie of it (don't worry about the end credits and such, I couldn't be bothered to re-make the movie).
http://www.mp-gaming.com/reborn/movies/ion_storm.wmv
Here is how I coded the function:
//GDI version
void reb_GDI_ion_storm::Created(GameObject *obj) {
// And he said "let there be weather!"
Commands->Set_Rain(10.0f,3.5f,true);
Commands->Set_Fog_Enable(1);
Commands->Set_Fog_Range (0.5,55,3.5f);
Commands->Set_Wind(0.7f,2.0f,1.0f,3.5f);
char ionstormmsg[128];
char ionstormmsg2[128];
Commands->Create_2D_WAV_Sound("m00evag_dsgn0069i1evag_snd.wav");
sprintf(ionstormmsg,"msg Warning!!!");
Console_Input(ionstormmsg);
sprintf(ionstormmsg2,"msg Ion Storm approaching...");
Console_Input(ionstormmsg2);
Commands->Start_Timer(obj,this,3.0f,1);
Commands->Start_Timer(obj,this,4.0f,2);
Commands->Start_Timer(obj,this,4.7f,3);
Commands->Start_Timer(obj,this,14.7f,4);
Commands->Start_Timer(obj,this,15.7f,5);
Commands->Start_Timer(obj,this,16.7f,6);
Commands->Start_Timer(obj,this,17.7f,7);
Commands->Start_Timer(obj,this,18.7f,8);
Commands->Start_Timer(obj,this,19.7f,9);
Commands->Start_Timer(obj,this,20.4f,10);
Commands->Start_Timer(obj,this,21.4f,11);
Commands->Start_Timer(obj,this,22.0f,12);
Commands->Start_Timer(obj,this,23.0f,13);
Commands->Start_Timer(obj,this,23.6f,14);
Commands->Start_Timer(obj,this,24.2f,15);
Commands->Start_Timer(obj,this,24.8f,16);
Commands->Start_Timer(obj,this,25.4f,17);
Commands->Start_Timer(obj,this,26.6f,18);
Commands->Start_Timer(obj,this,27.2f,19);
Commands->Start_Timer(obj,this,28.2f,20);
Commands->Start_Timer(obj,this,28.8f,21);
Commands->Start_Timer(obj,this,29.6f,22);
Commands->Start_Timer(obj,this,30.2f,23);
Commands->Start_Timer(obj,this,31.2f,24);
Commands->Start_Timer(obj,this,42.2f,25);
}
void reb_GDI_ion_storm::Timer_Expired(GameObject *obj, int number) {
char ionstormmsg[128];
if(number == 1){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0097i1evag_snd.wav");
}
if(number == 2){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0076i1evag_snd.wav");
}
if(number == 3){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0098i1evag_snd.wav");
}
/////////////////////////////////////
// numer count down 5,4,3,2,1
/////////////////////////////////////
if(number == 4){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0082i1evag_snd.wav");
sprintf(ionstormmsg,"msg 5");
Console_Input(ionstormmsg);
}
if(number == 5){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0083i1evag_snd.wav");
sprintf(ionstormmsg,"msg 4");
Console_Input(ionstormmsg);
}
if(number == 6){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0084i1evag_snd.wav");
sprintf(ionstormmsg,"msg 3");
Console_Input(ionstormmsg);
}
if(number == 7){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0085i1evag_snd.wav");
sprintf(ionstormmsg,"msg 2");
Console_Input(ionstormmsg);
}
if(number == 8){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0086i1evag_snd.wav");
sprintf(ionstormmsg,"msg 1");
Console_Input(ionstormmsg);
}
////////////////////////////////
// actual storm starts here
////////////////////////////////
if(number == 9){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(1));
position.Y += 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 10){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(1));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 11){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(1));
position.X += 15.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 12){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(1));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float refhealth = Commands->Get_Health(Find_Refinery(1));
Commands->Set_Health((Find_Refinery(1)),(refhealth/1.3f));
}
if(number == 13){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(1));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 14){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(1));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 15){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(1));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float agthealth = Commands->Get_Health(Find_Base_Defense(1));
Commands->Set_Health((Find_Base_Defense(1)),(agthealth/1.4f));
}
if(number == 16){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(1));
position.X += 10.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 17){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(1));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float barhealth = Commands->Get_Health(Find_Soldier_Factory(1));
Commands->Set_Health((Find_Soldier_Factory(1)),(barhealth/1.35f));
}
if(number == 18){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(1));
position.Y -= 10.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 19){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(1));
position.X += 5.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 20){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(1));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float wepshealth = Commands->Get_Health(Find_War_Factory(1));
Commands->Set_Health((Find_War_Factory(1)),(wepshealth/1.4f));
}
if(number == 21){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(1));
position.X += 10.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 22){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(1));
position.Y += 15.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 23){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(1));
position.X += 5.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 24){
Vector3 position;
position = Commands->Get_Position(Find_Power_Plant(1));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float pphealth = Commands->Get_Health(Find_Power_Plant(1));
Commands->Set_Health((Find_Power_Plant(1)),(pphealth/1.3f));
//////////////////////////////////
/// turn the weather off
///////////////////////////////////
Commands->Set_Fog_Range (0.5f,350.0f,12.0f);
Commands->Set_Rain(0.0f,10.0f,true);
Commands->Set_Wind(0.0f,0.0f,0.0f,3.5f);
}
if(number == 25){
Commands->Set_Fog_Enable(0);
sprintf(ionstormmsg,"msg The ion-storm has sub-sided.");
Console_Input(ionstormmsg);
}
}
//Nod version
void reb_Nod_ion_storm::Created(GameObject *obj) {
// And he said "let there be weather!"
Commands->Set_Rain(10.0f,3.5f,true);
Commands->Set_Fog_Enable(1);
Commands->Set_Fog_Range (0.5,55,3.5f);
Commands->Set_Wind(0.7f,2.0f,1.0f,3.5f);
char ionstormmsg[128];
char ionstormmsg2[128];
Commands->Create_2D_WAV_Sound("m00evag_dsgn0069i1evag_snd.wav");
sprintf(ionstormmsg,"msg Warning!!!");
Console_Input(ionstormmsg);
sprintf(ionstormmsg2,"msg Ion Storm approaching...");
Console_Input(ionstormmsg2);
Commands->Start_Timer(obj,this,3.0f,1);
Commands->Start_Timer(obj,this,4.0f,2);
Commands->Start_Timer(obj,this,4.7f,3);
Commands->Start_Timer(obj,this,14.7f,4);
Commands->Start_Timer(obj,this,15.7f,5);
Commands->Start_Timer(obj,this,16.7f,6);
Commands->Start_Timer(obj,this,17.7f,7);
Commands->Start_Timer(obj,this,18.7f,8);
Commands->Start_Timer(obj,this,19.7f,9);
Commands->Start_Timer(obj,this,20.4f,10);
Commands->Start_Timer(obj,this,21.4f,11);
Commands->Start_Timer(obj,this,22.0f,12);
Commands->Start_Timer(obj,this,23.0f,13);
Commands->Start_Timer(obj,this,23.6f,14);
Commands->Start_Timer(obj,this,24.2f,15);
Commands->Start_Timer(obj,this,24.8f,16);
Commands->Start_Timer(obj,this,25.4f,17);
Commands->Start_Timer(obj,this,26.6f,18);
Commands->Start_Timer(obj,this,27.2f,19);
Commands->Start_Timer(obj,this,28.2f,20);
Commands->Start_Timer(obj,this,28.8f,21);
Commands->Start_Timer(obj,this,29.6f,22);
Commands->Start_Timer(obj,this,30.2f,23);
Commands->Start_Timer(obj,this,31.2f,24);
Commands->Start_Timer(obj,this,42.2f,25);
}
void reb_Nod_ion_storm::Timer_Expired(GameObject *obj, int number) {
char ionstormmsg[128];
if(number == 1){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0097i1evag_snd.wav");
}
if(number == 2){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0076i1evag_snd.wav");
}
if(number == 3){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0098i1evag_snd.wav");
}
/////////////////////////////////////
// numer count down 5,4,3,2,1
/////////////////////////////////////
if(number == 4){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0082i1evag_snd.wav");
sprintf(ionstormmsg,"msg 5");
Console_Input(ionstormmsg);
}
if(number == 5){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0083i1evag_snd.wav");
sprintf(ionstormmsg,"msg 4");
Console_Input(ionstormmsg);
}
if(number == 6){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0084i1evag_snd.wav");
sprintf(ionstormmsg,"msg 3");
Console_Input(ionstormmsg);
}
if(number == 7){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0085i1evag_snd.wav");
sprintf(ionstormmsg,"msg 2");
Console_Input(ionstormmsg);
}
if(number == 8){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0086i1evag_snd.wav");
sprintf(ionstormmsg,"msg 1");
Console_Input(ionstormmsg);
}
////////////////////////////////
// actual storm starts here
////////////////////////////////
if(number == 9){
Vector3 position;
position = Commands->Get_Position(Find_Airstrip(0));
position.Y += 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 10){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(0));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 11){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(0));
position.X += 15.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 12){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(0));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float refhealth = Commands->Get_Health(Find_Refinery(0));
Commands->Set_Health((Find_Refinery(0)),(refhealth/1.3f));
}
if(number == 13){
Vector3 position;
position = Commands->Get_Position(Find_Airstrip(0));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 14){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(0));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 15){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(0));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float obhealth = Commands->Get_Health(Find_Base_Defense(0));
Commands->Set_Health((Find_Base_Defense(0)),(obhealth/1.4f));
}
if(number == 16){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(0));
position.X += 10.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 17){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(0));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float handhealth = Commands->Get_Health(Find_Soldier_Factory(0));
Commands->Set_Health((Find_Soldier_Factory(0)),(handhealth/1.35f));
}
if(number == 18){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(0));
position.Y -= 10.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 19){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(0));
position.X += 5.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 20){
Vector3 position;
position = Commands->Get_Position(Find_Airstrip(0));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float striphealth = Commands->Get_Health(Find_Airstrip(0));
Commands->Set_Health((Find_Airstrip(0)),(striphealth/1.4f));
}
if(number == 21){
Vector3 position;
position = Commands->Get_Position(Find_Airstrip(0));
position.X += 10.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 22){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(0));
position.Y += 15.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 23){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(0));
position.X += 5.0f;
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
}
if(number == 24){
Vector3 position;
position = Commands->Get_Position(Find_Power_Plant(0));
Commands->Create_2D_WAV_Sound("ion_fire.wav");
Commands->Create_Explosion("Explosion_Mine_Remote_01",position,obj);
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float pphealth = Commands->Get_Health(Find_Power_Plant(0));
Commands->Set_Health((Find_Power_Plant(0)),(pphealth/1.3f));
//////////////////////////////////
/// turn the weather off
///////////////////////////////////
Commands->Set_Fog_Range (0.5f,350.0f,12.0f);
Commands->Set_Rain(0.0f,10.0f,true);
Commands->Set_Wind(0.0f,0.0f,0.0f,3.5f);
}
if(number == 25){
Commands->Set_Fog_Enable(0);
sprintf(ionstormmsg,"msg The ion-storm has sub-sided.");
Console_Input(ionstormmsg);
}
}
ScriptRegistrant<reb_GDI_ion_storm> reb_GDI_ion_storm_Registrant("reb_GDI_ion_storm","");
ScriptRegistrant<reb_Nod_ion_storm> reb_Nod_ion_storm_Registrant("reb_Nod_ion_storm","");
class reb_GDI_ion_storm : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
};
class reb_Nod_ion_storm : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
};
For testing I called these functions by a chat hook. Obviously you're going to want to call the functions some other way, perhaps a crate, a random weather effect or some other way.
But here is my chat hook for it anyway.
class GDIionstormChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Commands->Attach_Script(obj,"reb_GDI_ion_storm","");
}
};
ChatCommandRegistrant<GDIionstormChatCommand> GDIionstormChatCommandReg("!iong",CHATTYPE_TEAM,0,GAMEMODE_AOW);
class NodionstormChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Commands->Attach_Script(obj,"reb_Nod_ion_storm","");
}
};
ChatCommandRegistrant<NodionstormChatCommand> NodionstormChatCommandReg("!ionn",CHATTYPE_TEAM,0,GAMEMODE_AOW);
|
|
|
Goto Forum:
Current Time: Sat Dec 28 07:58:06 MST 2024
Total time taken to generate the page: 0.00955 seconds
|