xracer Posted August 30, 2013 Share Posted August 30, 2013 (edited) I'm playing around with making a campaign, but have a couple of issues which i cant find a good solution for. If i want to detect a simple thing as a Mission completed or not with a message. On a airport i can use zero speed and narrow down exactly where the plane stops when returning after mission, but what about FARPS. I find it incomplete to say mission accomplished when aircraft is not put solidly on ground and if possible after its shutdown. I dont really understand that theres no trigger or event for detecting a touchdown. I was also looking into using the X_actions, but most of the useful ones like switches you need to be in debug mode to use them. So my question is how can i detect that a heli has touched down on a FARP at least? Been trying lots of ways but none are really good or actually not really working. Edited August 30, 2013 by xracer System spec: Intel Core i7 920@4.2Ghz (stable, 65degC fully loaded), EVGA GTX-780, Asus P6T Deluxe V2 v.5.04 BIOS, Saitek X52, 1TB/500GB WD HD for system/storage. Kingston SSD 120 GB for DCS, 250GB Samsung 840 SSD for the rest. 16GB Kingston KHX1600C9D3 Memory, 9 GB Pagefile, EK HFX-240 Watercooling, Corsair HX-1000 PSU. HAF-932 Tower, TrackIR-5, Win64Ult [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
ENO Posted September 1, 2013 Share Posted September 1, 2013 (edited) Just make a small zone around the farp, set a condition that the unit is in the zone and speed is below 1m/s and that a flag indicating the mission is complete is turned on. You can say below a certain height too but you need to take the height on the ME map and divide it by 3.3 to enter it into the (lower than) height. Make the action a flag that represents the chopper is on the ground. And broadcast the message that they have returned to base and nice work. 2 minutes to shut down (example) Then next trigger just make the condition that time since rtb flag is 120 seconds and end the mission. There are scripts that will also determine that a unit has landed but the above is strictly mission editor. Edited September 1, 2013 by ENO "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
Weta43 Posted September 1, 2013 Share Posted September 1, 2013 divide by 3.3 to enter it into the (lower than) height. unless you've got the ME in metric. Cheers. Link to comment Share on other sites More sharing options...
St3v3f Posted September 1, 2013 Share Posted September 1, 2013 To check if a player is on the ground, try using this as a LUA PRECONDITION in a trigger: local group = 'A-10 #1' --Enter the groupname from the ME here group = Group.getByName(group) if group ~= nil then group = group:getUnits()[1] if group:inAir() then return false else return true end else --If Group does not exist return true end return false The question is, what do you want to happen with inactive groups (Slots that aren't taken)? In this example, they are treated as 'on Ground'. If you want them as 'in Air', remove these two lines: else --If Group does not exist return true 1 aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
ENO Posted September 1, 2013 Share Posted September 1, 2013 ... must spread rep. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
xracer Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) Just make a small zone around the farp, set a condition that the unit is in the zone and speed is below 1m/s and that a flag indicating the mission is complete is turned on. You can say below a certain height too but you need to take the height on the ME map and divide it by 3.3 to enter it into the (lower than) height. Make the action a flag that represents the chopper is on the ground. And broadcast the message that they have returned to base and nice work. 2 minutes to shut down (example) Then next trigger just make the condition that time since rtb flag is 120 seconds and end the mission. There are scripts that will also determine that a unit has landed but the above is strictly mission editor. Thanks for the suggestions on this, but i've tried things related to what you say here, but doing it this way is not a good solution since its too unreliable. Of course if there is no other way i will have to choose a similar approach. I have something which kind of works since the FARP area is same height allover, and also had to measure the diameter of the FARP first for triggerzone to fit since landing just outside is not good enough either for mission complete. And what about if you hoover inside the zone, then the conditions will also be true, but you can still crash and mission is still not accomplished. Timers are not good enough in this case either since everyone use different time to do their stuff. To check if a player is on the ground, try using this as a LUA PRECONDITION in a trigger: local group = 'A-10 #1' --Enter the groupname from the ME here group = Group.getByName(group) if group ~= nil then group = group:getUnits()[1] if group:inAir() then return false else return true end else --If Group does not exist return true end return falseThe question is, what do you want to happen with inactive groups (Slots that aren't taken)? In this example, they are treated as 'on Ground'. If you want them as 'in Air', remove these two lines: else --If Group does not exist return true This kind of looks interesting. Nice if you could point me to docs about this group:inAir type of code. Don't understand why we are not allowed to test for switchpositions in our code without being in debug mode. Would have been some easy ways to code this then. In my opinion its kind of a basic feature to be able to read an event for a landing without LUA spesific coding. Thanks for the help! - Edited September 1, 2013 by xracer 1 System spec: Intel Core i7 920@4.2Ghz (stable, 65degC fully loaded), EVGA GTX-780, Asus P6T Deluxe V2 v.5.04 BIOS, Saitek X52, 1TB/500GB WD HD for system/storage. Kingston SSD 120 GB for DCS, 250GB Samsung 840 SSD for the rest. 16GB Kingston KHX1600C9D3 Memory, 9 GB Pagefile, EK HFX-240 Watercooling, Corsair HX-1000 PSU. HAF-932 Tower, TrackIR-5, Win64Ult [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
ENO Posted September 1, 2013 Share Posted September 1, 2013 Yeah X... as you say it's not perfect but my scripting skills aren't sufficient for me to put out suggestions like st3v3 does. As it is, I do what I can do get by. The FARPs need to be on flat terrain anyway (generally) so you could get 0 M/s and very close to the ground before it would set that flag. The script is the better way but as you said it does work as a last resort. "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art Link to comment Share on other sites More sharing options...
St3v3f Posted September 1, 2013 Share Posted September 1, 2013 I don't quite understand what your problem is with the group:inAir() line. Granted, the snipped wasn't tested as I've put it out before breakfast, but I've just loaded it and it ran fine. inAir() is a function that you can call for Objects of the SSE and it'll return true or false. Alternatively, you can use Object.inAir(group) Documentation about the SSE and the inAir function is here: http://en.wiki.eagle.ru/wiki/Part_1 http://en.wiki.eagle.ru/wiki/Part_2 aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
xracer Posted September 1, 2013 Author Share Posted September 1, 2013 I've managed to get working functionality which tests that the unit needs get down to about 1-2 feet above the platou and in the FARP zone (but still dont need to land exactly on the landingpatches) so i guess most would not crash dropping the heli from that height. I also test for unit alive. Have to give 1-2 feet or else i can risk that it doesn't trigger and thats not too good ;) Actually i have my FARP in a very tricky terrain and the platoulevel is raised maybe 6-7 feet above flat ground. Regarding scripting it, i get a "nil" return all the time and the tutors for DCS LUA programming isn't really the best for less than experienced programmers unfortunately. So i'll keep it using the built in ME functions for now. Anyway, thanks for the efforts ENO! - System spec: Intel Core i7 920@4.2Ghz (stable, 65degC fully loaded), EVGA GTX-780, Asus P6T Deluxe V2 v.5.04 BIOS, Saitek X52, 1TB/500GB WD HD for system/storage. Kingston SSD 120 GB for DCS, 250GB Samsung 840 SSD for the rest. 16GB Kingston KHX1600C9D3 Memory, 9 GB Pagefile, EK HFX-240 Watercooling, Corsair HX-1000 PSU. HAF-932 Tower, TrackIR-5, Win64Ult [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
xracer Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) I don't quite understand what your problem is with the group:inAir() line. Granted, the snipped wasn't tested as I've put it out before breakfast, but I've just loaded it and it ran fine. inAir() is a function that you can call for Objects of the SSE and it'll return true or false. Alternatively, you can use Object.inAir(group) Documentation about the SSE and the inAir function is here: http://en.wiki.eagle.ru/wiki/Part_1 http://en.wiki.eagle.ru/wiki/Part_2 I have pasted the following into the LUA PREDICATE field: local group = 'HGrp1' --Enter the groupname from the ME here group = Group.getByName(group) if group ~= nil then group = group:getUnits()[1] if group:inAir() then return false else return true end else --If Group does not exist return true end return false My group is called 'HGrp1' and unit is called 'Pilot1' and its just one unit in the group. I have just that LUA PREDICATE line as a condition and in action i have a MESSAGE TO ALL. The triggerzone is a ONCE with no EVENT. I get error something about that it cant be nil in the inAir(...) will try more later though. Edited September 1, 2013 by xracer System spec: Intel Core i7 920@4.2Ghz (stable, 65degC fully loaded), EVGA GTX-780, Asus P6T Deluxe V2 v.5.04 BIOS, Saitek X52, 1TB/500GB WD HD for system/storage. Kingston SSD 120 GB for DCS, 250GB Samsung 840 SSD for the rest. 16GB Kingston KHX1600C9D3 Memory, 9 GB Pagefile, EK HFX-240 Watercooling, Corsair HX-1000 PSU. HAF-932 Tower, TrackIR-5, Win64Ult [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
St3v3f Posted September 1, 2013 Share Posted September 1, 2013 Any chance you can provide the .miz? aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
xracer Posted September 1, 2013 Author Share Posted September 1, 2013 (edited) Any chance you can provide the .miz? D*mn it was just the ONCE which had to be changed to CONTINOUS and it works now. Pretty obvious too actually. While your here St3v3f could i ask is it possible to use a file for the code instead for easier editing especially to read the text. As i understand it can be done for ACTIONS at least. EDIT: About inactive units/groups. There is a function getByName for units too which handle access to non-activated units too. Is that what you had in mind in the earlier post? Wonder if i can make a function which detects any unit getting into the zone and grab its name then use it in similar way so its going to be kind of universal for that FARP? - Edited September 1, 2013 by xracer System spec: Intel Core i7 920@4.2Ghz (stable, 65degC fully loaded), EVGA GTX-780, Asus P6T Deluxe V2 v.5.04 BIOS, Saitek X52, 1TB/500GB WD HD for system/storage. Kingston SSD 120 GB for DCS, 250GB Samsung 840 SSD for the rest. 16GB Kingston KHX1600C9D3 Memory, 9 GB Pagefile, EK HFX-240 Watercooling, Corsair HX-1000 PSU. HAF-932 Tower, TrackIR-5, Win64Ult [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
St3v3f Posted September 1, 2013 Share Posted September 1, 2013 I don't know right know if there is a file option for the condition, but using a file makes editing more work in my opinion as it is not automatically updated into the mission. You need to go to the trigger and import the file again. Pasting the content in is quicker for me. And on top of that, imported files like scripts and sounds may get lost sometimes. aka: Baron [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
xracer Posted September 1, 2013 Author Share Posted September 1, 2013 I don't know right know if there is a file option for the condition, but using a file makes editing more work in my opinion as it is not automatically updated into the mission. You need to go to the trigger and import the file again. Pasting the content in is quicker for me. And on top of that, imported files like scripts and sounds may get lost sometimes. Yes some good points there. It seems like the only possible way would be with some of the lua functions like "dofile" to load the chunk then a manual run/excute or something. Its just that the PREDICATE field is so small to get a good look at the code. Guess its meant just for small snippets. System spec: Intel Core i7 920@4.2Ghz (stable, 65degC fully loaded), EVGA GTX-780, Asus P6T Deluxe V2 v.5.04 BIOS, Saitek X52, 1TB/500GB WD HD for system/storage. Kingston SSD 120 GB for DCS, 250GB Samsung 840 SSD for the rest. 16GB Kingston KHX1600C9D3 Memory, 9 GB Pagefile, EK HFX-240 Watercooling, Corsair HX-1000 PSU. HAF-932 Tower, TrackIR-5, Win64Ult [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Recommended Posts