Jump to content

DCS: World Scripting Engine


Recommended Posts

Try adding a slight height correction (y axis) on ground units to see if it fixes it. Due to the terrain the point might be under the terrain and therefore LOS can not be attained.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • Replies 148
  • Created
  • Last Reply

Top Posters In This Topic

All spawned units must be placed in the editor and have either a group activation command or a delayed start. However with the mission task you can change fundamentally what the group might be doing once the game starts, the only issue is the group always has to start at the same spot.

 

Group Deactivate is basically a garbage can function and it removes the group entirely.

 

@Bandit regarding AI on/off. Its been requested.

 

That's too bad. With no possibility to spawn new aircrafts or refuel/rearm them you can't make persistent IADS without making lots of inactive groups (one new group for every interceptor wave instead of reusing them).

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Thats more of a GCI task with an IADS, but I get your point.

 

You can always have lots and lots of copies of AI set to spawn in and only spawn them when needed. Its not the most practical thing in the world, but it works. One of the missions I've made that I will release with the 1.2.3 patch uses a script that automatically searches the trigger list for flag based conditions to activate different groups and can set the flag to the needed value whenever it needs to spawn in the group. At least with LUA you can monitor some of the logistics aspects of the AI flight and more precisely order wingmen around to be more efficient with AI spawning. But there would still be a set limit.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Can anyone tell me why this script crashes DCS:World for me?

ctrl = Group.getController(Group.getByName("Group1"))
newtask = {id = 'Orbit', params = {pattern = "Circle"}}
Controller.pushTask(ctrl, newtask)

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Can anyone tell me why this script crashes DCS:World for me?

 

Cause of function: Controller.pushTask(ctrl, newtask)

 

Function pushTask does not work.

Function pushTask has not implemented yet.

(http://forums.eagle.ru/showpost.php?p=1594385&postcount=501 - it was already discussed in russian part of forum.).

Maybe it will be implemented in future.

--------------------------------------------

 

Try adding a slight height correction (y axis) on ground units to see if it fixes it.

 

Thanks! Now, it works fine.


Edited by BAntDit

Крайняя версия MSF 1.0.1 (для 1.2.6.): http://forums.eagle.ru/attachment.php?attachmentid=89817&d=1382379803

 

Новая версия MSF 1.0.2 beta: http://forums.eagle.ru/attachment.php?attachmentid=93422&d=1390584292

 

Миссия для тестирования возможностей MSF 1.0.2: http://forums.eagle.ru/attachment.php?attachmentid=91514&d=1386954362

----

Руководство по MSF (не полная версия для MSF 1.0.2): http://forums.eagle.ru/attachment.php?attachmentid=92959&d=1389558825

Link to comment
Share on other sites

Cause of function: Controller.pushTask(ctrl, newtask)

 

Function pushTask does not work.

Thanks! Can i assign new tasks to units with another function that do work?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

You can use function Controller.setTask(Controller self, Task task).

 

Example:

newtask = {id = 'Orbit', params = {pattern = "Circle"}}

_group = Group.getByName("Group1");
_controller = _group:getController();
_controller:setTask(newtask);

 

but you have to remember , setTask resets all previos tasks. It's main difference between pushTask and setTask.


Edited by BAntDit

Крайняя версия MSF 1.0.1 (для 1.2.6.): http://forums.eagle.ru/attachment.php?attachmentid=89817&d=1382379803

 

Новая версия MSF 1.0.2 beta: http://forums.eagle.ru/attachment.php?attachmentid=93422&d=1390584292

 

Миссия для тестирования возможностей MSF 1.0.2: http://forums.eagle.ru/attachment.php?attachmentid=91514&d=1386954362

----

Руководство по MSF (не полная версия для MSF 1.0.2): http://forums.eagle.ru/attachment.php?attachmentid=92959&d=1389558825

Link to comment
Share on other sites

Thanks! I have a new problem that I've been tearing my hair out for two days now. I cant get a aircraft to move to a specific point. I'm using the "Mission" task:

_mission = { 
  id = 'Mission', 
  params = { 
    route = { 
      points = { 
          
        [1] = { 
          type = "Turning Point", 
          airdromeId = nil, 
          helipadId = nil, 
          action = "Fly Over Point", 
          x = -300000,
          y = 600000,
          alt = 5000, 
          alt_type = "BARO", 
          speed = 200, 
          speed_locked = true, 
          ETA = 100, 
          ETA_locked = false, 
          name = "IP", 
          task = nil
        }
      } 
    }, 
  } 
};

_group = Group.getByName("Group1")
_controller = _group:getController()
_controller:setTask(_mission);

The X and Y values should send it somewhere near Turkey in the south. What happens instead is that no matter what I set the X and Y values to it either sends it toward the Crimean Peninsula or the airplane immediately lands. The altitude and speed setting on the other hand works. Is this a bug? Btw, in what measure is the speed-value? Meter/second?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Thanks! I have a new problem that I've been tearing my hair out for two days now. I cant get a aircraft to move to a specific point. I'm using the "Mission" task:

_mission = { 
  id = 'Mission', 
  params = { 
    route = { 
      points = { 
          
        [1] = { 
          type = "Turning Point", 
          airdromeId = nil, 
          helipadId = nil, 
          action = "Fly Over Point", 
          x = -300000,
          y = 600000,
          alt = 5000, 
          alt_type = "BARO", 
          speed = 200, 
          speed_locked = true, 
          ETA = 100, 
          ETA_locked = false, 
          name = "IP", 
          task = nil
        }
      } 
    }, 
  } 
};

_group = Group.getByName("Group1")
_controller = _group:getController()
_controller:setTask(_mission);

The X and Y values should send it somewhere near Turkey in the south. What happens instead is that no matter what I set the X and Y values to it either sends it toward the Crimean Peninsula or the airplane immediately lands. The altitude and speed setting on the other hand works. Is this a bug? Btw, in what measure is the speed-value? Meter/second?

 

I "solved" the problem I think, don't know what I did but it works now :thumbup: The speed variable is indeed meter/second. Does anyone know what the "EWR" ground unit enroute task does, if anything?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

I "solved" the problem I think, don't know what I did but it works now :thumbup: The speed variable is indeed meter/second. Does anyone know what the "EWR" ground unit enroute task does, if anything?

 

I don't believe it does anything at this time, but I might be wrong.

 

A little tip:

 

When making tasks for groups, I find it helpful to create the task or one similar to it first in the mission editor. Save the mission with the waypoints like how you want the Lua-assigned task to look. Now, just unzip the mission, open the "mission" file up, find that group, and simply copy the task out of there. A few things might be different- like in some cases, in the mission file, for Vec2 points, I believe x = number, y = number is used, while in the SSE, it's usually point = { x = number, y = number}. However, I believe that the AI engine is overloaded to accept either.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

Thanks for the tip! Very useful! Another question: is it possible to play the in-game voices, like having it say things like "target 246", over the radio using the SSE?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Thanks for the tip! Very useful! Another question: is it possible to play the in-game voices, like having it say things like "target 246", over the radio using the SSE?

 

trigger.action.radioTransmission

 

It's been a while since I tested it though... I forgot if there were any bugs or quirks with it in the current released version of DCS.

 

If it didn't work, you could also try using the transmit message AI command. It's not in the scripting engine documentation, but it should still work: just unzip a mission where the AI use it to see how to code it in Lua.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

Thanks for the quick answer, but I'm not really sure that's what I meant. I was thinking about using the voices already in the game, so I dont have to record new ones, if that's possible.

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

trigger.action.radioTransmission

 

I've tested. This function does not work in DCS ver .1.2.2.

 

Will this function work in DCS ver. 1.2.3?

Крайняя версия MSF 1.0.1 (для 1.2.6.): http://forums.eagle.ru/attachment.php?attachmentid=89817&d=1382379803

 

Новая версия MSF 1.0.2 beta: http://forums.eagle.ru/attachment.php?attachmentid=93422&d=1390584292

 

Миссия для тестирования возможностей MSF 1.0.2: http://forums.eagle.ru/attachment.php?attachmentid=91514&d=1386954362

----

Руководство по MSF (не полная версия для MSF 1.0.2): http://forums.eagle.ru/attachment.php?attachmentid=92959&d=1389558825

Link to comment
Share on other sites

I've tested. This function does not work in DCS ver .1.2.2.

 

Will this function work in DCS ver. 1.2.3?

 

It looks like I reported that the function was not working back in September. Saint says he accidentally had the function using a boolean enumerator for AM/FM modulation, not a numeric enumerator like the documentation says.

 

It was supposedly fixed in internal versions a while back, but I haven't gone back and verified that that is truly the case. I should probably do that :D

 

Anyway, that means that here in 1.2.2, you could try using simply true or false to determine AM/FM modulation (donno which corresponds to which though, so you'll have to experiment).

 

If it does work with a boolean, maybe you could put it inside a pcall and call both the numeric and boolean enumerator versions to make your mission insensitive to the 1.2.2 to 1.2.3 transition (assuming it is really fixed in 1.2.3).


Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

trigger.action.outTextForGroup is either broken or improperly documented. First it takes the message text first, then the groupID, then delay. The documentation for the parameter order is wrong.

 

Also it doesn't work at all because you cannot give it a delay. You get ERROR Trigger: invalid parameters to a_out_text_delay_g() no matter what is passed.

Link to comment
Share on other sites

trigger.action.outTextForGroup is either broken or improperly documented. First it takes the message text first, then the groupID, then delay. The documentation for the parameter order is wrong.

 

Also it doesn't work at all because you cannot give it a delay. You get ERROR Trigger: invalid parameters to a_out_text_delay_g() no matter what is passed.

 

Yes, it's currently broken in 1.2.2. It will probably be fixed in the next patch.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

Yes, it's possible. First get the position(3D) of the unit and then get the AGL altitude of that position with the functions described in SSE wiki.

Thank you. This is the relevant function:

Distance function land.getHeight(Vec2 point)

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

I guess I'm not the only one making a script like this, but at least I'm the first one posting one :D

 

A little proof-of-concept script that simulates a Ground Control Intercept central for both sides that will send interceptor-fighters at aircrafts "detected" (in line-of-sight and within a certain radius) of Early Warning Radars. It will activate the flights and plot a intercept-course that is configurable by the mission-creator (for example a high-speed low-high-low interception as demonstrated in the demo-mission by the MiG-23's).

 

Requires MIST

GCI-demo.miz

SetupGCI.lua

  • Like 1

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

I guess I'm not the only one making a script like this, but at least I'm the first one posting one :D

 

A little proof-of-concept script that simulates a Ground Control Intercept central for both sides that will send interceptor-fighters at aircrafts "detected" (in line-of-sight and within a certain radius) of Early Warning Radars. It will activate the flights and plot a intercept-course that is configurable by the mission-creator (for example a high-speed low-high-low interception as demonstrated in the demo-mission by the MiG-23's).

 

Requires MIST

 

Yea, you're probably the first one posting one, good job.

 

GCI would be one system we'd like to incorporate into Mist. However, I'm waiting for certain scripting features that are likely to arrive in future versions of DCS.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

Yea, you're probably the first one posting one, good job.

 

GCI would be one system we'd like to incorporate into Mist. However, I'm waiting for certain scripting features that are likely to arrive in future versions of DCS.

Thank you! Maybe you would be interested in including in Mist some of the functions I made, like: tablelength, tablecontains, measuredistance, getpointbetween, getClosingVelocity, normV3, or calculteInterceptionPoint.

 

I made an update to the script:

- Better interception-planning, less chance of interceptor overshooting its target.

- Implemented a ground-clutter-filter algorithm. To be filtered out as part of ground the unit has to be flying below a set AGL-threshold AND nearing or leaving the radar slower than a set velocity-threshold. In other words: if you are flying Nap-Of-the-Earth the radar will ignore you. In the demo-mission its below 50 meters (164 feet) above the ground and approaching or leaving the radar at a speed of less than 25 m/s (90 km/h or 48 kts) and this is demonstrated by the Slow/low helicopter attacking the radar. Any suggestion on how this algorithm should be better implemented is welcome!

SetupGCI.lua

GCI-demo.miz

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Thank you! Maybe you would be interested in including in Mist some of the functions I made, like: tablelength, tablecontains, measuredistance, getpointbetween, getClosingVelocity, normV3, or calculteInterceptionPoint.

 

I made an update to the script:

- Better interception-planning, less chance of interceptor overshooting its target.

- Implemented a ground-clutter-filter algorithm. To be filtered out as part of ground the unit has to be flying below a set AGL-threshold AND nearing or leaving the radar slower than a set velocity-threshold. In other words: if you are flying Nap-Of-the-Earth the radar will ignore you. In the demo-mission its below 50 meters (164 feet) above the ground and approaching or leaving the radar at a speed of less than 25 m/s (90 km/h or 48 kts) and this is demonstrated by the Slow/low helicopter attacking the radar. Any suggestion on how this algorithm should be better implemented is welcome!

 

 

Your nap of the Earth method is not realistic. The condition for applying the ground clutter notch is whether or not the target is line of sight to the radar, and whether it is against a sky background or terrain background. If against a sky background, you do not apply the ground clutter notch.

 

To check for sky background or terrain background, use land.getIP.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

Oh and also, AFAIK, if a helicopter is detection range of the radar, it should always be visible on Doppler radar due to their spinning rotors. That may be simplifying things a bit (the helo should probably be more observable when it's flying towards/away from the radar outside of the notch), but you're not trying to develop a detailed radar simulation, are you?

 

Anyway, to check if a unit is a helicopter, you can use Unit.hasAttribute.

 

However, the AI can be decently skillful at autorotations, after which the helicopter unit will be alive but completely shut down and stationary on the terrain, so you would probably also want to make sure the helicopter is actually flying before "detecting" it. To do that, use Unit.inAir.

 

So your script would be blind to helicopters that are spooling up/shutting down on the ramp with blades spinning, which should indeed be quite detectable IRL, but that's a minor issue overall.

 

Anyway, Mist will probably include a simple Doppler radar detection check in one of the next versions.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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