Home » Renegade Discussions » Mod Release Forum » [script]EMP effect function
[script]EMP effect function [message #309915] |
Fri, 11 January 2008 14:31 ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/22789.jpg) |
wittebolx
Messages: 332 Registered: May 2007 Location: the netherlands
Karma: 0
|
Recruit |
|
|
Have Fun ![Wink](images/smiley_icons/icon_wink.gif)
//EMP storm that attacks both Nod and GDI
void reb_Electromagnetic_pulse::Created(GameObject *obj) {
Commands->Set_Rain(10.0f,3.5f,true);
Commands->Set_Wind(0.7f,2.0f,1.0f,3.5f);
char empstormmsg[128];
char empstormmsg2[128];
Commands->Create_2D_WAV_Sound("m00evag_dsgn0069i1evag_snd.wav");
sprintf(empstormmsg,"msg Warning!!!");
Console_Input(empstormmsg);
sprintf(empstormmsg2,"msg Electromagnetic Pulse approaching...");
Console_Input(empstormmsg2);
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);
Commands->Start_Timer(obj,this,43.0f,26);
Commands->Start_Timer(obj,this,44.0f,27);
Commands->Start_Timer(obj,this,46.7f,28);
Commands->Start_Timer(obj,this,47.7f,29);
Commands->Start_Timer(obj,this,49.7f,30);
Commands->Start_Timer(obj,this,50.7f,31);
Commands->Start_Timer(obj,this,51.7f,32);
Commands->Start_Timer(obj,this,53.7f,33);
Commands->Start_Timer(obj,this,56.7f,34);
Commands->Start_Timer(obj,this,57.4f,35);
Commands->Start_Timer(obj,this,58.4f,36);
Commands->Start_Timer(obj,this,59.0f,37);
Commands->Start_Timer(obj,this,60.0f,38);
Commands->Start_Timer(obj,this,66.6f,39);
Commands->Start_Timer(obj,this,72.2f,40);
Commands->Start_Timer(obj,this,73.8f,41);
Commands->Start_Timer(obj,this,74.4f,42);
Commands->Start_Timer(obj,this,75.6f,43);
Commands->Start_Timer(obj,this,79.2f,44);
Commands->Start_Timer(obj,this,85.2f,45);
Commands->Start_Timer(obj,this,86.8f,46);
Commands->Start_Timer(obj,this,87.6f,47);
Commands->Start_Timer(obj,this,88.2f,48);
Commands->Start_Timer(obj,this,89.2f,49);
Commands->Start_Timer(obj,this,90.2f,50);
}
void reb_Electromagnetic_pulse::Timer_Expired(GameObject *obj, int number) {
char empstormmsg[128];
if(number == 1){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0097i1evag_snd.wav");
}
if(number == 2){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0073i1evag_snd.wav");
}
if(number == 3){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0098i1evag_snd.wav");
}
/////////////////////////////////////
// numer count down 30,25,20,15,10,9,8,7,6,5,4,3,2,1
/////////////////////////////////////
if(number == 4){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0073i1evag_snd.wav");
sprintf(empstormmsg,"msg 30");
Console_Input(empstormmsg);
}
if(number == 5){
sprintf(empstormmsg,"msg 29");
Console_Input(empstormmsg);
}
if(number == 6){
sprintf(empstormmsg,"msg 28");
Console_Input(empstormmsg);
}
if(number == 7){
sprintf(empstormmsg,"msg 27");
Console_Input(empstormmsg);
}
if(number == 8){
sprintf(empstormmsg,"msg 26");
Console_Input(empstormmsg);
}
if(number == 9){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0074i1evag_snd.wav");
sprintf(empstormmsg,"msg 25");
Console_Input(empstormmsg);
}
if(number == 10){
sprintf(empstormmsg,"msg 24");
Console_Input(empstormmsg);
}
if(number == 11){
sprintf(empstormmsg,"msg 23");
Console_Input(empstormmsg);
}
if(number == 12){
sprintf(empstormmsg,"msg 22");
Console_Input(empstormmsg);
}
if(number == 13){
sprintf(empstormmsg,"msg 21");
Console_Input(empstormmsg);
}
if(number == 14){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0075i1evag_snd.wav");
sprintf(empstormmsg,"msg 20");
Console_Input(empstormmsg);
}
if(number == 15){
sprintf(empstormmsg,"msg 19");
Console_Input(empstormmsg);
}
if(number == 16){
sprintf(empstormmsg,"msg 18");
Console_Input(empstormmsg);
}
if(number == 17){
sprintf(empstormmsg,"msg 17");
Console_Input(empstormmsg);
}
if(number == 18){
sprintf(empstormmsg,"msg 16");
Console_Input(empstormmsg);
}
if(number == 19){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0076i1evag_snd.wav");
sprintf(empstormmsg,"msg 15");
Console_Input(empstormmsg);
}
if(number == 20){
sprintf(empstormmsg,"msg 14");
Console_Input(empstormmsg);
}
if(number == 21){
sprintf(empstormmsg,"msg 13");
Console_Input(empstormmsg);
}
if(number == 22){
sprintf(empstormmsg,"msg 12");
Console_Input(empstormmsg);
}
if(number == 23){
sprintf(empstormmsg,"msg 11");
Console_Input(empstormmsg);
}
if(number == 24){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0077i1evag_snd.wav");
sprintf(empstormmsg,"msg 10");
Console_Input(empstormmsg);
}
if(number == 25){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0078i1evag_snd.wav");
sprintf(empstormmsg,"msg 9");
Console_Input(empstormmsg);
}
if(number == 26){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0079i1evag_snd.wav");
sprintf(empstormmsg,"msg 8");
Console_Input(empstormmsg);
}
if(number == 27){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0080i1evag_snd.wav");
sprintf(empstormmsg,"msg 7");
Console_Input(empstormmsg);
}
if(number == 28){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0081i1evag_snd.wav");
sprintf(empstormmsg,"msg 6");
Console_Input(empstormmsg);
}
if(number == 29){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0082i1evag_snd.wav");
sprintf(empstormmsg,"msg 5");
Console_Input(empstormmsg);
}
if(number == 30){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0083i1evag_snd.wav");
sprintf(empstormmsg,"msg 4");
Console_Input(empstormmsg);
}
if(number == 31){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0084i1evag_snd.wav");
sprintf(empstormmsg,"msg 3");
Console_Input(empstormmsg);
}
if(number == 32){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0085i1evag_snd.wav");
sprintf(empstormmsg,"msg 2");
Console_Input(empstormmsg);
}
if(number == 33){
Commands->Create_2D_WAV_Sound("m00evag_dsgn0086i1evag_snd.wav");
sprintf(empstormmsg,"msg 1");
Console_Input(empstormmsg);
}
////////////////////////////////
// actual EMP starts here
////////////////////////////////
if(number == 34){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));
position.Y += 20.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 35){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 36){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(2));
position.X += 15.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 37){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float refhealth = Commands->Get_Health(Find_Refinery(2));
Commands->Set_Health((Find_Refinery(2)),(refhealth/1.3f));
}
if(number == 38){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 39){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(2));
position.Y -= 20.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 40){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float agthealth = Commands->Get_Health(Find_Base_Defense(2));
Commands->Set_Health((Find_Base_Defense(2)),(agthealth/1.4f));
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 41){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));
position.X += 10.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 42){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(2));
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float barhealth = Commands->Get_Health(Find_Soldier_Factory(2));
Commands->Set_Health((Find_Soldier_Factory(2)),(barhealth/1.35f));
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 43){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));
position.Y -= 10.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 44){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));
position.X += 5.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 45){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float wepshealth = Commands->Get_Health(Find_War_Factory(2));
Commands->Set_Health((Find_War_Factory(2)),(wepshealth/1.4f));
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 46){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));
position.X += 10.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 47){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));
position.Y += 15.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 48){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));
position.X += 5.0f;
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
if (Commands->Get_Distance(Commands->Get_Position(o),position) < 100) {
Attach_Script_Once(o,"EMP_Effect","");
}
}
x = x->NodeNext;
}
}
if(number == 49){
Vector3 position;
position = Commands->Get_Position(Find_Power_Plant(2));
Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
float pphealth = Commands->Get_Health(Find_Power_Plant(2));
Commands->Set_Health((Find_Power_Plant(2)),(pphealth/1.3f));
//////////////////////////////////
/// turn the weather off
///////////////////////////////////
Commands->Set_Rain(0.0f,10.0f,true);
Commands->Set_Wind(0.0f,0.0f,0.0f,3.5f);
}
if(number == 50){
Commands->Set_Fog_Enable(0);
sprintf(empstormmsg,"msg The Electromagnetic Pulse has sub-sided.");
Console_Input(empstormmsg);
}
}
void EMP_Effect::Created(GameObject *obj) {
Force_Occupants_Exit(obj);
Commands->Enable_Vehicle_Transitions(obj,false);
Commands->Start_Timer(obj,this,30,1);
}
void EMP_Effect::Timer_Expired(GameObject *obj,int number) {
if (number == 1) {
Commands->Enable_Vehicle_Transitions(obj,true);
Destroy_Script();
}
}
ScriptRegistrant<reb_Electromagnetic_pulse> reb_Electromagnetic_pulse_Registrant("reb_Electromagnetic_pulse","");
ScriptRegistrant<EMP_Effect> EMP_Effect_Registrant("EMP_Effect","");
class reb_Electromagnetic_pulse : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
};
class EMP_Effect : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
};
and a chat hook for testing:
class ElectromagneticpulseChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
Commands->Attach_Script(obj,"reb_Electromagnetic_pulse","");
}
};
ChatCommandRegistrant<ElectromagneticpulseChatCommand> ElectromagneticpulseChatCommandReg("!emp",CHATTYPE_TEAM,0,GAMEMODE_AOW);
this script is based on Reborn's IonStorm script and Hex's EMP Crate script.
http://www.wittebolx.com
[Updated on: Fri, 30 January 2009 14:24] by Moderator Report message to a moderator
|
|
|
|
|
Re: EMP effect function [message #309983 is a reply to message #309968] |
Fri, 11 January 2008 17:45 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Genesis2001
Messages: 1397 Registered: August 2006
Karma: 0
|
General (1 Star) |
|
|
RoShamBo wrote on Fri, 11 January 2008 17:33 | You should credit Reborn ![Smile](images/smiley_icons/icon_smile.gif)
|
Thanks for reminding me. I meant to say something along those lines as well. And I think you'd need to credit n00bless/Hex for "EMP_Effect" because that's from their Crates Plugin they released. :v
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Aug 17 03:03:22 MST 2024
Total time taken to generate the page: 0.00902 seconds
|