bojangles_25 Posted March 22, 2013 Posted March 22, 2013 Hey! I remember doing this years ago for a laugh in Operation Flashpoint.. I thought I'd maybe give it a try in DCS to see whats possible with the scripting engine and learn more about editing. Basically, you periodically (like every second) update the position of a trigger, perhaps with a radius of 200m, to that of the player's jet. Then you enumerate every unit within that trigger that isn't the player and set its damage (to destroy it). Pseudo-code would be like this: trigger t; t.pos = 0,0,0; t.radius = 200; while(true){ t.pos = player.pos; for (unit u : t.units){ if(! isplayer(u)) u.setDamage(999); } sleep(1); } Are things like this possible with the DCS scripting engine? The documentation on the wiki isn't all that clear about changing things DURING the mission... It seems easy to get information about the world and units etc.. but what about making things actually happen? I haven't done that much mission editing but I'm an experienced programmer, so I'm alright with lua, its just not that clear what's actually possible within DCS I'm interested in people's ideas/experience "We could come back with hydraulics shot out, half the tail shot off, piece of the wing shot off, we had two engines and could come home with one... She really was a piece of machinery that you could fly into hell and back... And she was designed around that gun from day 1"
Grimes Posted March 22, 2013 Posted March 22, 2013 Use Mist from the link in my signature. And use the mist.getUnitsInMovingZones() function to search all of the alive units within a zone that is centered on a unit. You will need to schedule the function so that it will constantly repeat at the desired rate, do this by using mist.scheduleFunction() The only variables we can alter with AI are related to their behavior, things like health, fuel, etc, are not currently accessible. So the only way to "set damage" is to cause an explosion near the unit. Iterate through each unit and do a trigger.action.explosion() on the pos3 position of the unit with a powerful enough explosion to kill it. 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
Riddick Posted September 22, 2023 Posted September 22, 2023 Grimes thank you, you gave me an idea on how to try to simulate the gradual destruction of an aircraft when flying in a contaminated zone.
Riddick Posted September 22, 2023 Posted September 22, 2023 (edited) The idea was simple, but the explosions in the DCS either destroy the plane immediately or have no effect, depending on the distance of the explosion above the plane. No intermediate damage is visible on the plane. local MyPlane = "PlaneDriver" -- Trying to damage unit local myUnit = Unit.getByName(MyPlane) local myPosition = myUnit:getPoint() myPosition.y = myPosition.y + 675 trigger.action.explosion(myPosition, 10000) The plane simply exploded after five detonations, without visible damage or failure. Edited September 22, 2023 by Riddick
Recommended Posts