Jump to content

[NEW Script] Advanced Tools for Mission Editor


sunski34

Recommended Posts

New Version V1.0.9 : auto respawn and patrol

 

Hi,

 

today a new release of ATME V1.0.9, see here for détails and download : https://forums.eagle.ru/showpost.php?p=3001608&postcount=1

 

I will update documentation as soon as possible (French and English).

 

Examples of new ATME_C.Group functions :

 

local troops, nb = ATME.C_Group.getGroupsInDCSZoneForCoalition("BLUE", "LoadingZone", false, "GROUND")

 

The last parameter is filter (here "GROUND") : it is optional or can be set to "ALL", "GROUND", "AIRPLANE", "HELICOPTER" or "SHIP"

Those kind of functions now return groups (a list of ATME.C_GROUP instances, here a list of troops) and number of groups.

 

group:setAutoRespawn(2)

 

Parameter 2 is rules and represents a delay (number or string with specific format) to before respawn, and it is optional. Of course random time exists, you will see that in future documentation. auto respawn respawn a group after its destruction or desactivation. It must be set after each creation. It's possible to reset it at anytime.

 

group:setPatrol("BeginPatrol", "EndPatrol")

 

setPatrol set a patrol between two points defined by their name or number, same number than id in Mission Editor. An optional parameter stopCondition (string with specific format) will stop patrol under certain conditions (nb of turns, time or random). We will have more informations in documentation. Of course, resetPatrol exists too.

 

You can now use duplicateFormMissionDatas with only one parameter to prepare the same group to be spawned. You can use that function with original groups, defined in mission if that group has been destroyed (or desactivate) before.

 

And, finally, onCreateGroup Handler now accepts a new parameter called alreadyDeleted, so you know when a new group is created if it was already dead before in mission :

 

local function onCreateGroup(_group, _alreadyDeleted)
   if string.sub(_group:getName(), 1, 6) == "troops" then
-- The troops have to be ready to board, if not, troops cannot be embark !
	
       _group:changeReadyToBoard(true)
_group:setAutoRespawn()
   elseif _group:getName() == "H1" then
_group:setPatrol("BeginPatrol", "EndPatrol")
_group:setAutoRespawn(2)
_group:setWaypointsTracking(true)
	
local unit = _group:getFirstUnit()
	
unit.modules[moduleName].onEarth = true
unit.modules[moduleName].alreadyBoarding = false
unit.modules[moduleName].index = 0
	
if _alreadyDeleted == true then
	local troops, nb = ATME.C_Group.getGroupsInDCSZoneForCoalition("BLUE", "LoadingZone", false, "GROUND")
	thisModule:output("Nb troops on zone = " .. nb, 1)
	if nb == 0 then
		_group:resetPatrol()
		ATME.setFlag(1, true)
		ATME.setFlag(2, true)
	else
		ATME.setFlag(1, false)
		ATME.setFlag(2, false)
	end
else
	ATME.setFlag(1, false)
	ATME.setFlag(2, false)
end
	
ATME.displayForAll("Transport unit " .. unit:getName() .. " ready",5)
   end
end

 

I put a small mission here you can destroy troops and transport helicopter. See what happen !

 

Note : A problem with DCS event S_EVENT_LAND when using task "land" make my script more complex. S_EVEN_TAKEOFF works in that case.. Strange !

 

Enjoy ATME

Sunski

test AI transport respawn.miz

ATME_AItransport_respawnV2.lua


Edited by sunski34
Link to comment
Share on other sites

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


Edited by sunski34
Link to comment
Share on other sites

  • 2 weeks later...

New major version V.1.1.0

 

Hi,

 

today, a new version of ATME V1.1.0. This version has some important changes like :

 

-> Optimizations of ATME.C_F10Menu and some critical modifications (see below)

-> Modifications on Zone 2D : now new classes ATME.C_Ring and ATME.C_Circle (and in future version ATME.C_Polygon). All that new classes can be used in "Zone2D" functions (like player:isInZone2D). Old syntax with center and radius, limited to circles, isn't supported anymore.

-> Event Core "SPAWN_GROUP" has been removed to prepare new versions. Now a new callback has been create onSpawnGroupCallbackHandler.

 

You can see all news here : https://forums.eagle.ru/showpost.php?p=3001608&postcount=1

 

Management of F10 menus changes like this :

 

player:getF10MenuRoot() 

becomes now

player:getF10MenuRoot(thisModule) 

where thisModule is the instance of your module.

 

ATME.C_F10Menu(player, label, parent)

to create a submenu in parent menu/submenu.

 

You can optimize when create a submenu in root F10 menu :

 

local menu = player:getF10MenuRoot(thisModule)
local subMenu = ATME.C_F10Menu(player, "My submenu", menu)

can be written like this :

local subMenu = ATME.C_F10Menu(player, "My submenu", thisModule)

You can find ATME_module1e example below.

 

I join lua code and mission for spawn Handler too , and below example :

 

local newHandlers = {
       onCreatePlayerHandler = onCreatePlayer,
       onDeletePlayerHandler = nil,
       onUpdatePlayerHandler = onUpdatePlayer,
       onTakeoffPlayerHandler = nil,
       onLandingPlayerHandler = nil,
       onStartEnginePlayerHandler = nil,
       onStopEnginePlayerHandler = nil,
       
       onCreateAIUnitHandler = nil,
       onDeleteAIUnitHandler = nil,
       onDisableAIUnitHandler = nil,
       onTakeoffAIUnitHandler = nil,
       onLandingAIUnitHandler = nil,
       onStartEngineAIUnitHandler = nil,
       onStopEngineAIUnitHandler = onUnitStopEngine,
       
       onCreateGroupHandler = nil,
       [b]onSpawnGroupHandler = onSpawn,
[/b]        onDeleteGroupHandler = nil,
       onDisableGroupHandler = nil,
       
       onCreateStaticObjectHandler = nil,
       onDeleteStaticObjectHandler = nil,
   
       onTimerHandler = nil,
       onModuleStartHandler = nil,
}

and onSpawn function example :

 

local function onSpawn(group)
   local player = ATME.C_Player.getByName("Pilot #002")
   player:display("Spawn group ".. group:getName(),5)
   if group:getName() == "new A10A" then
       local unit = group:getFirstUnit()
       
       while unit ~= nil do
           local name, id1, id2 = unit:getCallsign()
           if name ~= nil then
               
               if id1 ~= nil then -- Blue coalition
                   player:display("Callsign spawn " .. unit:getName() .. " = " .. name .. " " .. id1 .. "-" .. id2, 5)
               else -- Red coalition
                   player:display("Callsign spawn " .. unit:getName() .. " = " .. name, 5)
               end
           end
           unit = group:getNextUnit()
       end
   end
end

onSpawnGroupHandler is called after onCreateGroupHandler. So all is initialized, and you can of course change route for example. Note that functions like setRoute need a delay when new DCS group is created. onSpawnGroupHandler is the best way to do that, onCreateGroupHandler not (called too early after DCS group creation so the route change may not work, I will optimise that in future version).

 

ATME_Rescue has been updated too for compatibility.

 

So, do not forgot to modify your code if necessary. If not, you will have ATME errors.

 

Documentation will be updated soon.

 

Enjoy ATME

Ask me for any question.

 

Sunski34

test new spawn A10A.miz

ATME_spawnA10A basic.lua

ATME_module1e.lua

ATME_module1e.miz


Edited by sunski34
Link to comment
Share on other sites

thank you so much for all the hard work.

looks like a major step in ATME

:thumbup:

 

 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

Hi,

 

today a new version of ATME. This version fixed some problems but the more important is that ATME.C_Polygon class has been implemented.

 

Now, you can create non crossed polygons, add them to areas, test if unit or other references are inside. A polygon can be defined with points (2D ou 3D) or center of DCS zones or mix of them.

 

You can get a random position in the polygon.

 

Of course, isInZone2D function of ATME.C_Group, ATME.C_AIUnit or ATME.C_Player, getGroupsInZone2DForAll or getGroupsInZone2DForCoalition class function of ATME.C_Group class now support polygons.

 

ATME.C_Area class offers new functions like getInsideZones which return zones where a reference as a unit for example is.

 

You can get areas by their name (see example mission and lua file below) or get a zone in an area by its name.

 

English documentation has been updated with a lot of corrections in the reference part (classes and functions descriptions).

 

You can now create ring with a DCS Zone and a delta radius (if negative radius of DCS Zone is external limit, if positive, radius of DCS Zone is internal limit).

 

Enjoy ATME and have fun ;)

 

Sunski

ATME_ZoneTest.lua

test zone.miz


Edited by sunski34
Link to comment
Share on other sites

Spawn infantry and rescue group : embark/disembark

 

Hi,

 

here is a new small mission using ATME_Rescue.lua standard module. This module supports French and English messages for F10 menus. In that case, ATME starts in English.

 

This mission has 2 clients helicopters (you can add more if you want), multiplayer compatible of course.

 

2 infantry groups has been created too, "rescue 1" and "origin". "origin" is late activation because it is spawned as "rescue 2" group when ATME starts.

 

2 DCS zones one for the pickup zone "myZone" and one for the spawn zone "spawnZone". So "rescue 2" is spawned somewhere in zone "spawnZone".

 

If you look at triggers, you will see that ATME generic modules ATME_CoreV111.lua and ATME_Rescue.lua are loaded. Then ATME_testRescue.lua, the mission module is loaded.

 

When starting mission, you will see a F10 submenu "Personnel carrier". Then inside an item "Load group" to load a group.

 

A group can embark only if :

  • it's an infantry group only
  • the distance between group and helicopter is less than 200m
  • the group is ready to board

A group is ready to board when :

  • using changeReadToBoard(true) function of ATME.C_Group
  • using setPickupZone(zoneName, random) function of ATME.C_Group like in this mission (see lines 38 to 43 in ATME_testRescue.lua file) :

local function onCreateGroup(_group)
   if _group:getName() == "rescue1" or _group:getName() == "rescue2" then
       _group:setPickupZone("myZone", 0.7)
       _group:setSignal(200, "SIGNAL_SMOKE RED")
       _group:setWaypointsTracking(true)
   end
end

in fact just the function above is necessary for embark/disembark.

 

the function setSignal of ATME.C_Group is useful to activate a smoke if helicopter is less then 200m in that case (but you can change it of course). If several groups have the same pickup zone and signal activated too, only one smoke is fired until at a time. If group is destroy or loaded, another group then fire new smoke. You can fire flares too.

 

 

Be careful, the route of the infantry groups have to pass through the pickup zone like in this mission.

 

You will see that waypoint tracking is activated... messages will appear when groups pass waypoints. You can delete the line 42 to desactivate waypoint tracking

 

This function below is just necessary to send messages when groups pass waypoints :

 

local function onTimer(events)
   for _id, _ in events:pairs() do
       if events:isCoreEvent(_id) == true then
           thisModule:output(events:getCoreEventType(_id), 1)
           if events:getCoreEventType(_id) == "TRACKING_WAYPOINT" or events:getCoreEventType(_id) == "TRACKING_LAST_WAYPOINT" then
               local datas = events:getCoreEventDatas(_id)
               if events:getCoreEventType(_id) == "TRACKING_WAYPOINT" then
                   thisModule:output("Group " .. datas.group:getName() .. " passe au waypoint..." .. datas.idWaypoint,1)
               else
                   thisModule:output("Group " .. datas.group:getName() .. " est au dernier waypoint...",1)
               end
               local pos = datas.point
               
               if ATME.isPoint(pos) ~= POINT_BAD then
                   local lat, lon, alt = ATME.convertPointToLL(pos)
                   local dirlat, dlat, mlat, slat = ATME.convertToDMS(lat, false)
                   local dirlon, dlon, mlon, slon = ATME.convertToDMS(lon, false)
                   local dirtextlat = "E"
                   if dirlat == -1 then
                       dirtextlat = "W"
                   end
                   
                   local dirtextlon = "N"
                   if dirlon == -1 then
                       dirtextlon = "S"
                   end
                   thisModule:output("lon = " .. string.format("%s%02d.%02d.%02d", dirtextlon, dlon, mlon, slon) .. "\nlat = " .. string.format("%s%03d.%02d.%02d", dirtextlat, dlat, mlat, slat), 1)
               end
           end
       end
   end
end

So now, start the mission, take an helicopter. Wait groups stop, then they are ready to board. F10 "Personnel carrier" then "Load group". You can load several groups depending of their nb of units (see doc for further informations, load fonction of ATME.C_Player class). You can load a second group if you want. Then after message "Group xxx on board", you will see 2 menu items "Unload rescue 1" and "Unload rescue 2", choose the group to disembark...

 

That all, then the groups cannot be reload and follow their route because they aren't ready to board. Of course you can set that again by script.

 

If you want to test more, put groups, dcs zones "myZone" and "spawnZone" in another place, not too far, augment the radius of signal zone to 5000 (5km). the distance between groups and helicopter must be > 5km if you want to see when the smoke starts. If less, the smoke starts when helicopter takes off. It's the same if you take off before boarding groups in my mission.

 

 

Hope that help.

Enjoy ATME

Sunski

ATME_testRescue.lua

test newRescue.miz


Edited by sunski34
Link to comment
Share on other sites

Litte mission example with sounds

 

Hi,

 

please find a little mission. The ATME_SoundInAreas lua script contains all sounds to be played.

 

Each sound file (and duration of the sound) is associated to a key in myAreas table. That key is the name of a DCS Zone defined in mission, here Z1 and Z2 like this :

 

local myAreas = {
["Z1"] = {
	file = "fifteen.ogg",
	duration = 2,
},
["Z2"] = {
	file = "thousand.ogg",
	duration = 2,
},
}

 

You have a sound file when out of zone :

 

local outOfArea = {
file = "squelsh.ogg",
duration = -1,
}

 

if duration is 0 or less than 0, the sound file is played once. To have no sound, you have to create a sound file with no noise, and put duration to 0 or less. Here you will ear squelsh once.

 

You can change the files of course.

 

Finally, see mission for DCS 1.5 , ME, triggers.. all sound files have to load in mission.

 

You can add players and run mono or multiplayer ;)

 

Of course, other module like rescue can be used.

 

Have fun

 

sunski

ATME_SoundInAreas.lua

soundInAreas_model.miz


Edited by sunski34
Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

ATME V1.2.0 is in test. Some classes et functions are going to change a little bit to be more efficient and a lot of optimizations or bug fixed has been done.

 

When this version is ready to be published, with its documentation and examples up to date, I will help people who have problems between old versions and last one if needed.

 

Enjoy ATME

Sunski

Link to comment
Share on other sites

  • 2 months later...

Hi,

 

I'm pleased to upload today the new ATME V1.2.0 version : https://forums.eagle.ru/showpost.php?p=3001608&postcount=1

 

This version has a lot of new functions.

 

A lot of tests have been done and all manual examples or Other examples below are fully fonctionnal.

 

Please note that several functions of V.1.0.X or V1.1.X were modified so be careful. Use only new examples after this release.

 

Here is the new English manual : https://forums.eagle.ru/showpost.php?p=3001613&postcount=2

and the manual examples : https://forums.eagle.ru/showpost.php?p=3001614&postcount=3

 

Ask me for any problem or older version migration.

 

have fun with ATME

 

Sunski

Other examples.zip


Edited by sunski34
Link to comment
Share on other sites

  • 5 months later...

Hi,

 

today a new release of ATME, V1.3.0.

 

Actually, manual examples have been update but not reference manual. I will update it during next weeks.

 

Several functions have been modified so, be careful.

 

Many bugs fixed. Add advance sound capabilities, advance route setting, add target detection and tracking capabilities

 

Ask me for any problem.

 

Here the link for download and manual examples : https://forums.eagle.ru/showpost.php?p=3001633&postcount=1

 

Have fun with ATME.

 

Sunski

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

Today a new version of ATME V1.3.1. Some issues are fixed. You can download two new examples :

 

  • A sound management example with Text to speach
  • A tags management example which explains how to use a laser spot with a drone

 

Ask me if questions.

 

Here the link for download and manual examples : https://forums.eagle.ru/showpost.php?p=3001633&postcount=1

 

Have fun with ATME.

Sunski


Edited by sunski34
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

Hi,

 

today a new release of ATME, V1.4.0.

 

A lot of tests have been done on DCS 2.5 and now ATME is ready for setting task to groups ou routes (waypoints). You can download new examples and full spawing training mission (M2000C vs SU 27 AI).

 

Several functions have been modified so, be careful.

 

English documentation will come soon.

 

Ask me for any problem.

 

Here the link for download and manual examples : https://forums.eagle.ru/showpost.php?p=3001633&postcount=1

 

Have fun with ATME.

 

Sunski


Edited by sunski34
Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

today a new version of ATME. We started some optimizations and add new functionnalities like tasks extended to ATME 2D Zone, very useful for JTAC by example. You will find 2 new examples using that new functionnality in "Other examples" zip file.

 

Here is the link : https://forums.eagle.ru/showpost.php?p=3001608&postcount=1

 

Enjoy ATME ;)

Sunski

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

Today a new release of ATME, V1.4.3. Two new examples using ATME.C_Route class for ground vehicles. Those mission use F10 marks too (creation and remove).

 

Those missions are ATME.newRoute.miz and ATME.newRouteFullSpawn.miz. So WP action (off road, on road etc...) are now functional.

 

Link : https://forums.eagle.ru/showpost.php?p=3001608&postcount=1

 

Enjoy ATME ;)

 

Sunski


Edited by sunski34
Link to comment
Share on other sites

I appreciate the written manual and how you laid it out so all the commands are listed with an example if I browsed it correctly I wish all the me addon would do such as well as a. Updated manual for me. I wasn’t a user long enough to to automatically translate the old info in the manual to its current position

BlackeyCole 20years usaf

XP-11. Dcs 2.5OB

Acer predator laptop/ i7 7720, 2.4ghz, 32 gb ddr4 ram, 500gb ssd,1tb hdd,nvidia 1080 8gb vram

 

 

New FlightSim Blog at https://blackeysblog.wordpress.com. Go visit it and leave me feedback and or comments so I can make it better. A new post every Friday.

Link to comment
Share on other sites

Hi,

 

today a new version of ATME V1.4.4.

This version fixes some bugs and adds new optimizations.

 

You can change original version of ATMECore in all examples with this new one. I will modifiy manual examples with the new delete handler syntax ASAP.

 

More informations and link here : https://forums.eagle.ru/showpost.php?p=3001608&postcount=1

 

Enjoy ATME ;)

Sunski


Edited by sunski34
Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

teaser : New V146 translated in English manual available soon ....

 

V146 is very powerfull and mature....

 

Snowsniper

alpha and (beta) tester and pround ATME user

 

 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

  • 1 year later...
  • Recently Browsing   0 members

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