-
Posts
1517 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by xcom
-
REQUEST-is it possible to reserve planes for certain players?
xcom replied to 9.JG27 DavidRed's topic in Mission Editor
Hi David, I posted a script for it a few weeks ago - http://forums.eagle.ru/showthread.php?t=140779 Haven't seen this thread before. -
What exactly do you mean NET settings for AI aircraft?
-
How to... save specific flag values between MP missions?
xcom replied to 609_Relentov's topic in Mission Editor
For your needs, I would use the loadfile shown in MBot's DC Guardians script. Save the flags by exporting a table to a file: local function TableSerialization(t, i) --function to turn a table into a string (works to transmutate strings, numbers and sub-tables) local text = "{\n" local tab = "" for n = 1, i + 1 do --controls the indent for the current text line tab = tab .. "\t" end for k,v in pairs(t) do if type(k) == "string" then text = text .. tab .. k .. " = " if type(v) == "string" then text = text .. "'" .. v .. "',\n" elseif type(v) == "number" then text = text .. v .. ",\n" elseif type(v) == "table" then text = text .. TableSerialization(v, i + 1) end elseif type(k) == "number" then text = text .. tab .. "[" .. k .. "] = " if type(v) == "string" then text = text .. "'" .. v .. "',\n" elseif type(v) == "number" then text = text .. v .. ",\n" elseif type(v) == "table" then text = text .. TableSerialization(v, i + 1) end end end tab = "" for n = 1, i do --indent for closing bracket is one less then previous text line tab = tab .. "\t" end if i == 0 then text = text .. tab .. "}\n" --the last bracket should not be followed by an comma else text = text .. tab .. "},\n" --all brackets with indent higher than 0 are followed by a comma end return text end local exportData = "local t = " .. TableSerialization(MDC_data, 0) .. "return t" --The second argument is the indent for the initial code line (which is zero) exportFile = io.open("MDC_campaign_results.lua", "w") exportFile:write(exportData) exportFile:close() Load the saved file and run a loop to activate the names as flags: local LoadCampaignData = loadfile("MDC_campaign_results.lua") -
After a little digging, I found it I believe, see attached - P-51D Airbase Capture V1.36.miz. It was before I started to use MIST and I build the tables on my own :) Because I wanted to create a larger airbase capture mission that will work with any mission I wanted to create , I've started work on a script that will activate the slots according to the airbase. I still haven't tested it yet too much, I'll have to go through it and see how is it going. But basically it should work - mission setup: 1. Airfields should be neutral, they should only be changed by the capture, this is so it will return to neutral once all the units are destroyed on the airfield. 2. The above means that if you want to have controlled airbases on the start, you should spawn in at the start some units in the airfield which will make them be captured. 3. The slots you create need to have group name that starts with the airfield/FARP info - --Airbase short name list local abList = { ['Anapa-Vityazevo'] = "AN", ['Krymsk'] = "KR", ['Gelendzhik'] = "GE", ['Novorossiysk'] = "NO", ['Krasnodar-Center'] = "KC", ['Krasnodar-Pashkovsky'] = "KP", ['Maykop-Khanskaya'] = "MK", ['Sochi-Adler'] = "SA", ['Sukhumi-Babushara'] = "SB", ['Mineralnye Vody'] = "MV", ['Nalchik'] = "NA", ['Mozdok'] = "MO", ['Beslan'] = "BE", ['Senaki-Kolkhi'] = "SK", ['Kutaisi'] = "KU", ['Kobuleti'] = "KO", ['Batumi'] = "BA", ['Tbilisi-Lochini'] = "TL", ['Soganlug'] = "SO", ['Vaziani'] = "VA", ['Gudauta'] = "GU", } For example - a slot that is placed to takeoff from Gudauta would be - [GU] A-10C [GU] F-15C etc.. a slot that is placed to takeoff from a FARP is dependent on the FARP callsign - [London] KA-50 [Dallas] UH-1H [Paris] Mi-8 etc.. in the mission triggers: 1. Load MIST. 2. Load the script. Mind that I still didn't finish checking everything with the script, I will when I find the time. If anyone does all the tests and gets it working 100%, please share your results as I usually do so everyone can enjoy it. --necessary variables-- --Handler table local eHandler = {} --Airbase short name list local abList = { ['Anapa-Vityazevo'] = "AN", ['Krymsk'] = "KR", ['Gelendzhik'] = "GE", ['Novorossiysk'] = "NO", ['Krasnodar-Center'] = "KC", ['Krasnodar-Pashkovsky'] = "KP", ['Maykop-Khanskaya'] = "MK", ['Sochi-Adler'] = "SA", ['Sukhumi-Babushara'] = "SB", ['Mineralnye Vody'] = "MV", ['Nalchik'] = "NA", ['Mozdok'] = "MO", ['Beslan'] = "BE", ['Senaki-Kolkhi'] = "SK", ['Kutaisi'] = "KU", ['Kobuleti'] = "KO", ['Batumi'] = "BA", ['Tbilisi-Lochini'] = "TL", ['Soganlug'] = "SO", ['Vaziani'] = "VA", ['Gudauta'] = "GU", } --Airbase Table AB_Aerodromes = { ['red'] = {}, ['blue'] = {}, ['neutral'] = {}, } --FARPs table AB_FARPs = { ['red'] = {}, ['blue'] = {}, ['neutral'] = {}, } --Dynamic deactivation table local deactivateGroups = { ['blue'] = {}, ['red'] = {}, } --Populating red airbases to custom table (Aerodromes & FARPs divided) for i,airbase in pairs(coalition.getAirbases(1)) do local aName = airbase:getCallsign() local aDesc = airbase:getDesc() local aCat = aDesc.category if aCat == Airbase.Category.AIRDROME then AB_Aerodromes['red'][#AB_Aerodromes.red + 1] = aName elseif aCat == Airbase.Category.FARP then AB_FARPs['red'][#AB_FARPs.red + 1] = aName end end --Populating blue airbases to custom table (Aerodromes & FARPs divided) for i,airbase in pairs(coalition.getAirbases(2)) do local aName = airbase:getCallsign() local aDesc = airbase:getDesc() local aCat = aDesc.category if aCat == Airbase.Category.AIRDROME then AB_Aerodromes['blue'][#AB_Aerodromes.blue + 1] = aName elseif aCat == Airbase.Category.FARP then AB_FARPs['blue'][#AB_FARPs.blue + 1] = aName end end local function deactivateBase(coaName, airbase) --Get airbase short name local AB = "" for aName,shortABName in pairs(abList) do if airbase == aName then AB = shortABName end end --Check all groups and put relevant ones in deactivation table. for gName, gTable in pairs(mist.DBs.MEgroupsByName) do if string.sub(gTable.groupName,1,string.len("["..AB.."]"))=="["..AB.."]" then if gTable.coalition == coaName then if not Group.getByName(gTable.groupName) then if not deactivateGroups[coaName][airbase] then deactivateGroups[coaName][airbase] = {} deactivateGroups[coaName][airbase][1] = gTable.groupName else deactivateGroups[coaName][airbase][#deactivateGroups[coaName][airbase] + 1] = gTable.groupName end end end end end end --Gets information from the handler on the Airbases and updates the operator - deactivateBase on what to do. local function ABmanager(coaName, airbase) --trigger.action.outText(mist.utils.tableShow(deactivateGroups), 15) if coaName == "red" then deactivateGroups["red"][airbase] = {} deactivateBase('blue', airbase) elseif coaName == "blue" then deactivateGroups["blue"][airbase] = {} deactivateBase('red', airbase) else deactivateBase('red', airbase) deactivateBase('blue', airbase) end end --Airbase Handler - Checks the Airbases and updated the manager on what to do. local function ABmanagerHandler() for k = 1,3,1 do for i,AB in pairs(coalition.getAirbases(k)) do local aDesc = AB:getDesc() local aCat = aDesc.category if AB:getCallsign() then local ABName = AB:getCallsign() local aCoa = AB:getCoalition() if aCoa == 1 then ABmanager("red",ABName) elseif aCoa == 2 then ABmanager("blue",ABName) end end end end timer.scheduleFunction(ABmanagerHandler, {}, timer.getTime() + 1) end local function deactivate() for coalition, bases in pairs(deactivateGroups) do for base, groups in pairs(bases) do for index, gName in pairs(groups) do if Group.getByName(gName) then local gSelf = Group.getByName(gName) local groupID = gSelf:getID() local gUnits = Group.getUnits(gSelf) --trigger.action.outText(mist.utils.tableShow(gUnits), 15) gPlayer = gUnits[1]:getPlayerName() local gPlayer = gSelf:getUnit(1):getPlayerName() trigger.action.outTextForGroup(groupID, gPlayer.." the airbase you are trying to take-off from is not in your coalition control", 15) --trigger.action.outTextForGroup(groupID, "The airbase you are trying to take-off from is not in your coalition control", 15) Group.getByName(gName):destroy() end end end end timer.scheduleFunction(deactivate, {}, timer.getTime() + 1) end function eHandler:onEvent(e) if e.id == world.event.S_EVENT_BASE_CAPTURED then if e.place then local airbase = e.place local aName = airbase:getCallsign() local aCoa = airbase:getCoalition() local aDesc = airbase:getDesc() local aCat = aDesc.category if aCat == Airbase.Category.AIRDROME then if aCoa == 1 then AB_Aerodromes['red'][#AB_Aerodromes.red + 1] = aName for i,v in pairs(AB_Aerodromes.blue) do if v == aName then table.remove(AB_Aerodromes.blue, i) end end elseif aCoa == 2 then AB_Aerodromes['blue'][#AB_Aerodromes.blue + 2] = aName for i,v in pairs(AB_Aerodromes.red) do if v == aName then table.remove(AB_Aerodromes.red, i) end end end elseif aCat == Airbase.Category.FARP then if aCoa == 1 then AB_FARPs['red'][#AB_FARPs.red + 1] = aName for i,v in pairs(AB_FARPs.blue) do if v == aName then table.remove(AB_FARPs.blue, i) end end elseif aCoa == 2 then AB_FARPs['blue'][#AB_FARPs.blue + 2] = aName for i,v in pairs(AB_FARPs.red) do if v == aName then table.remove(AB_FARPs.red, i) end end end end end end end ABmanagerHandler() deactivate() world.addEventHandler(eHandler) P-51D Airbase Capture V1.36.miz
-
Yes, we had a working version of the mission. I'll look for it and post it here. We also ran to the problem of what will happen when an airbase get REcaptured by the same coalition, the units would just spawn on the destroyed objects. To resolve this, we have removed the unit just before it should be destroyed and then created an explosion at the same location to show the effect as if the unit has been destroyed, it worked quite well, the only side effect is that you do not receive a unit destroyed and nothing in the statistics. This can be achieved by adding the message in the script that you have destroyed something.
-
I'm not sure how to catch the pilot object. To test I would run an event handler and print all the events out to show if there is a birth event for example after an ejection event. If that doesn't work, maybe run a searchObjects at the area where the ejection occurred right after the ejection event it cought - http://wiki.hoggit.us/view/DCS_func_searchObjects
-
Yes, editing the mission file in the miz file and saving a new miz file, as you probably know. There's no way that I know of currently using the DCS Scripting engine. About the dynamically added, it is being saved in the MIST DB - mist.DBs.dynGroupsAdded. There should be info there in order to get a save of the units, but I see that you answered that it does work with them. About static units, there is a way, I wrote it on the other thread, just look at my edit of Ian's online mission editor code - http://forums.eagle.ru/showpost.php?p=2184515&postcount=59 Check the files - doscript.txt and admintool.html (under the update_waypoints function). About the weather, see the answer above to Ian.
-
First of all, looks awesome! :thumbup: I will definitely try to use this to create an ongoing large scale mission, the only problem is that the number of participants needs to be limited in order to accommodate many moving ground units. A few questions - -Storing static objects as if they are dead or not, should not be that hard to add, will you be adding it later on? -Weather/time is an important addition as well, will you be adding it later on? -Coalition nationality could change from mission to mission, Russian could be blue USA could be red etc, does the russian side and USA have all the units? what if it is a Georgian Strela that is on the blue side? it means it would be respawned as a USA Strela on the blue side? I don't think that USA has a strela in the ME selection and it could cause issues. Would be wise to fix this. Now, here is a thought for resource management using this script. As we know, we have no control on the airfield resources, but what we do control is warehouses and warehouses resources that can be alive/dead. I would suggest to anyone using this script and wants to have an active resource system using the internal DCS resource system, to use warehouse buildings in the airfields/near the airfields/FARPS, and have 0 or very little resources at the airfields themselves. EDIT - Will this script also save the status of dynamically added units into the mission?
-
Grimes, would it be possible to add to mist.dynAdd the option to clone client planes? I added the following lines and they seem to work, but there's definitely better ways to do it - Line 631: if not unitData.skill then newGroup.units[unitIndex].skill = 'Random' [b]elseif unitData.skill == 'Client' and newGroup.clone then newGroup.units[unitIndex].skill = 'Random'[/b] end
-
Saving current mission situation and reloading in-game
xcom replied to SNAFU's topic in Mission Editor
Catch me whenever on the TS and I'll show you. -
Ok, I've seen something similar. The reason I guess is because the plane has no more tasking so it has RTbed. I'll have to add some checkup if the unit is not a client and it has no tasking and it's not airborne and it's speed is 0 it should be despawned.
-
Glad to hear it works well, there are definitely some issues to workout, if you find any, please describe them clearly and I'll see what I can do about it. About the expansions - 1. I can make a variable, right now it's just at line 52, change the number at the end of the line. 2. That would be a change in MIST it would mean adding a variable to a MIST function, something I would not want to be doing unless Grimes get's into the picture and adds support for this in some way. 3. What do you mean by ground garbage? AI planes that don't despawn?
-
Can you elaborate? I didn't understand you completely...
-
Send your mission and I can check. The script should work.
-
local function Illumination () local units = Group.getByName('test vehicle'):getUnits() if #units > 0 then local unit1pos = units[1]:getPosition().p trigger.action.illuminationBomb({x = unit1pos.x, y = unit1pos.y + 1000, z = unit1pos.z}) timer.scheduleFunction(Illumination, {}, timer.getTime() + 300) end
-
Change continues action to switched condition.
-
Did you give the planes waypoints? It should have spawned in an AI plane and it should of taken off using the waypoints that were set.
-
Saving current mission situation and reloading in-game
xcom replied to SNAFU's topic in Mission Editor
You do not have to actually use the mission planner for the save script, you can just load up the saved state and save the new miz file. -
Saving current mission situation and reloading in-game
xcom replied to SNAFU's topic in Mission Editor
It does as it says probably, outputs alive units to a file. Nowadays you have a live DB in MIST that holds alive units and refreshes faster. -
Saving current mission situation and reloading in-game
xcom replied to SNAFU's topic in Mission Editor
SLMOD does not save the mission situation AFAIK. There is Ian's Online Mission Planner, I worked with him back then to create exactly this script, but it is not working with MBot's loadfile but rather it saves a file which you then need to run through the Online Mission Planner in order to have the saved status working, so something like this would be very handy! Check the current post - http://forums.eagle.ru/showthread.php?t=121145&page=6 I also added save for static objects and updating warehouse status on page 6. -
Hi, Still WIP, but this script already works. This script checks if there are human players in their slots, if it doesn't recognize them as active, it will spawn AI flights with random skill instead. If the player jumps into a slot with an active AI flight, it will give the command to the AI flight to RTB. How to use it - 1. Load the edited MIST as initiator script or before the AutoAI script loads. 2. Load the AutoAI script. What it does - 1. Checks the alive units vs the mission editor units. 2. if less alive units then mission editor units, spawn missing units. 3. if more alive units then mission editor units, RTB the extra alive AI units. Notice that this needs the edited MIST in order to work, the edits in the MIST are - 1. dynAdd function, it recognizes client units and changes the skill to random, should be used only with mist.cloneGroup. 2. Fixed return table for any function that uses the dynAdd function. This script is mostly in order to get balancing in online servers, as sometimes missions are not balanced due to the amount of players in each coalition, the end goal of this script is to result this issue which will allow mission makers some freedom in the plane sets. Attachments - AutoAI_MIST.lua - the automatic AI flights script. mistv3_6_42_edited.lua - edited MIST 3.6.42. AutoAI_Test.miz - little mission for POC. As I said in the first line, this is still WIP, I'll update here as it gets along. If anyone has any thoughts on making this better, please by all means :) Xcom AutoAI_Test.miz mistv3_6_42_edited.lua AutoAI_MIST.lua
-
quick one - According to the documentation and to the MIST lua script, cloneGroup and respawnGroup should return a table of the group that is being created. When I tried it, it returns nil, anyone have any ideas? simple test - local nGroup = mist.cloneGroup("SU-27",1) trigger.action.outText(mist.utils.tableShow(nGroup), 10) Thanks in advance. EDIT - NVM, looks like in line 699 of the latest build, in dynAdd function it tries to - return newGroup.name changing it to - return newGroup will fix it.
-
I tried that before also, after searching a bit in the mission file. It doesn't work through the scripting engine, but you could create a script to edit the mission file in order to add the files correctly there - beats the cause though. I hope ED will put their efforts on opening more systems to the scripting engine, such as Ian mentioned, problems such as the ones in this thread are not so important in my opinion.