Guest e34p Posted June 28, 2012 Report Share Posted June 28, 2012 Could anyone help me understand the BMA fire alarm script and explain how to get it working?Kind regardsE34P/********************************************************** BMA Script by Wingman. Kommentiert. **** Die Nutzungsbestimmungen entnehmen sie der Read-Me **** Mündlich oder schriftlich ausgesprochen Verbote **** gelten auch für dieses Script. -Wingman- **********************************************************/// * BMA Script// V 1.1 *Fehlalarm hinzugefügtconst char *ObjName = "Fahrzeug"; // Hier musst du einen Namen eines Objektes auf der Map angeben das neutral auf der Map steht. Es darf von keinem anderen Script betroffen sein und es darf nicht vom User gesteuert werden oder zerstört werden. z.B. eine Flasche oder ein Auto. In dem Namen darf kein BMA drin vorkommen, da es sonst vom script als BMA erkannt wird.int Nachricht = 0; // Hier können sie einstellen ob eine Textnachricht gezeigt werden soll wenn ein BMA auslöst. 0 = Textnachricht. 1 = Keine Nachrichtconst char *TextNachricht = "Automatic Fire Alarm"; // Hier können sie den Text bestimmen der gezeigt werden soll wenn ein BMA auslöstint Audio = 1; // Hier können sie einstellen ob ein Sound abgespielt werden soll wenn ein BMA auslöst. 0 = Sound abspielen. 1 = Sound nicht abspielenconst char *PfadAudio = "mod:Audio/BMA.wav"; // Hier können sie den Soundpfad angeben der abgespielt werden soll wenn ein BMA auslöstint Audio3D = 1; // Hier können sie einstellen ob ein Sound vom BMA (als 3D sound) abgespielt werden soll wenn es auslöst. 0 = 3D Sound abspielen. 1 = 3D Sound nicht abspielenconst char *PfadAudio3D = "mod:Audio/BMA.wav"; // Hier können sie den Soundpfad angeben der vom BMA(als 3D Sound) abgespielt werden soll wenn es auslöstint Licht = 1; // Soll ein Licht aktiviert werden wenn das BMA auslöst. Licht muss als Special Light deklariert sein. 0 = Licht. 1 = Kein Lichtint FehlalarmDichte = 15; // Hier kannst du dichte eines Fehlalarmes einer Brandmeldeanlaga einstellen. Die Chance wird in 1 : ? das eine Anlage auslöst angegeben. Dabei hat jede einzelne Anlage alle 5 Sekunden die Chance von 1 : ?(der Zahl) auszulösen. Empfohlen wird 30. Also desto kleiner die Zahl desto höher die Wahrscheinlichkeit eines Fehlalarms und desto höher die Zahl desto geringer die chance.int EID;object UpdateBMA : CommandScript{UpdateBMA(){ SetIcon("afa"); SetCursor("afa");}bool CheckPossible(GameObject *Caller){ return true;}bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID){ return true;}void PushActions(GameObject *Caller, Actor *Target, int childID){ GameObjectList gol = Game::GetGameObjectsWithPrefix("BMA"); GameObject *go; for (int i = 0; i < gol.GetNumObjects(); i++) { go = *gol.GetObject(i); if (Game::IsBurningObjectInVirtualObject(go->GetName()) && !go->HasCommand("Ausgeloest")) { if (Nachricht == 0) Mission::PlayHint("BMA Ausgelöst!!!"); if (Audio == 1) Audio::PlaySample(PfadAudio); if (Audio3D == 1) { int x; x = Audio::PlaySample3D(PfadAudio3D, go->GetPosition()); } if (Licht == 1) go->EnableSpecialLights(true); go->AssignCommand("Ausgeloest"); } else if ((Math::rand()%FehlalarmDichte) == 1 && !Mission::HasObjective("BMA Ausgelöst")) { if (Nachricht == 0) Mission::PlayHint("BMA Ausgelöst!!!"); if (Audio == 1) Audio::PlaySample(PfadAudio); if (Audio3D == 1) { int x; x = Audio::PlaySample3D(PfadAudio3D, go->GetPosition()); } if (Licht == 1) go->EnableSpecialLights(true); go->AssignCommand("Ausgeloest"); go->AssignCommand("E_Fehlalarm"); EID = Game::ShowEvent("BMA Ausgelöst", go->GetPosition()); Mission::AddObjective("BMA Ausgelöst"); Mission::SetObjectiveAccomplished("BMA Ausgelöst", false); } } if (Mission::HasObjective("BMA Ausgelöst")) { GameObjectList gol = Game::GetGameObjectsWithPrefix("BMA"); GameObject *go; int Zaehler = 0; for (int i = 0; i < gol.GetNumObjects(); i++) { go = *gol.GetObject(i); if (go->HasCommand("E_Fehlalarm")) Zaehler++; if (Zaehler == 0 && (i + 1) == gol.GetNumObjects()) { Game::SetEventFinished(EID, true, 50); Mission::SetObjectiveAccomplished("BMA Ausgelöst", true); Mission::RemoveObjective("BMA Ausgelöst"); } } } GameObjectList gol = Game::GetGameObjects(ObjName); GameObject *go; go = *gol.GetObject(0); go->PushActionWait(ACTION_APPEND, 5.f); go->PushActionExecuteCommand(ACTION_APPEND, "UpdateBMA", Target, 15, false);}};object BMA_Aus : CommandScript{BMA_Aus(){ SetIcon("IconName"); SetCursor("CursorName");}bool CheckPossible(GameObject *Caller){ return true;}bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID){ if (Target->GetType() == ACTOR_OBJECT) { GameObject go(Target); if (!go.HasCommand("Ausgeloest")) return false; } else return false; return true;}void PushActions(GameObject *Caller, Actor *Target, int childID){ GameObject go(Target); Person p(Caller); p.SetCommandable(false); p.PushActionMove(ACTION_NEWLIST, go.GetPosition()); p.PushActionTurnTo(ACTION_APPEND, go.GetPosition()); p.PushActionSwitchAnim(ACTION_APPEND, "treatinjured2"); p.PushActionWait(ACTION_APPEND, 15.f); p.PushActionSwitchAnim(ACTION_APPEND, "idle"); p.PushActionExecuteCommand(ACTION_APPEND, "BMA_Aus2", Target, 0, false);}};object BMA_Aus2 : CommandScript{BMA_Aus2(){ SetIcon("IconName"); SetCursor("CursorName");}bool CheckPossible(GameObject *Caller){ return true;}bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID){ return true;}void PushActions(GameObject *Caller, Actor *Target, int childID){ Person p(Caller); GameObject go(Target); p.SetCommandable(true); if (Game::IsBurningObjectInVirtualObject(go.GetName())) { Mission::PlayHint("Zurückstellen nicht gelungen. Es brennt noch."); return; } else { Mission::PlayHint("BMA erfolgreich zurückgestellt."); if (Licht == 0) go.EnableSpecialLights(false); go.RemoveCommand("Ausgeloest"); go.RemoveCommand("E_Fehlalarm"); }}};object Ausgeloest : CommandScript{Ausgeloest(){ SetGroupID(20);}bool CheckGroupVisibility(GameObject *Caller){ return false;}bool CheckPossible(GameObject *Caller){ return false;}bool CheckTarget(GameObject *Caller, Actor *Target, int childID){ return false;}void PushActions(GameObject *Caller, Actor *Target, int childID){}};object E_Fehlalarm : CommandScript{E_Fehlalarm(){ SetGroupID(20);}bool CheckGroupVisibility(GameObject *Caller){ return false;}bool CheckPossible(GameObject *Caller){ return false;}bool CheckTarget(GameObject *Caller, Actor *Target, int childID){ return false;}void PushActions(GameObject *Caller, Actor *Target, int childID){}}; Link to comment Share on other sites More sharing options...
bma Posted June 29, 2012 Report Share Posted June 29, 2012 Well, read the read me file, and if you dont understand it. then use google translate, i did that and made it work Link to comment Share on other sites More sharing options...
Guest e34p Posted June 29, 2012 Report Share Posted June 29, 2012 It says on the read me that I need to copy bits into the "startup script"What script is that? Link to comment Share on other sites More sharing options...
Miercolini Posted June 29, 2012 Report Share Posted June 29, 2012 Which script is the BMA alarm? Link to comment Share on other sites More sharing options...
FDNYpower Posted June 29, 2012 Report Share Posted June 29, 2012 is this a fire alarm that plays when fire is active in a building or is this somethin else? Link to comment Share on other sites More sharing options...
bma Posted June 29, 2012 Report Share Posted June 29, 2012 It says on the read me that I need to copy bits into the "startup script"What script is that?Download and use this: http://www.emergency-forum.de/index.php?page=DatabaseItem&id=1414You will find the startup script in it. is this a fire alarm that plays when fire is active in a building or is this somethin else?The script registers if there is fire in a marked area, and if there is, then it activates and automatic fire alarm. Besides that it randomly activates some of the alarms from time to time. Pretty cool script Link to comment Share on other sites More sharing options...
Guest e34p Posted June 29, 2012 Report Share Posted June 29, 2012 Ok thanks. Do you need to do anything to make them activate randomly without a fire or does the script just do that four you? You don't need to put anything in the specs files do you? Link to comment Share on other sites More sharing options...
bma Posted June 30, 2012 Report Share Posted June 30, 2012 Ok thanks. Do you need to do anything to make them activate randomly without a fire or does the script just do that four you? You don't need to put anything in the specs files do you?The reason that you need the things in the startup script is because it starts up the script. The script then functions as a loop and checks all the different alarms around the city one at a time to check if there are any fires. Besides that, the script also makes a loop which says that it should create a random number, and if that number is something specific it activates a false alarm Link to comment Share on other sites More sharing options...
Guest e34p Posted July 2, 2012 Report Share Posted July 2, 2012 I'm still struggling to get this script to work. If anyone has any advice it would be great. Link to comment Share on other sites More sharing options...
spencer2087 Posted September 16, 2013 Report Share Posted September 16, 2013 I am struggling as well. I'm attempting to add this script into the LA MOD. I started with adding the VO's and then the corresponding BMA objects. I even remembered the icons. The script is added into the ...script/command folder and the start script is in the script folder. I still can't seem to get an activation. The only thing that I could see wrong would be that I just transferred the BMA script and start script from the new Manhattan Mod (its for my personal use). Does the start script need to change?? I tried going to the link above to download the read me however I can not find a download button. Any help or even small tutorial would be appreciated. It seems like a very simple script however I still can not get it to work.Thanks Link to comment Share on other sites More sharing options...
Miercolini Posted September 17, 2013 Report Share Posted September 17, 2013 I am struggling as well. I'm attempting to add this script into the LA MOD. I started with adding the VO's and then the corresponding BMA objects. I even remembered the icons. The script is added into the ...script/command folder and the start script is in the script folder. I still can't seem to get an activation. The only thing that I could see wrong would be that I just transferred the BMA script and start script from the new Manhattan Mod (its for my personal use). Does the start script need to change?? I tried going to the link above to download the read me however I can not find a download button. Any help or even small tutorial would be appreciated. It seems like a very simple script however I still can not get it to work.ThanksYou need to add this bit to your fp_freeplay.script:GameObjectList gol = Game::GetGameObjects("tree3"); // Hier den Namen, des Objektes das neutral auf der Map steht, siehe 3.GameObject *go;go = *gol.GetObject(0);Game::ExecuteCommand("UpdateBMA", go);Also you need to add a object on the map and name it "tree3" (no quotes) in order to start the script in game, can be a bottle etc, better something that doesn't burn or get destroyed. Also remember to add the audio. Link to comment Share on other sites More sharing options...
spencer2087 Posted September 20, 2013 Report Share Posted September 20, 2013 Thank you for your help! I was missing that one little piece in the fp_freeplay.script. Link to comment Share on other sites More sharing options...
The Loot Posted November 12, 2013 Report Share Posted November 12, 2013 Anyone have an idea on how to get it to loop the alarm sound at the location of the box until reset? This line hasn't been working for me; it plays once and then stops.int x; x = Audio::PlaySample3D(PfadAudio3D, go->GetPosition(), true);Probably need a line to stop the sound when the alarm is reset, but I don't think one is already in the script. Link to comment Share on other sites More sharing options...
Hoppah Posted November 12, 2013 Report Share Posted November 12, 2013 BMA is German for Brandmeldeanlage or simply 'fire alarm system'. The script is run in the background by a dummy object. To initiate this, you will need to edit the freeplay startup script (fp_freeplay.script / fp_challenge.script). That script locates the dummy object and initiates the fire alarm system script. What the script itself does, I'm not sure, but I'm guessing it adds a new event/objective with false and true fire alarms.The bunch of text at the beginning of the script are settings you can change. Link to comment Share on other sites More sharing options...
The Loot Posted November 20, 2013 Report Share Posted November 20, 2013 Got it to play and stop a repeating 3D sound. Step 1: Find this line (two places)...x = Audio::PlaySample3D(PfadAudio3D, go->GetPosition(), true);...and add...go->SetUserData(x);...after it. Step 2: Find...go.RemoveCommand("AlarmTriggered");go.RemoveCommand("FalseAlarm");...and add these lines after it...if (Audio3D == 0){ int ref = Target->GetUserData(); Audio::StopSample(ref);}That pretty much wraps up the script as far as I'm concerned. I'm not sure about the permissions on the BMA script, otherwise I'd post mine here for others to use.Free to use, it seems, so here's the whole package with English readme and script. FireAlarms.rar Link to comment Share on other sites More sharing options...
Quincy Posted February 22, 2014 Report Share Posted February 22, 2014 Got it to play and stop a repeating 3D sound. Step 1: Find this line (two places)...x = Audio::PlaySample3D(PfadAudio3D, go->GetPosition(), true);...and add...go->SetUserData(x);...after it. Step 2: Find...go.RemoveCommand("AlarmTriggered");go.RemoveCommand("FalseAlarm");...and add these lines after it...if (Audio3D == 0){ int ref = Target->GetUserData(); Audio::StopSample(ref);}That pretty much wraps up the script as far as I'm concerned. I'm not sure about the permissions on the BMA script, otherwise I'd post mine here for others to use.Free to use, it seems, so here's the whole package with English readme and script. Fire Alarm Script with False Alarms (BMA).rarThe loot, could you please reupload those files. Im getting unknown format or damaged message. Link to comment Share on other sites More sharing options...
The Loot Posted February 23, 2014 Report Share Posted February 23, 2014 The loot, could you please reupload those files. Im getting unknown format or damaged message. Must have been lost in the disk crash. I'll post it here when I get on that PC. Link to comment Share on other sites More sharing options...
Quincy Posted February 23, 2014 Report Share Posted February 23, 2014 Okay thank you very much. Link to comment Share on other sites More sharing options...
The Loot Posted February 23, 2014 Report Share Posted February 23, 2014 File replaced. Link to comment Share on other sites More sharing options...
Quincy Posted February 25, 2014 Report Share Posted February 25, 2014 Thanks again, got it working perfectly. I've added 13 alarm systems to the map. I was going to think about making it so that if a box trips it automatically dispatches an engine if available. Link to comment Share on other sites More sharing options...
Nathan Powell Posted May 18, 2015 Report Share Posted May 18, 2015 im Knew to scripting. Im Making a mod based on the City Of Niagara Falls Canada ( My Home Town) Could someone please help me with adding the Alarms? Link to comment Share on other sites More sharing options...