-
Posts
491 -
Joined
-
Last visited
-
Days Won
1
Content Type
Profiles
Forums
Events
Everything posted by ajax
-
Also, be aware that getAirbases() returns FARPs and certain ships (aircraft carriers and those with helidecks), too. If you only want actual airports then you will have to test each one before adding it to the AFBtable table.
-
Ah. I think I see the problem. AFBTable.pos is a position vector. It has p, x, y, and z components, each of which is another vector. So I think you need to change afbData.pos.x to afbData.pos.p.x, afbData.pos.y to afbData.pos.p.y, and afbData.pos.z to afbData.pos.p.z . Edit: Alternatively, you can change tmp:getPosition() to tmp:getPoint().
-
Hmmm... I inserted a bunch of print statements, and the code seems to work for me. Here is the output: 00128.536 INFO SCRIPTING: # coalitions = 1 00128.536 INFO SCRIPTING: getAirbases returned 8 airbases for coalition 1 00128.536 INFO SCRIPTING: 18 1 Sochi-Adler 00128.536 INFO SCRIPTING: 23 1 Senaki-Kolkhi 00128.536 INFO SCRIPTING: 24 1 Kobuleti 00128.536 INFO SCRIPTING: 25 1 Kutaisi 00128.536 INFO SCRIPTING: 70 1 Senaki FARP A 1-01 00128.536 INFO SCRIPTING: 71 1 Senaki FARP B 1-01 00128.536 INFO SCRIPTING: 26 1 Black-sea fleet-01 00128.536 INFO SCRIPTING: 29 1 Black-sea fleet-02 00128.536 INFO SCRIPTING: # coalitions = 2 00128.536 INFO SCRIPTING: getAirbases returned 3 airbases for coalition 2 00128.536 INFO SCRIPTING: 20 2 Sukhumi-Babushara 00128.536 INFO SCRIPTING: 21 2 Gudauta 00128.536 INFO SCRIPTING: 22 2 Batumi 00128.536 INFO SCRIPTING: # coalitions = 3 00128.536 INFO SCRIPTING: getAirbases returned 14 airbases for coalition 0 00128.536 INFO SCRIPTING: 12 0 Anapa-Vityazevo 00128.536 INFO SCRIPTING: 13 0 Krasnodar-Center 00128.537 INFO SCRIPTING: 14 0 Novorossiysk 00128.537 INFO SCRIPTING: 15 0 Krymsk 00128.537 INFO SCRIPTING: 16 0 Maykop-Khanskaya 00128.537 INFO SCRIPTING: 17 0 Gelendzhik 00128.537 INFO SCRIPTING: 19 0 Krasnodar-Pashkovsky 00128.537 INFO SCRIPTING: 26 0 Mineralnye Vody 00128.537 INFO SCRIPTING: 27 0 Nalchik 00128.537 INFO SCRIPTING: 28 0 Mozdok 00128.537 INFO SCRIPTING: 29 0 Tbilisi-Lochini 00128.537 INFO SCRIPTING: 30 0 Soganlug 00128.537 INFO SCRIPTING: 31 0 Vaziani 00128.537 INFO SCRIPTING: 32 0 Beslan 00128.537 INFO SCRIPTING: getAllAirbases success! Are you sure your debug code works as expected?
-
I had a little time so I went ahead and modified the code at the link. I think this will do exactly what you want: function getAllAirbases() -- Returns a table of all airbases having the following structure: -- returnTable.id --ID -- returnTable.coa --Coalition -- returnTable.name --Name -- returnTable.pos --Position -- Returns nil if no airbases found (should never happen) local coalitions = {} coalitions[1] = coalition.side.RED coalitions[2] = coalition.side.BLUE coalitions[3] = coalition.side.NEUTRAL local airdromes = {} for k = 1, #coalitions do local tmp = coalition.getAirbases(coalitions[k]) for i=1, #tmp do local j = #airdromes + 1 airdromes[j] = {} airdromes[j].id = tmp[i]:getID() airdromes[j].coa = coalitions[k] airdromes[j].name = tmp[i]:getName() airdromes[j].pos = tmp[i]:getPosition() end end if #airdromes > 0 then return airdromes else return nil end end
-
This little routine might help: http://forums.eagle.ru/showpost.php?p=2242689&postcount=7
-
Dooom, The latest patched fixed the scripting-engine bug. I will revert the AWACS script so that it will work with the other scripts. It might take a day or two.
-
Okay, it appears there were no changes to the net file. Just copy the main.lua file from the backup\net folder to {DCS}\net\main.lua and all should be good.
-
I usually test it after every update for the 159th server, but I haven't had a chance yet. Will do it this evening.
-
Activate a Group from Advanced Waypoint Action
ajax replied to Wrecking Crew's topic in Mission Editor
The first requires a group object, not name. Try trigger.action.activateGroup(Group.getByName('RDR VGrp82-1 Mortar'))- 1 reply
-
- 2
-
-
-
Here is a function I used to get the nearest AB for a given coalition from an arbitrary position: [font=Courier New]function getNearestAirbase(coa,pos) rvals = {} local airdromes = {} local tmp = coalition.getAirbases(coa) for i=1,#tmp do local j = #airdromes + 1 airdromes[j] = {} airdromes[j].coa = coa airdromes[j].name = tmp[i]:getName() airdromes[j].pos = {} local pos2 = tmp[i]:getPosition() airdromes[j].pos = pos2 airdromes[j].dist = getDistance(pos.p.x,pos.p.z,pos2.p.x,pos2.p.z) airdromes[j].brg = getBearing(pos,pos2) -- degrees end function tsort(a1,a2) return a1.dist < a2.dist end if #airdromes > 1 then table.sort(airdromes,tsort) end if #airdromes > 0 then return airdromes[1] else return nil end end [/font]It's designed to return the nearest AB, but by changing "return airdromes[1]" to "return airdromes" it will return all. You can also iterate over all coalitions to return all ABs. The returned table structure includes the AB's position. getBearing and getDistance are separate functions (defined elsewhere in the script), and they can be safely deleted.
-
The AWACS script would have worked fine with the GCI script except that this scripting-engine bug was introduced in 1.2.8 (http://forums.eagle.ru/showthread.php?t=122534) and to-date has still not been fixed.
-
There have been some intermittant problems with this script where it sometimes stops working. Perhaps you have pinpointed the source of the problem... thanks! The 'lag' in the code-snippet comment doesn't refer to what we commonly refer to as MP lag -- it refers to the delay that occurs when one of the spawned CAP units is killed. While testing the script I noticed that even though a unit was killed and disappeared from the F10 map, 'if not testUnit' still returned true. Apparently, the unit continues to exist until it hits the ground even though the unit is 'dead'. That's why I put the second test in the code.
-
I've gotten that before. I think it is due to unintended mapped joystick input. Make sure all your rotaries and sliders (or whatever inputs might be mapped to key strokes) are centered, then try it again. Usually the second or third try fixes it.
-
If you prefer using a simple Lua predicate as a trigger condition, see this post: http://forums.eagle.ru/showpost.php?p=2066145&postcount=7 It's designed to check in a zone, but I suppose you could make a zone that covers the entire map to make it work for you.
-
Nice detective work, Sven! I'll modify my scripts and then see if the server stability improves. Thanks!
-
It usually never is.:)
-
I know Servman does it in the net environment by hooking into scripting\net\main.lua. Take a look at its source code to see how it's done. I'm not sure, but I don't think you can do it in the mission-scripting environment.
-
Wow! Thanks, ED!
-
Hmmm... then I don't see any alternative to storing the command paths as they get created.
-
Can't you make rPath a global variable which can then be referenced in setCC?
-
Try inserting a "if unitgci" control block right after you assign it. If late activated it will be "nil" before activation (I think).
-
Two things: 1) The description does not have to be the same. (The description is only used in the Mission Editor pull-down menu. The selected livery will be saved in the mission file as the folder name.) 2) Unless it has been fixed, the exception is the Ka-50 where, if you don't have the custom skin, you will see the orange 'missing texture' skin.