sunski34 Posted March 11, 2017 Share Posted March 11, 2017 (edited) 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). Edited March 11, 2017 by sunski34 Link to comment Share on other sites More sharing options...
ked Posted March 11, 2017 Author Share Posted March 11, 2017 Is there a way to get the C_AIUnit object resulting from the spawn ? Cause i'd like to assign a global variable to it Link to comment Share on other sites More sharing options...
sunski34 Posted March 11, 2017 Share Posted March 11, 2017 (edited) 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 Edited March 11, 2017 by sunski34 Link to comment Share on other sites More sharing options...
ked Posted March 11, 2017 Author Share Posted March 11, 2017 Ok i've been working all day on this, briefing and texts are in french but feel free to learn from it or even use it http://gamers-squad.fr/public/training%20V2.0.0.zip And thanks sunski you've helped a lot, next i want to introduce scenarios and diversify possible missions :) Link to comment Share on other sites More sharing options...
snowsniper Posted March 15, 2017 Share Posted March 15, 2017 WTF i've just read the whole thread. You're pushing ATME limits Ked ;-) :thumbup: for scenario further devellopement, I can share an experimental approach with ATME (still early Alpha so far), but I think it could be promising with a bit of cleaning and more work when I 'll have more time. here an experimental test for multiple SP scenario you can find here, if not yet discovered https://forums.eagle.ru/showpost.php?p=3070000&postcount=57 and an other one more basic with also the MP version in attachements. be aware my lua is noob level, but maybe the idea can help.scriptedmissiontest.miz i7-10700KF CPU 3.80GHz - 32 GO Ram - - nVidia RTX 2070 - SSD Samsung EVO with LG TV screen 40" in 3840x2150 - cockpit scale 1:1 - MS FFB2 Joystick - COUGAR F16 throttle - Saitek Pro Flight Rudder Pedals Link to comment Share on other sites More sharing options...
Recommended Posts