Jump to content

CAP not following flight plan


ked

Recommended Posts

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 by sunski34
Link to comment
Share on other sites

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 by sunski34
Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...