xxnypdofficerxx Posted September 2, 2019 Report Share Posted September 2, 2019 Hey! I am having this issue where the sirens just don't sound... but it's only the police units. The ambulances work just fine, in the script file both police and ambulance units are correctly written but i don't know why in the police they don't sound. Help? Quote Link to comment Share on other sites More sharing options...
Yankee43 Posted September 2, 2019 Report Share Posted September 2, 2019 I had this issue some time ago, my issue was I had to make sure that the Proto names matches the names under the actual script part. It is all case sensitive. Try sending your script. Quote Link to comment Share on other sites More sharing options...
xxnypdofficerxx Posted September 2, 2019 Author Report Share Posted September 2, 2019 //************************************************************************************************** // #Version 2.0# **** // **** // Includes: all Sirens **** // **** // 1.0| VCmdSiren **** // 1.1| DUMMYUpdatePos **** // 1.2| DUMMYDisableSiren **** // 1.3| DUMMYFindPath **** // 1.4| DUMMYHasSiren **** // **** // childID 1 for disabling bluelights. **** // **** // **** //************************************************************************************************** // Hier kann man den Namen eines Icons für die Commandleiste angeben. // Wird automatisch aus den Ordnern UI/Game/Icons/Command/ und UI/Game/Icons/Cursor genommen. const char IMG[] = "sirene"; const char EACTION_FINDPATH[] = "EActionFindPath"; const char DUMMY_HASSIREN[] = "DUMMYHasSiren"; const char DUMMY_UPDATEPOS[] = "DUMMYUpdatePos"; const char DUMMY_FINDPATH[] = "DUMMYFindPath"; const char CMD_MOVETO[] = "MoveTo"; const char NAME_DUMMYOBJECT[] = "HelpingObjekt_Roger"; const char PROTO_VMERHBA[] = "mod:Prototypes/Vehicles/INEM/VMER HBA.e4p"; const char PROTO_VMERHSFX[] = "mod:Prototypes/Vehicles/INEM/VMER HSFX.e4p"; const char PROTO_VMERHSJ[] = "mod:Prototypes/Vehicles/INEM/VMER HSJ.e4p"; const char PROTO_VMERHSM[] = "mod:Prototypes/Vehicles/INEM/VMER HSM.e4p"; const char PROTO_SIV[] = "mod:Prototypes/Vehicles/INEM/SIV.e4p"; const char PROTO_TIP[] = "mod:Prototypes/Vehicles/INEM/TIP.e4p"; const char PROTO_AEM1[] = "mod:Prototypes/Vehicles/INEM/AEM 1.e4p"; const char PROTO_AEM2[] = "mod:Prototypes/Vehicles/INEM/AEM 2.e4p"; const char PROTO_AEM3[] = "mod:Prototypes/Vehicles/INEM/AEM 3.e4p"; const char PROTO_AEM4[] = "mod:Prototypes/Vehicles/INEM/AEM 4.e4p"; const char PROTO_AEM5[] = "mod:Prototypes/Vehicles/INEM/AEM 5.e4p"; const char PROTO_AEM6[] = "mod:Prototypes/Vehicles/INEM/AEM 6.e4p"; const char PROTO_165B[] = "mod:Prototypes/Vehicles/CVP/1-65B.e4p"; const char PROTO_INEMCVP[] = "mod:Prototypes/Vehicles/CVP/INEM.e4p"; const char PROTO_ABSC01[] = "mod:Prototypes/Vehicles/BV Portugal/0101 ABSC 01.e4p"; const char PROTO_ABSC02[] = "mod:Prototypes/Vehicles/BV Portugal/0101 ABSC 02.e4p"; const char PROTO_ABSC03[] = "mod:Prototypes/Vehicles/BV Portugal/0101 ABSC 03.e4p"; const char PROTO_ABSC04[] = "mod:Prototypes/Vehicles/BV Portugal/0101 ABSC 04.e4p"; const char PROTO_ABSC05[] = "mod:Prototypes/Vehicles/BV Portugal/0101 ABSC 05.e4p"; const char PROTO_ABSC06[] = "mod:Prototypes/Vehicles/BV Portugal/0101 ABSC 06.e4p"; const char PROTO_INEMBVP[] = "mod:Prototypes/Vehicles/BV Portugal/0101 INEM 01.e4p"; const char PROTO_CP1[] = "mod:Prototypes/Vehicles/PSP/CP 1.e4p"; const char PROTO_CP2[] = "mod:Prototypes/Vehicles/PSP/CP 2.e4p"; const char PROTO_CP4[] = "mod:Prototypes/Vehicles/PSP/CP 4.e4p"; const char PROTO_TR1[] = "mod:Prototypes/Vehicles/PSP/TRANSITO 1.e4p"; const char PROTO_TR2[] = "mod:Prototypes/Vehicles/PSP/TRANSITO 2.e4p"; const char PROTO_CI1[] = "mod:Prototypes/Vehicles/PSP/CI 1.e4p"; const char PROTO_CI2[] = "mod:Prototypes/Vehicles/PSP/CP 2.e4p"; const char PROTO_UEP1[] = "mod:Prototypes/Vehicles/PSP/UEP 1.e4p"; const char PROTO_UEP2[] = "mod:Prototypes/Vehicles/PSP/UEP 2.e4p"; int DummyGroup = 20; // 01.0 object VCmdSiren : CommandScript { VCmdSiren() { SetIcon(IMG); SetCursor(IMG); SetRestrictions(RESTRICT_SELFEXECUTE); } bool CheckPossible(GameObject *Caller) { if (!Caller->IsValid()) return false; if (Caller->GetType() == ACTOR_VEHICLE) { return true; } return false; } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { if (!Target->IsValid() || Target->GetID() != Caller->GetID()) return false; if (!Caller->HasCommand(CMD_MOVETO) || Caller->GetType() != ACTOR_VEHICLE) return false; return true; } void PushActions(GameObject *Caller, Actor *Target, int childID) { Vehicle v(Caller); if (!v.HasCommand(DUMMY_HASSIREN) && (childID != 2 && childID != 1)) { int soundID; v.EnableBlueLights(true); if (v.HasCommand("DUMMY_HasNoLight")) { v.PushActionExecuteCommand(ACTION_APPEND, "BlueLight", Caller, 0, false); } Vector CarPos = v.GetPosition(); // Hier die const char Namen von oben eintragen wie in den beiden Beispielen unten. if (StrCompare(v.GetPrototypeFileName(), PROTO_VMERHBA) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/08.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_VMERHSFX) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Fujita.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_VMERHSJ) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/08.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_VMERHSM) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/08.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_SIV) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_AEM1) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_AEM2) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/04.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_AEM3) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_AEM4) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/04.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_AEM5) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Fujita2.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_AEM6) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/04.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_TIP) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_ABSC01) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Fujita2.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_ABSC02) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_ABSC03) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/02.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_ABSC04) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/04.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_ABSC05) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/07.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_ABSC06) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/07.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_INEMBVP) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/04.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_INEMCVP) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/04.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_165B) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/01.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_CP1) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_CP2) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/07.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_CP4) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/08.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_CI1) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/Fujita.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_CI2) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_UEP1) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_UEP2) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_TR1) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/08.wav", CarPos, true); } if (StrCompare(v.GetPrototypeFileName(), PROTO_TR2) == 0) { soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); } GameObject mDummy = Game::CreateObject("mod:Prototypes/Objects/Misc/empty.e4p", NAME_DUMMYOBJECT); mDummy.Hide(); mDummy.SetPosition(CarPos); mDummy.SetUserData(soundID); mDummy.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_UPDATEPOS, &v, soundID, false); v.SetUserData(soundID); v.AssignCommand(DUMMY_HASSIREN); return; } if (v.HasCommand(DUMMY_HASSIREN)) { if (childID == 1) { v.EnableBlueLights(false); } if (v.HasCommand(DUMMY_HASSIREN)) { int ref = Caller->GetUserData(); Audio::StopSample(ref); GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT); for(int i=0; i<list.GetNumObjects(); i++) { GameObject *obj = list.GetObject(i); if (obj->GetUserData() == ref) { int mSirTest = i; } } GameObject *obj = list.GetObject(mSirTest); obj->PushActionDeleteOwner(ACTION_NEWLIST); v.RemoveCommand(DUMMY_HASSIREN); } return; } } }; // 01.1 object DUMMYUpdatePos : CommandScript { DUMMYUpdatePos() { SetGroupID(DummyGroup); } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { } void PushActions(GameObject *Caller, Actor *Target, int childID) { Vehicle v(Target); GameObject mDummy(Caller); Vector CarPos = v.GetPosition(); if (v.IsDestroyed() || !v.IsValid()) { int ref = mDummy.GetUserData(); Audio::StopSample(ref); mDummy.PushActionDeleteOwner(ACTION_NEWLIST); } else { mDummy.SetPosition(CarPos); Audio::UpdatePos(childID, CarPos, true); if (v.IsCurrentAction(EACTION_FINDPATH)) { if (!v.HasCommand(DUMMY_FINDPATH)) { v.AssignCommand(DUMMY_FINDPATH); } } mDummy.PushActionExecuteCommand(ACTION_NEWLIST, DUMMY_UPDATEPOS, Target, childID, false); } if (v.HasCommand(DUMMY_FINDPATH)) { if (!v.IsCurrentAction(EACTION_FINDPATH) && v.GetNumActions() == 0) { v.RemoveCommand(DUMMY_HASSIREN); v.RemoveCommand(DUMMY_FINDPATH); int ref = Caller->GetUserData(); Audio::StopSample(ref); GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT); for(int i = 0; i < list.GetNumObjects(); i++) { GameObject *obj = list.GetObject(i); if (obj->GetUserData() == ref) { int mSirTest = i; GameObject *obj = list.GetObject(mSirTest); obj->PushActionDeleteOwner(ACTION_NEWLIST); v.RemoveCommand(DUMMY_HASSIREN); if (v.HasCommand(DUMMY_FINDPATH)) { v.RemoveCommand(DUMMY_FINDPATH); } } } } } } }; // 01.2 object DUMMYDisableSiren : CommandScript { DUMMYDisableSiren() { SetGroupID(DummyGroup); } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { } void PushActions(GameObject *Caller, Actor *Target, int childID) { Vehicle v(Caller); if (childID == 1) { v.EnableBlueLights(false); } int ref = Caller->GetUserData(); Audio::StopSample(ref); GameObjectList list = Game::GetGameObjects(NAME_DUMMYOBJECT); for(int i = 0; i < list.GetNumObjects(); i++) { GameObject *obj = list.GetObject(i); if (obj->GetUserData() == ref) { int mSirTest = i; GameObject *obj = list.GetObject(mSirTest); obj->PushActionDeleteOwner(ACTION_NEWLIST); v.RemoveCommand(DUMMY_HASSIREN); if (v.HasCommand(DUMMY_FINDPATH)) { v.RemoveCommand(DUMMY_FINDPATH); } } } } }; // 01.3 object DUMMYFindPath : CommandScript { DUMMYFindPath() { SetGroupID(DummyGroup); } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { return false; } void PushActions(GameObject *Caller, Actor *Target, int childID) { } }; // 01.4 object DUMMYHasSiren : CommandScript { DUMMYHasSiren() { SetGroupID(DummyGroup); } 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) { } }; Quote Link to comment Share on other sites More sharing options...
Florian17 Posted September 2, 2019 Report Share Posted September 2, 2019 If you want to save some lines in the script you could use the following lines of code instead of the many if-cases after line 112 of your current version ( // Hier die const char Namen von oben eintragen wie in den beiden Beispielen unten.) Simply replace the if-cases with these lines and name your audio files like the corresponding prototype of the vehicle. char SoundName[255]; snprintf(SoundName, 255, "mod:Audio/FX/Sirens/%s.wav", v.GetPrototypeName()); soundID = Audio::PlaySample3D(SoundName, CarPos, true); With this, you won't need to add a new if-case for every prototype. Simply add a new audio file to your folder and name it the same as the displayed name of the vehicle in the editor. (The one in the top bar, not the prototypename itself). If you have any questions, ask here or send me a PM! Quote Link to comment Share on other sites More sharing options...
itchboy Posted September 2, 2019 Report Share Posted September 2, 2019 You can also consolidate some vehicles together if they use the same set of sirens. if (StrCompare(v.GetPrototypeFileName(), PROTO_CI2) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_UEP1) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_UEP2) == 0 || StrCompare(v.GetPrototypeFileName(), PROTO_TR2) == 0) soundID = Audio::PlaySample3D("mod:Audio/FX/Sirens/INEM.wav", CarPos, true); Quote Link to comment Share on other sites More sharing options...
xxnypdofficerxx Posted September 3, 2019 Author Report Share Posted September 3, 2019 Thanks! But the problem remains Quote Link to comment Share on other sites More sharing options...
xxnypdofficerxx Posted September 5, 2019 Author Report Share Posted September 5, 2019 Solved!! I changed the proto names and it simply worked Quote Link to comment Share on other sites More sharing options...