Jump to content

Recommended Posts

Posted

Ok, I got it working by just doing the math, but I would still like to know if that function is built into the SSE somewhere. Thanks!

 

local pos = _u:getPoint()

local GROUND = land.getHeight({ x = pos.x, y = pos.z })

local gID = _u:getID()

local zone = trigger.misc.getZone('AGL RESTRICTION')

local zoneDistX = zone.point.x - pos.x

local zoneDistY = zone.point.z - pos.z

local zoneDist = ( math.sqrt( ( zoneDistX*zoneDistX ) + ( zoneDistY*zoneDistY ) ) )

 

if (pos.y - GROUND) > 31 and zoneDist < 18288 then

Posted

If you are going to use scripts, I highly recommend you consider MOOSE. It provides a user-friendly interface to the DCS scripting API and makes your action described above pretty easy.

Posted

Thanks Habu. I do use MOOSE for some things, but honestly my problem with it is trying to keep up with changes and finding the proper documentation.

 

If I want to do X, I need to check the sample missions within eclipse (which doesn't completely answer my question), look at the moose documentation online (which doesn't completely answer my question), watch his videos (which doesn't completely answer my question usually because something within MOOSE has changed), and then try to sift through thousands of random posts on the discord (which doesn't completely answer my question). It's an exercise in frustration for me.

 

I think what FlightControl is doing with it is amazing, but something just doesn't click for me.

  • Like 1
Posted

Completely sympathize with your frustrations. I consider my Moose coding skills as intermediate level and find that altho a new Moose.lua is published very week or so, the new versions mostly introduce new classes and fix bugs. Seldom break something that is working. In my experience it took a few dozen hours of working with Moose to finally grasp the concepts and understand how to use the docs and sample scripts.

Posted

The above exercise in moose would look roughly like this:

 

local _zone = ZONE:New("enemyzone")

local _group = GROUP:FindByName("badguys")

if _group:IsCompletelyInZone(_zone) then

end

 

MOOSE has the best documentation there is for any of this stuff. Hands down.

 

Just ask here like you're doing, or better yet join the MOOSE discord. Plenty of people there to assist, and once you get the feel for MOOSE you start laying down sick functionality really fast.

 

Banner EDForum2020.jpg

Have fun. Don't suck. Kill bad guys. 👍

https://discord.gg/blacksharkden/

Posted
Ok, I got it working by just doing the math, but I would still like to know if that function is built into the SSE somewhere. Thanks!

 

Doing the math is how you do it. There is no native scripting engine function for that.

 

No harm in knowing how to do it that way either. Its like math class where showing your work was as important as getting the right answer. Same concept really.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • 4 years later...
Posted

Are there any updates for this in 2024? We've got not only circular but also a 4-point zone - this makes the programmatic check much harder. And there are conditions in ME triggers - but I can't see anything in vanilla DCS Lua scripting. I know I can do this with MOOSE, but do I have to use a library for this?

✈️ L-39, F-4E, F-5E, F-14, F/A-18C, MiG-15, F-86F, AJS-37, C-101, FC2024 🛩️ Yak-52, P-47, Spitfire, CE2 🚁 UH-1H, Mi-8, Ka-50 III, SA342 🗺️ NTTR, PG, SY, Chnl, Norm2, Kola, DE 📦 Supercarrier, NS430, WWII, CA 🕹️ VKB STECS+Gladiator/Kosmosima+TPR ▶️ DCS Unscripted YouTube 🐛 "Favourite" bugs: 1) Object local camera fast/slow inverted, 2) Yak-52 toggles not toggling, 3) all Caucasus ATC bugs

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...