gammaxy Posted May 28, 2023 Share Posted May 28, 2023 I'm relatively new to the mission editor and I was trying to make a way so I can land my plane on a base with no enemy units on it to change its coalition to mine. I've tried many different ways but none I tired worked, so if you know a way i'd greatly appreciate it. Link to comment Share on other sites More sharing options...
pete_auau Posted May 28, 2023 Share Posted May 28, 2023 When your in the map click on the base you want to land etc and on the top right make sure you select neutral or blue forces Link to comment Share on other sites More sharing options...
cfrag Posted May 28, 2023 Share Posted May 28, 2023 9 hours ago, gammaxy said: I can land my plane on a base with no enemy units on it to change its coalition to mine. This is currently not supported in vanilla DCS. In order to capture a base, you need 'boots on the ground' - infantry: a solider or a vehicle. So what you need is a small script that, when you land on an airfield, it spawns a unit of your coalition inside the 2km airfield zone, and if that unit is the only ground unit, you'll capture the zone. If I have the time, I'll try and come up with a small script that can do that for you. Link to comment Share on other sites More sharing options...
Solution cfrag Posted May 28, 2023 Solution Share Posted May 28, 2023 10 hours ago, gammaxy said: so if you know a way i'd greatly appreciate it. Here's the script, simply paste it into a DOSCRIPT Action on MISSION START. It will monitor all your landings, and if you (a player) land on an airfield that does not belong to your faction, it puts an infantry soldier close to your touch-down point in an attempt to capture the base. You'll see a message appear when you were successful. Script: Spoiler grabber = {} grabber.version = "1.0.0" grabber.uuid = 0 function grabber.getUUID() grabber.uuid = grabber.uuid + 1 return grabber.uuid end -- -- script to "grab" an airfield after landing a plane -- function grabber.getClosestAirbase(theUnit) local p = theUnit:getPoint() local all = world.getAirbases() local dist = math.huge local closest = nil for idx, theBase in pairs(all) do local ap = theBase:getPoint() local dx = ap.x - p.x local dz = ap.z - p.z local d = math.sqrt(dx * dx + dz * dz) if d < dist then dist = d closest = theBase end end return closest end function grabber:onEvent(event) if not event then return end if not event.initiator then return end if event.id == 10 then trigger.action.outText("Airfield " .. event.place:getName() .. " was captured by " .. event.initiator:getName(), 30) return end if event.id ~=4 then return end -- not 'landing' local theUnit = event.initiator if not theUnit then return end local theField = grabber.getClosestAirbase(theUnit) -- player landed on 'theField' local coa = theUnit:getCoalition() if coa == theField:getCoalition() then return end -- belongs to us -- drop a SoldierM4 slightly away from out landing pos local p = theUnit:getPoint() local groupData = {} groupData.name = "grabby-"..grabber.getUUID() groupData.task = "Ground Nothing" groupData.units = {} local gUnit = {} gUnit.x = p.x + 100 gUnit.y = p.z + 100 gUnit.name = groupData.name gUnit.type = "Soldier M4" table.insert(groupData.units, gUnit) -- spawn it coalition.addGroup(theUnit:getCountry(), Group.Category.GROUND, groupData) trigger.action.outText("Attempting to grab airfield " .. theField:getName(), 30) end -- -- start up -- world.addEventHandler(grabber) Demo mission and script as file below. You many need to change to A-10 to any aircraft that you currently fly and can land reliably. grab'em now.miz grabber.lua 1 Link to comment Share on other sites More sharing options...
gammaxy Posted May 28, 2023 Author Share Posted May 28, 2023 Thank you so much it works really well Link to comment Share on other sites More sharing options...
74DELTA Posted February 21 Share Posted February 21 (edited) You sir, are brilliant! I am a scripting newb and have been working with MOOSE and MIST for days to get my idea to work, looks like you did that over a lunch break. Many Thanks! Edited February 21 by 74DELTA Link to comment Share on other sites More sharing options...
DD_Friar Posted March 26 Share Posted March 26 @74DELTA, Sir, @cfrag is a god to me. Go check out his DML Tool box. You will not have to learn coding to do things like this. You just drop in the required module. Its not a mod either so put the required module(s) in your mission and everyone then gets it. No need for them to do anything extra. Modules are added just as he described with the script he did for you, use DOSCRIPT and paste the module code in. Job done. It has transformed my mission building. Visit the Dangerdogz at www.dangerdogz.com. We are a group based on having fun (no command structure, no expectations of attendance, no formal skills required, that is not to say we can not get serious for special events, of which we have many). We play DCS and IL2 GBS. We have two groups one based in North America / Canada and one UK / Europe. Come check us out. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now