Dj Rolnik 29 Posted August 8, 2019 Hey, I am in need of help with trigger conditions checking whether there are enemy units (OPFOR) present inside vehicles such as jets, helicopters or boats. The idea is to have the trigger check whether enemy aircraft (or boats, but that's really low priority and optional) is approaching a large location covered by a trigger (about 10+km in size) and when that happens, launch an alarm sound effect in a certain place on the map (possibly not the trigger itself, because they are supposed to be placed in different locations). The important thing is that it's not only OPFOR - present, as the activation type, but OPFOR units in aircraft-type vehicles. An extra nice-to-have feature (if even doable) would be to display a hint or any kind of message on the screen informing about the type of aircraft incoming (not necessarily the name of the specific type of aircraft, but rather its type, so in that case "helicopter" or "jet"). I would be grateful for help in defining this condition! Thanks! Adam Share this post Link to post Share on other sites
stanhope 411 Posted August 8, 2019 Something along the lines of this && (thisList select 0) isKindOf "Plane" for the condition and in onActivation something along the lines of private _displayName = getText(configFile >> "CfgVehicles" >> typeOf (thisList select 0) >> "displayName"); hint format ["Enemy jet (%1) approaching!", _displayName ]; Both are untested and it will presumably only work properly for 1 enemy vehicle at a time. 2 Share this post Link to post Share on other sites
Dj Rolnik 29 Posted August 8, 2019 Hey @stanhope Thanks for a quick reply, I will give this a try. Does this include a check for whether it's an enemy plane? That's a crucial component for all that 😉 Thanks! Share this post Link to post Share on other sites
stanhope 411 Posted August 8, 2019 Well, if your trigger is set to detect enemy forces all it needs to detect what type of enemy it has detected and yes, the condition is checking for if the thing it has detected is a plane. 1 Share this post Link to post Share on other sites
Dj Rolnik 29 Posted August 8, 2019 Ah yes, I see what you mean. I kind of blanked and forgot how the trigger is going to be set up. Will try that as soon as possible : ) Share this post Link to post Share on other sites
Dj Rolnik 29 Posted August 8, 2019 Ok, so I tested it a little bit and the condition check is working ok. It does detect the aircraft and activates the trigger. Once it leaves the trigger it deactivates. I have actually not managed to get the display name of the aircraft type displayed - it spewed some kind of error, but I actually decided not to use this as it suited the scenario better. I have a different problem though. Currently whenever one aircraft enters the trigger it activates it. However, if more aircraft were to enter the trigger activation zone in small intervals, the trigger will activate a few times, once per each enemy aircraft. This is a problem because the trigger runs a sound script on activation which triggers an alarm and when more aircraft enter the trigger zone the sounds queue up and overlap each other. I imagine there is got to be some kind of check whether the trigger is still active and if it already is, not trigger it again, but I don't know how to do that 😞 Currently the triggered script looks like this: while {triggerActivated trigger_alarm} do { speaker1 say3D ["alarm1", 250, 1, false]; speaker2 say3D ["alarm1", 250, 1, false]; speaker3 say3D ["alarm1", 250, 1, false]; speaker4 say3D ["alarm1", 250, 1, false]; speaker5 say3D ["alarm1", 250, 1, false]; sleep 14.284; //duration of the sound }; Any ideas? Maybe something to do with this? https://community.bistudio.com/wiki/scriptDone Thanks! Adam Share this post Link to post Share on other sites
stanhope 411 Posted August 9, 2019 if (isNil "codeAlreadyRunning") then {codeAlreadyRunning = false;}; while {triggerActivated trigger_alarm && !codeAlreadyRunning} do { codeAlreadyRunning = true; speaker1 say3D ["alarm1", 250, 1, false]; speaker2 say3D ["alarm1", 250, 1, false]; speaker3 say3D ["alarm1", 250, 1, false]; speaker4 say3D ["alarm1", 250, 1, false]; speaker5 say3D ["alarm1", 250, 1, false]; sleep 14.284; //duration of the sound codeAlreadyRunning = false; }; Something like this should fix that, untested. 2 Share this post Link to post Share on other sites
Dj Rolnik 29 Posted August 9, 2019 Seems to be working, thanks a lot for your help @stanhope! Now that it does work I think that I may have incorrectly set up some other things in the mission which may have triggered the sound twice, not the original script provided by you in the first post. Anyways, I will dig a bit more but for now this solution does work, so thanks a lot again! 1 Share this post Link to post Share on other sites