exil Posted August 13, 2017 Posted August 13, 2017 Guys, i'm setting up a NTTR Training Range with different aircraft and scenarios that you can activate with the F10 menu. First of all, i'm a total scripting noob. I barely managed to make me a little script for the activation and deactivation of some units using the F10 Menu (There will be an a2a range, a gunnery range, an EW range and so on...). So i decided to add some fast rope actions for the huey and the mi-8 on different places. The problem is, i only can do it with the trigger menu inside the ME. And therefore it really gets complicated. What i did so far: to simulate the sitiuation when you're within limits for fast rope: HUEY A inside zone AND height less than AND height more than AND vertical velocity less than AND speed less than...> set flag 1 true to simulate the situation when you're out of limits: HUEY A outside zone, OR height more than, OR height less than, OR vertical velocity more than, OR speed more than...> set flag 1 false If flag 1 is true, a group of two soldiers will get spawed after 8 seconds, then after another 8 seconds another group of two soldiers gets spawned and until finally 8 soldiers are spawend after a total of 32 seconds to simulate that only two soldiers can rope at the same time (left and right). If flag 1 is false, no soldiers will spawn unless you meet the limits again to set flag 1 true. As you can see, if you need to do this for several helos (e.g. HUEY A, HUEY B, HUEY C, HUEY D) and then try to do it for several zones (ZONE A, B, C, D...) it's really getting confusing and messy inside the ME triggers section. Now i'm looking for a way to accomplish a more generall approach with scripting. I'm looking for something like if HUEY A or B or C or D is inside zone A or B or C or D and the parameters (see above) are met, the activate the group assigned to the specified zone. So, do you think it is doable or to complicated? I know the CTLD script from grimes has a fast rope part in it, but for me it's just a little to simple... I would really appreciate any input. Even if you tell me, that it won't be possible to achieve ;) GeForce RTX 4090 Founders Edition - AMD Ryzen 7 5800X3D - 64Gb RAM - Win11 - HP Reverb G1 - Thrustmaster Warthog HOTAS (40cm extension) - VKB Sim T-Rudder MKIV Pedals
exil Posted February 13, 2019 Author Posted February 13, 2019 Gents, i hijacked a code from ajax from the following thread to get some kind of FastRope action working. HERE I added a line "hover" to simulate the helicopter hovering. Everything is working fine so far. local function anyUnitLandedInZone(units, zone, checkLanded, checkStopped) local stopSpeed = 1.0 -- m/s local landed = false local hover = false local inZone = false local alive = false local stopped = false local i for i=1,#units do local group = Group.getByName(units[i]) if group then local unit = group:getUnit(1) if unit and unit:isActive() then -- is unit in zone? local unitPos = unit:getPoint() local z = trigger.misc.getZone(zone) if z then local dx = unitPos.x - z.point.x local dy = unitPos.z - z.point.z local d = math.sqrt(dx*dx + dy*dy) if d < z.radius then inZone = true end end -- has unit landed? local inAir = unit:inAir() if not inAir then landed = true end -- check if unit is in hover local pos = unit:getPoint() local agl = pos.y - land.getHeight({x=pos.x, y = pos.z}) if (agl > 3 and agl < 18) then hover = true end -- is unit still alive? local life = unit:getLife() if life > 1 then alive = true end -- has unit stopped? local v = unit:getVelocity() local s = math.sqrt(v.x*v.x + v.y*v.y + v.z*v.z) if s < stopSpeed then stopped = true end end --return true if conditions met if (landed or hover) and inZone and alive and stopped then return true end end end end return anyUnitLandedInZone( { 'JOLLY01' , 'Cicada-2' , 'Cicada-3' , 'Cicada-4' , 'Vespa-1-Lead' , 'Vespa-2' , 'Vespa-3' , 'Vespa-4' , 'Vulture-1-Lead' , 'Vulture-2' , 'Vulture-3' , 'Vulture-4' , } , 'FASTROPE01', false, false ) To get a fastrope working properly, i want to add a certain amount of time, where the helo needs to hover within a specific height bounderies (see code) for at least xx amount of seconds to simulate the troops roping. I tried variations with "timer.scheduleFunction" but doesn't seem to get it to work. Any advise would be appriciated! GeForce RTX 4090 Founders Edition - AMD Ryzen 7 5800X3D - 64Gb RAM - Win11 - HP Reverb G1 - Thrustmaster Warthog HOTAS (40cm extension) - VKB Sim T-Rudder MKIV Pedals
Recommended Posts