Facocero Posted March 9, 2022 Posted March 9, 2022 Hello everybody, I'm back here with another question. On this topic I have done a lot of research and, if I understand correctly, it seems that it cannot be done except by resorting to MIST. So in the hope that something has changed I propose the question again. I have a landing event for a helicopter, and I need, that within the script of the aforementioned event there is a check if it is inside a trigger. Basically, if the helicopter landed inside the trigger, then take action, otherwise do nothing. By simply using the event script and using the simple editor functions, it apparently works, but it's just an illusion. Any suggestion is welcome !!
Grimes Posted March 9, 2022 Posted March 9, 2022 Check if the helicopter is inside a trigger zone? If so it just looks worse than it is because its just math. if event.id == 4 then -- land event local uPoint = event.initiator:getPoint() local zone = trigger.misc.getZone('zoneName') if math.sqrt((uPoint.x - zone.point.x)^2 + (uPoint.z - zone.point.z)^2) < zone.radius then -- unit in zone when it landed end end The problem being it doesn't work with a polygon shaped zone. For that you must do a point in polygon check, which is where something like mist.pointInPolygon or equivalent functions from other scripts is useful. 1 The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Recommended Posts