

sunski34
Members-
Posts
753 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by sunski34
-
Late activation units, stay active in the background?
sunski34 replied to Knock-Knock's topic in Mission Editor
There's no real solution I think actually. If you spawn, you can have little DCS freeze sometimes. If you have late activation groups, no freeze when activate. Sunski -
Late activation units, stay active in the background?
sunski34 replied to Knock-Knock's topic in Mission Editor
Hi, I found in my experience (developping a lua Framework), that late activate groups are created immediatly when mission starts because DCS send a lua DCS event BIRTH. They seem to be invisible (this for grounds units) but present and of course freezed. For example, other ground units turn around a late activation group. When you desactivate, unit (or group) is destroyed from the mission, DCS send a lua event DEAD. So it may have an impact even if this might be light. -
Yes, spawn returns err and name of the new group if err == false. But be careful : The group may not exist at this time, DCS can take time to create it. The best way is to use ATME core event "GROUP_SPAWN", so you can catch it in your function onZonePass like other core event, but in that case new spawn group will be in datas.group variable. if typeEvent == "AREA_AIRCRAFT_ENTERS" then local datas = events:getCoreEventDatas(_id) -- player is in datas.unit variable -- area is in datas.area variable .... elseif typeEvent == "GROUP_SPAWN" then local datas = events:getCoreEventDatas(_id) local newSpawnedGroup = datas.group .... end Units of the group have been remaned too, you can find it in french documentation p171 : "SpawnUXXXXX-" follows by its original name. XXXXX is a number. So in a group, for its units, you just have to find "-" with string.find lua function then take the sub string from this position + 1 (position is position or "-" in the string) to the end of the string and compare with original name. You can of course, list all units of a group with group:getFirstUnit(), group:getNextUnit() until nil, and for each unit, get its name : local unit = group:getFirstUnit() while unit ~= nil do local name = unit:getName() local d,f = string.find(name, "-") local originalName = string.sub(name, f + 1, name:len()) unit = group:getNextUnit() end Sunski
-
hi ked, local err, var1 = ATME.C_GroupSpawnDatas.duplicateFromMissionDatas(......) if err == false then var1 is an ATME.GroupSpawnDatas instance which represents units in mission datas you want to spawn. spawn is a function of that class too. if err == true then var1 is error code you can find that in documentation. of course you can change its name. But you can't assign variables modules[xxxx] to that object. You can do that just for ATME.C_Group , ATME.C_Player or ATME.C_AIUnits. That's all classes wich accept such variables. Normally those variables are created to pass values between modules, or to Mission Editor trigger using scripts directly (example: a new function you created).
-
it has to work with for _i = 1, #ATME.modules[moduleName].areas do too it's the same #ATME.modules[moduleName].areas = 8
-
If you want help on ATME script, do not hesitate here is a video : you will see abilities on embark/disembark at 1:56s Sunski
-
In my loop modulesName is bad, it's moduleName, moduleName is a global variable : so for _i = 1, #ATME.modules[modulesName].areas do and forward must be modified with moduleName (no s between module and Name) ; for _i = 1, #ATME.modules[moduleName].areas do Then that works. modulesName is not a defined variable so, that's why the loop didn't work. It's a lua problem, so be careful with that. onTimer is a function callback by a timer so no error in that case too. I modified my answer : https://forums.eagle.ru/showpost.php?p=3074739&postcount=13 Hope that helps Sunski
-
Yes, documentation is not complete for spawn function : var1:spawn("Bravo 1") In that case spawn a group somewhere in DCS zone 'Bravo 1' var1:spawn(area) If area is an instance of ATME.C_Area then spawn somewhere in the area (even if area has several zones defined). So you can spawn at a point, somewhere in a DCSZone or somewhere in a defined area. For your second problem with loop, strange, can you send me your mission and lua file. Did you try display outside the loop ? You have to see message when player enters area (just enters not in area, state change)
-
That doesn't work good actually. and there's a bug report on that. So, I think you have to use a script if you want to do embark/disembark. CTLD or ATME will be good depending of what you want to do. ATME has a dynamic troops boarding. CTLD has other abilities.
-
I see another problem with : var1:spawn(ATME.modules[modulesName].areas[i].spawn) That isn't good. Replace with : var1:spawn(ATME.modules[modulesName].areas[i].area) if you want to spawn anywhere in the area (random in all DCSZones defined in an area) except if you want to spawn in DCSZone called ATME.modules[modulesName].areas.spawn, that's isn't the same ! More information : If you don't need to know really the area, you can delete the loop and use directly datas.area like this : var1:spawn(datas.area) see here : https://forums.eagle.ru/showpost.php?p=3073466&postcount=11 in that thread
-
Hi, I see ... You have to initialize your module variables (areas) before creating player. As I said, init function (linked with onStartHandler) will be called twice, once before players initialized (for player in cockpit at start of mission, at least one) and once after. So, you have to change : if areUnitsAndPlayersInitialized == true then in if areUnitsAndPlayersInitialized == false then then your variables will be initialized before onCreatePlayer will be called. To understand, let me explain a little bit how that works in lua: When starting a mission, there's two possibilities with players : Players who are already in mission when ATME starts. So in that case, onCreatePlayerHandler will be called during the start of ATME Players who will enter DCS later, so of course, nothing is done when ATME starts. But, onStartHandler may help you to prepare some necessary code (depending of what you want to do) and in that case two possibilities : If what you do in your code is necessary for all players and units (example specific variables), and will be used in onCreate...Handler (AIUnit, Player or Groups), you have to set them before players and AI units initializations so onStartHandler areUnitsAndPlayersInitialized parameter will be test to false. If what you do in your code is not necessary for onCreate...Handler or need players and AI Units to be initialized, then, no problem, onStartHandler areUnitsAndPlayersInitialized parameter will be test to true. Of course you can do a mix.
-
Hi ked, Your onZonePass function callback have to be changed to an onTimerHandler, no needs to use onUpdatePlayerHandler in that case because event core for areas have player (or AI unit) instance in their datas. So : -- MAIN do local newHandlers = { onCreatePlayerHandler = onCreatePlayer, onDeletePlayerHandler = nil, onUpdatePlayerHandler = nil, onTakeoffPlayerHandler = nil, onLandingPlayerHandler = nil, onStartEnginePlayerHandler = nil, onStopEnginePlayerHandler = nil, onCreateAIUnitHandler = nil, onDeleteAIUnitHandler = nil, onDisableAIUnitHandler = nil, onTakeoffAIUnitHandler = nil, onLandingAIUnitHandler = nil, onStartEngineAIUnitHandler = nil, onStopEngineAIUnitHandler = nil, onCreateGroupHandler = nil, onDeleteGroupHandler = nil, onDisableGroupHandler = nil, onCreateStaticObjectHandler = nil, onDeleteStaticObjectHandler = nil, onTimerHandler = onZonePass, onModuleStartHandler = init, } thisModule = ATME.C_Module(moduleName, newHandlers, true) end You have an example of using events for entering and leaving areas here : https://forums.eagle.ru/showpost.php?p=3069903&postcount=55 You just have to change setAircraftsGroupTracking by setAircraftTracking as explained above. For your areas I suggest you to put them in a table in onStartHandler but do not forgot the parameter. This callback is called twice when ATME starts : Once before units and players initialized, in that case parameter will be false, Once after, parameter is true. So if you don't use the parameter, your code will be executed twice. So : local function init(areUnitsAndPlayersInitialized) -- Do not forgot parameter onStartHandler if areUnitsAndPlayersInitialized == true then --players and units mission datas are initialized ATME.modules[moduleName].areas = {} ATME.modules[moduleName].areas[1] = { area = ATME.C_Area(), name = "Bravo", } ATME.modules[moduleName].areas[1].area:add("Bravo 1") ... ATME.modules[moduleName].areas[2] = { area = ATME.C_Area(), name = "Charlie", } ATME.modules[moduleName].areas[2].area:add("Charlie 1") ... ... end end in onCreatePlayer callback function, add : -- Link player and areas ATME.modules[moduleName].areas[1].area:setAircraftTracking(player) ATME.modules[moduleName].areas[2].area:setAircraftTracking(player) ... -- for all your areas then in onZonePass add code below (now only one parameter because onTimerHandler). To find the good area then do a loop. So, finally : local function onZonePass(events) for _id, _ in events:pairs() do if events:isCoreEvent(_id) == true then local typeEvent = events:getCoreEventType(_id) if typeEvent == "AREA_AIRCRAFT_ENTERS" then local datas = events:getCoreEventDatas(_id) -- player is in datas.unit variable -- area is in datas.area variable local player = datas.unit -- loop on your areas here when player enters a zone for _i = 1, #ATME.modules[moduleName].areas do if ATME.modules[moduleName].areas[i].area == datas.area then if ATME.modules[moduleName].areas[i].name == "Bravo" then -- Code when player enters Bravo Area elseif .... -- Test other area names and add specific code end end end elseif typeEvent == "AREA_AIRCRAFT_LEAVES" then local datas = events:getCoreEventDatas(_id) -- player is in datas.unit variable -- area is in datas.area variable local player = datas.unit -- loop on your areas here when player leaves a zone for _i = 1, #ATME.modules[moduleName].areas do if ATME.modules[moduleName].areas[i].area == datas.area then if ATME.modules[moduleName].areas[i].name == "Bravo" then -- Code when player leaves Bravo Area elseif .... -- Test other area names and add specific code end end end end end end end events parameter of onTimer callback function (or onZonePass in your case) contains all core events and user trigger events which has been fired by ATME since last timer trigger. It's a particular table. Of course, if player (or AI unit or group) has been killed or desactivated since the last call, the core event isn't in the table anymore ; in that case, core event has been delete. All core events have a player, an AI unit or a group in theirs datas depending of their type. If unit (player or AI unit), you may test if unit is ATME.C_Player or ATME.C_AIUnit in your code if necessary, in your case all units are players, so no test. Note that instances of ATME.C_Area class will have their own name in next version to find directly an area by its name, so, that will be easier soon. Of course, in documentation, you will find functions using core events and ATME.C_Area class. And you can find French doc p54, English doc p51, the Module 4 which explains how to use Core events. My answer is just a example of a particular Core event Sunski.
-
Concerning polygons, yes ATME doesn't support it actually. The problem is spawning surely a group inside a complex polygon. ATME can work with MIST but with MOOSE I don't know. I understood in Mist lua code that Mist tries random several times and test if point is inside a polygon. I know it's possible to be sure that random point will be in complex polygon but code isn't easy and needs a lot of tests. Concerning lags, when you spawn groups you can have lags, not at each time but sometimes. There's no link between lags and menus. So lags is not an ATME problem (if you only have 3 players), but I'm interesting to have your DCS log file to be sure. Of course having more ram is better. Concerning your code : ATME has ATME.C_Area class which can help you to simplify your code. You can create several areas, each area can include several DCS zones. link here https://forums.eagle.ru/showpost.php?p=3039210&postcount=42 So for example : if (player:isInDCSZone("Bravo 1") == true or player:isInDCSZone("Bravo 2") == true or player:isInDCSZone("Bravo 3") == true or player:isInDCSZone("Bravo 4") == true or player:isInDCSZone("Bravo 5") == true or player:isInDCSZone("Bravo 6") == true) and player.modules[moduleName].coalitionName == "BLUE" then can be replace by : local bravoArea = ATME.C_Area() bravoArea:add("Bravo 1") bravoArea:add("Bravo 2") bravoArea:add("Bravo 3") bravoArea:add("Bravo 4") bravoArea:add("Bravo 5") bravoArea:add("Bravo 6") if player:isInArea(bravoArea) == true and player.modules[moduleName].coalitionName == "BLUE" then bravoArea can be a player, global or local variable of course. Another possibility is to link player (or player group) and area , link here :https://forums.eagle.ru/showpost.php?p=3069903&postcount=55 This can be done in onCreatePlayer function for example : local bravoArea = ATME.C_Area() bravoArea:add("Bravo 1") bravoArea:add("Bravo 2") bravoArea:add("Bravo 3") bravoArea:add("Bravo 4") bravoArea:add("Bravo 5") bravoArea:add("Bravo 6") -- Link player and area bravoArea:setAircraftTracking(player) and in your function onZonePass just use events parameter : for _id, _ in events:pairs() do if events:isCoreEvent(_id) == true then local typeEvent = events:getCoreEventType(_id) if typeEvent == "AREA_AIRCRAFT_ENTERS" then local datas = events:getCoreEventDatas(_id) -- player is in datas.unit variable -- area is in datas.area variable local player = datas.unit player:display("Player " .. player:getPseudo() .. " in Bravo zone", 5) elseif typeEvent == "AREA_AIRCRAFT_LEAVES" then local datas = events:getCoreEventDatas(_id) -- player is in datas.unit variable -- area is in datas.area variable local player = datas.unit player:display("Player " .. player:getPseudo() .. " leaves Bravo zone", 5) end end end I didn't test that code above but I think it works if I didn't make stupid mistake ;) So you have several possibilies to simplify your code using ATME.C_Area class, even if you want to spawn in a area you can use : datas:spawn(bravoArea) So ATME.C_Area class is not completly finished but I'm sure it's the best way to do what you want. Hope that help ! Sunski
-
[NEW Script] Advanced Tools for Mission Editor
sunski34 replied to sunski34's topic in Mission Editor
Hi, today, english documentation as been updated to V1.0.11. see here :https://forums.eagle.ru/showpost.php?p=3001613&postcount=2 Enjoy ATME Sunski -
Hi, actually, ATME doesn't change tasks defined in Mission Editor. You cannot assign new tasks with ATME too (except indirect task full managed by ATME like waypoint tracking or managing boarding/unboarding units). Those abilities are in the roadmap for the future (no release date). My priority is to stabilize actual lua code, finalise basics abilities and leave beta version. If you want to assign or modify specific tasks, you have to define or modify them in Mission Editor only (like explained above). When you spawn a group with ATME, you can assign route of another group. So in ME you can create desactivated group with route correctly defined (with good tasks) and assign this route to another group. Hope that help Sunski
-
Bonjour, ce jour un correctif V1.0.11 pour un bug quand un aéronef décolle d'un porte-avions ou d'un bateau avec un hélipad. Pas d'autre changement. Sunski
-
Hi ked, new release V1.0.11 : fixed the bug. link here : https://forums.eagle.ru/showpost.php?p=3001608&postcount=1 Thank you for your return Sunski.
-
[NEW Script] Advanced Tools for Mission Editor
sunski34 replied to sunski34's topic in Mission Editor
Hi everybody, today a patch V1.0.11 fixed a bug when aircraft starts form aircrafts carrier or boats with helipad. Enjoy ATME Sunski -
Hi ked, Ok I'am agree, thee's a issue when player airplane starts on Aircrafts carrier. I will see that and fixed it ASAP. Thank you for your return. Sunski
-
Hi, I never test that case (just having ATME Core) because you must have your own module script after ATME Core (at least one). So if I find the same problem I will add what is necessary in ATME Core to have no problem. I will tell you if I confirm that issue and will fixed ASAP. If you want to try, download ATME_basicmodel.lua here https://forums.eagle.ru/showpost.php?p=3001608&postcount=1 and had it after ATME Core using clone. See image below and replace ATME_HelloWorld.lua by ATME_basicmodel.lua which does nothing. That should work. here a short video : Hope that help. Sunski
-
ATME don't do and will not do that. As I said, I think the best way is to read ATME documentation, you will see ATME abilities. After if you have specific questions tell us. Sunski
-
Bonjour, une nouvelle version d'ATME a été publiée, ajoutant à la classe ATME_Area le suivi d'entrée/sortie d'aéronefs ou groupes d'aéronefs. Voir la première page de ce thread pour le détail, le lien de téléchargement et la documentation en français déjà à jour en V1.0.10 N'hésitez pas si vous souhaitez vous lancer ou si vous avez des questions. Sunski
-
Hi, yes of course, object:getName() does that. But the best way, is to look french documentation here :https://forums.eagle.ru/showpost.php?p=3001633&postcount=1 This works for groups and static objects too. You can find object form its name with ATME.C_Group.getByName(name) for groups, ATME.C_AIUnit.getByName(name) for AI units and ATME.C_Player.getByName(name) for players. You have lot of functions like positions, altitude, relative positions (isNear, crossAxisFromLeftToRight etc..), fire flares & smokes, load/unload troops in personnel carrier , attributes (isSam, isAirplane) for AI units or groups, etc.... For polygon, not yet, but i'm working on it. So I hope soon. Sunski
-
[NEW Script] Advanced Tools for Mission Editor
sunski34 replied to sunski34's topic in Mission Editor
English documentation will be updated soon.You can find french informations and documentation here : https://forums.eagle.ru/showpost.php?p=3001633&postcount=1 Sunski -
[NEW Script] Advanced Tools for Mission Editor
sunski34 replied to sunski34's topic in Mission Editor
Hi, today a new version of ATME with new area abilities (V1.0.10). Now, the ATME.C_Area have 4 new functions to track Aircraft unit or aircrafts group when entering an leave an area. 4 new ATME core events have been created : "AREA_AIRCRAFT_ENTERS" and "AREA_AIRCRAFT_LEAVES" for Aircraft unit (AIUnit or player). Their datas are unit and area "AREA_AIRCRAFTS_GROUP_ENTERS" and "AREA_AIRCRAFTS_GROUP_LEAVES" for aircrafts group. Their datas are group and area. Here is attached a new mission with one group of three AI. Enjoy ATME. Sunski. test Area.miz ATME_Area.lua