Jump to content

[ATME] Comments and remarks


sunski34
 Share

Recommended Posts

Hi,

 

i begin this post :)

 

I can spawn A/S unit (severals BTR-80) but not an airborn aircraft using this:

local spawnAA

spawnAA = function(args)

local player = args[1]

local err, ng = ATME.C_GroupSpawnDatas.duplicateFromMissionDatas("M-2000", "M-2000" .. "_" .. player:getPseudo())

if err == false then

ng:spawn("BravoZone")

player:display("Le groupe AA" .. ng:getName() .. " est en route",20 )

else

player:display("Erreur en créant le groupe!!!",20 )

end

end

 

err is False but NG is nil, any idea (simple groupe with 1 IA airplane) ?

Link to comment
Share on other sites

Yes, you've right.

 

You've got right. I forgot to ask that in documentation.

 

Actually, I limited duplicateFromMissionDatas/spawn functions to ground groups and ships because of a problem I have with planes and helicopters when in air. They fell directly to ground :cry:

And when starting on ground, seems to have a problem with parking. So wait and see ...

 

In that case, duplicateFromMissionDatas return nil with no error... I'm going to add a return error for that case.


Edited by sunski34
Link to comment
Share on other sites

  • 4 weeks later...

Hi All,

 

I would like to create a sub sub menu in the F10 screen but in the manual I cannot determine what acts as or constitutes the parent parameter. My aim is as follows:

 

1. In the First F10 screen I want the following menu option: Declare Action.

 

I have used this line to create this first entry:

 

player.modules["Declare Action"].submenu = ATME.C_F10Menu(player, "Declare Action, nil)

 

2. Once selected, I would like a further 3 menu options to be displayed.

 

3. Upon selecting one of those three menus, I would like to see a menu listing a number of airfields.

 

4. I would then like to select one of those airfields and the action I have specified take place.

 

I realise this may seem a rather simple problem but I don't have access to any examples that show me how to complete this process...... so my trial and error approach is just getting frustrating. Any help would be greatly appreciated. Many thanks. :helpsmilie:

Callsign: NAKED

My YouTube Channel

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Some informations to understand

 

Hi SUNTSAG,

 

If you want to create a submenu with a command when a player enters, juste do :

 

local function onCreatePlayer(player)
    player.modules["MyModule"].F10SubMenu = ATME.C_F10Menu(player, "Sub Menu name", nil)
    player.modules["MyModule"].F10SubMenu:append(1, "Action name", fctAction , {player})
end

 

"MyModule" is the name of your module :

 

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 = nil,
       onModuleStartHandler = nil,
   }
       
   thisModule = ATME.C_Module("[b]MyModule[/b]", newHandlers, true)

 

and create before function onCreatePlayer your menu function fctAction like this :

 

local fctAction
fctAction = function(args)
    local player = args[1] -- to get the player

    -- Then you can do what you want here by adding new entries like this

    player.modules["MyModule"].F10SubMenu:append(1, "Action name 1", fcNewAction1, {player})
    player.modules["MyModule"].F10SubMenu:append(1, "Action name 2", fcNewAction2, {player})
end

 

then create to new menu functions fctNewAction1 and fctNewAction2 in the same way you used for fctAction...

 

For beginning, just display a message in your menu functions for exemple (function fctNewAction1):

 

local fctNewAction1
fctNewAction1 = function(args)
    local player = args[1] -- to get the player

    -- Then you can do what you want here by adding player message

    player:display("In function fctAction1", 5)
end


Edited by sunski34
Link to comment
Share on other sites

Hi Sunski,

 

Thank you for the quick response but I am not sure this achieves what i was after perhaps this will help as it is where I am presently.

 

local F10AnapattoKrasCentreMenu
F10AnapattoKrasCentreMenu= function(args)      
   local player = args[1]

player.modules["Declare Emergency Crash Rescue"].submenu:append(1, "Anapa-Vityazevo Crash Rescue", F10SpawnCommand9 , {player})-- I would like this entire list of Airfields to appear and be selectable in the F10 menu 
player.modules["Declare Emergency Crash Rescue"].submenu:append(2, "Batumi Crash Rescue", F10SpawnCommand , {player})------------ when I select MAYDAY Declare Anapa to Krasnodar-Centre F10 submenu
player.modules["Declare Emergency Crash Rescue"].submenu:append(3, "Beslan Crash Rescue", F10SpawnCommand17 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(4, "Gelendzhik Crash Rescue", F10SpawnCommand7 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(5, "Gudauta Crash Rescue", F10SpawnCommand5 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(6, "Kobuleti Crash Rescue", F10SpawnCommand1 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(7, "Krasnodar-Centre Crash Rescue", F10SpawnCommand11 , {player})
end

local F10KrasPashtoNalMenu
F10KrasPashtoNalMenu= function(args)      
   local player = args[1]

player.modules["Declare Emergency Crash Rescue"].submenu:append(1, "Krasnodar-Pashkovsky Crash Rescue", F10SpawnCommand12 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(2, "Krymsk Crash Rescue", F10SpawnCommand10 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(3, "Kutaisi Crash Rescue", F10SpawnCommand3 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(4, "Maykop Crash Rescue", F10SpawnCommand13 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(5, "Mineralyne Vody Crash Rescue", F10SpawnCommand14 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(6, "Mozdok Crash Rescue", F10SpawnCommand16 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(7, "Nalchik Crash Rescue", F10SpawnCommand15 , {player})
end

local F10NovtoVazMenu
F10NovtoVazMenu= function(args)      
   local player = args[1]

player.modules["Declare Emergency Crash Rescue"].submenu:append(1, "Novorossiysk Crash Rescue", F10SpawnCommand8 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(2, "Senaki-Kolkhi Crash Rescue", F10SpawnCommand2 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(3, "Sochi-Adler Crash Rescue", F10SpawnCommand6 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(4, "Soganlug Crash Rescue", F10SpawnCommand19 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(5, "Sukhumi-Babushara Crash Rescue", F10SpawnCommand4 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(6, "Tbilisi-Lochini Crash Rescue", F10SpawnCommand18 , {player})
player.modules["Declare Emergency Crash Rescue"].submenu:append(7, "Vaziani Crash Rescue", F10SpawnCommand20 , {player})
end


-- OnCreatePlayer handler : call when a player enters mission
local function onCreatePlayer(player)

   player.modules["Declare Emergency Crash Rescue"].F10submenu = ATME.C_F10Menu(player, "MAYDAY Declare Emergency", nil)
player.modules["Declare Emergency Crash Rescue"].F10submenu:append(1, "MAYDAY Declare Anapa to Krasnodar-Centre", F10AnapattoKrasCentreMenu , {player})
player.modules["Declare Emergency Crash Rescue"].F10submenu:append(2, "MAYDAY Declare Krasnodar-Pashkovsky to Nalchik", F10KrasPashtoNalMenu , {player})
player.modules["Declare Emergency Crash Rescue"].F10submenu:append(3,  "MAYDAY Declare Novorossiysk to Vaziani", F10NovtoVazMenu , {player})
end

 

I get the sub menus i was after but i want further sub menus to access the individual airfields information and then trigger the command. I had hoped there might be the ability to have a subsubmenu function or appendappend to simplify the process....but i am a noob with lua so I am in the dark. Sorry to be a pain.....:helpsmilie:

Callsign: NAKED

My YouTube Channel

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

hi

have a look at that one how it is done

https://forums.eagle.ru/showpost.php?p=3009127&postcount=21

 

you can create dynamic menu regarding where is the player

with the ATME player class function player:getPosition()

 

maybe it could be easier for you to modify this already done script with what you wanna do.

 

Go on, you'll manage to do it.

try to do easy step, and simple script in a first time, it's more rewarding when something simple works and then go a step ahead. ;-)

[sIGPIC][/sIGPIC]

all my skins :

here

 

Core i7-4790 @ 3.6- 4GHz - 16GB

- nVidia RTX 2070 - 2xSSD -

GRANDIN TV screen 39" in 1920x1080 cockpit scale 1:1

- MS FFB2 Joystick

- DIY MIDI Throttle with 14 analogic sliders and knobs

- Saitek Pro Flight Rudder Pedals

 

Link to comment
Share on other sites

Just a precision... Create a sub submenu is the same way as create a submenu :

 

local function onCreatePlayer(player)
    player.modules["MyModule"].F10SubMenuLevel1 = ATME.C_F10Menu(player, "Sub Menu Level 1", nil)

    player.modules["MyModule"].F10SubMenuLevel2 = ATME.C_F10Menu(player, "Sub Menu Level 2", F10SubMenuLevel1 )
    player.modules["MyModule"].F10SubMenuLevel2:append(1, "Action name", fctAction , {player})
end

Then you see that command is in the submenu level 2 which is in the submenu Level 1.

 

Have fun ;)

Sunski


Edited by sunski34
Link to comment
Share on other sites

Hi Fellas,

 

Thank you for your support and I have now managed to achieve what I wanted :thumbup:

 

Snowsniper.....I would love to use your airfield script as I think it is great but it does not seem to play nicely with other elements within the F10 menu.

 

Sometimes I will select it and it pulls through another F10 scripted action for example I selected "(i) airfield Info"when on the ground, and it pulled through player position information on aother example script you guys provided with the ATME package. the same can also happen when airborne.

 

Its a shame because i would really like to use it :pilotfly:

Callsign: NAKED

My YouTube Channel

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 3 weeks later...

ATME Scripting Errors Encountered

 

Hi Fellas,

 

I hope you are well?

 

I wonder if you could help me as this scenario happens every time a DCS placed ground unit is destroyed in mission with the scripts running.

 

I tried a bombing run at Gelendzhik airfield with bombs and ended up destroying one of the standard airfield radar units at which point these 3 messages appeared.

 

I tried the self same thing at Novorossiysk and the error presented again. I switched from the Viggen to the A10C and GAU 8'd one of the radar units and again the errors presented. I am thinking this could potentially be a core script issue....what do you guys think?

 

 

attachment.php?attachmentid=157225&stc=1&d=1487065590

 

attachment.php?attachmentid=157226&stc=1&d=1487065590

 

attachment.php?attachmentid=157227&stc=1&d=1487065590

Callsign: NAKED

My YouTube Channel

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Hi SUNTSAG,

 

can you explain a little bit more...

 

I see that the problem is come from a DCS call so an event call.... So I think that ATME received a bad dcs "dead event" !

 

When you say

destroying one of the standard airfield radar units

 

you speek about an airport static objects in DCS map, not add in a mission?

 

That's right?

 

Sunski

Link to comment
Share on other sites

Hi SUNTSAG,

 

can you explain a little bit more...

 

I see that the problem is come from a DCS call so an event call.... So I think that ATME received a bad dcs "dead event" !

 

When you say

 

 

you speek about an airport static objects in DCS map, not add in a mission?

 

That's right?

 

Sunski

 

That is correct mate yes :thumbup:

Callsign: NAKED

My YouTube Channel

 

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Hi SUNTSAG,

 

ok I'm not sure if it's a new DCS problem or not.... But the name of a static unit, linked to the map, is not a string but a number !

 

I added the necessary tests in ATME in version V1.0.7.

 

Thank you for your returns and help.

 

Sunski

Link to comment
Share on other sites

Yes Area will help in several cases. My biggest problem actually is to convert a complex polygon (not crossed) into convex ones. Because if I want to spawn surely I need that. Hopefully, return if a point is in such a complex polygon is easier !

 

I'm going to finish that after the next version which is Airecraft spawning oriented as promised.

 

Sunski

Link to comment
Share on other sites

  • 2 weeks later...

Hi Suntsag,

 

ATME has two functions (see in english doc) :

 

ATME.convertMGRSToLL(tableMGRS) to convert a MGRS to latitude/longitude

ATME.convertLLToMGRS(latitude, longitude) to convert latitude/longitude to MGRS

 

For tableMGRS format, here : http://wiki.hoggit.us/view/DCS_func_LLtoMGRS

 

After, I never use it really except to convert JTAC info MGRS into L/L in NATO.lua DCS file.

 

Sunski

Link to comment
Share on other sites

Hey guys i've got a problem, i want to duplicate an activation delayed group when someone enters a zone but i haven't found how to do this. Right now i'm just spawning a f15 on each player update which is not really what i want :D My code

 

local thisModule

local moduleName = "QuickResponse"

 

local function onZonePass(player)

if player:isInDCSZone("Delta") == true then

local err, var1 = ATME.C_GroupSpawnDatas.duplicateFromMissionDatas("Delta Quick Response F15", "Delta Quick Response F15" .. math.random(10000))

if err == false then

var1:spawn("Delta")

player:display("L'ennemi à décollé de batumi faites attention !",10)

end

end

end

-- MAIN

do

local newHandlers = {

onCreatePlayerHandler = nil,

onDeletePlayerHandler = nil,

onUpdatePlayerHandler = onZonePass,

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 = nil,

onModuleStartHandler = nil,

}

 

thisModule = ATME.C_Module(moduleName, newHandlers, true)

end

 

f15c_army.PNG

Link to comment
Share on other sites

Hi ked,

 

actually, you can add a boolean flag for each player and you need to define onCreatePlayer to initialize this flag like this (I suppose player is not in zone when he enters mission, if not you to do a same test you did in onZonePass function) :

 

 
local thisModule
local moduleName = "QuickResponse"

local function onCreatePlayer(player)
  player.modules[moduleName].inZone = false
end


local function onZonePass(player, events)
  if player:isInDCSZone("Delta") == true then
     if player.modules[moduleName].inZone == false then
        -- Test the flag to do it once
        local err, var1 = ATME.C_GroupSpawnDatas.duplicateFromMissionDatas(" Delta Quick Response F15", "Delta Quick Response F15" .. math.random(10000))

        if err == false then
           var1:spawn("Delta")
           player:display("L'ennemi à décollé de batumi faites attention !",10)
        end

        -- and just after, set flag to true.
        player.modules[moduleName].inZone = true
     end
  else -- Player leaves zone, flag has to set to false once.
     if player.modules[moduleName].inZone == true then
        player.modules[moduleName].inZone = false
     end
  end
end
-- MAIN
do
local newHandlers = {
onCreatePlayerHandler = onCreatePlayer,
onDeletePlayerHandler = nil,
onUpdatePlayerHandler = onZonePass,
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 = nil,
onModuleStartHandler = nil,
}

thisModule = ATME.C_Module(moduleName, newHandlers, true)
end 

Be careful on callback parameters : onUpdatePlayerHandler has 2 parameters, player and events. I modify it in your code too. events are all ATME event fire each second (ATME Core events, or user trigger event).

 

ATME will have a new possibility soon (in next version) with two new functions in class ATME.C_Area and two new ATME core events to track aircrafts in areas. But you will have to use ATME Core events

 

Sunski


Edited by sunski34
Link to comment
Share on other sites

Thank you ! that's perfect, i didn't really realy realise i could do that :)

 

Now i'm wondering if there's a way to know a player's coallition and aircraft ?

 

EDIT: used player:getCoalitionName() for coalition it works fine , no idea about aircraft name


Edited by ked
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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