Search the Community
Showing results for tags 'scripting engine'.
-
DCS Scripting API Prototypes — TGFB Edition info This utility allows for more efficient and cleaner code so, help you make better scripted missions! With this you will gain the ability to lookup and see all functions available to you in the DCS Mission Scripting API. You will get function auto-completion so you will always know what param a function wants/needs. It will also warn you for sketchy nil and Mission Scripting errors so my advice if you see a "warning" in your file you better check that out and fix it to prevent bugs and unintended fun!! The original idea as far as i can see was from 'asherao' Installation and download -> HERE TGFB Info Website: tgfb-dcs.com Discord Feel free to join the TGFB Discord or visit or website to stay up-to-date with my latest projects, mission and tools Enjoy using this tool!! This tool is updated for DCS version : "2.9.19.13478" Credit : - Hoggit Discord - asherao See Screenshot EXAMPLES :
-
- scripting
- missionscripting
- (and 12 more)
-
AFAIK, there is no documented way to set aerobatic task for AI in mission script. I'd like to request to provide us this possibility.
-
Я скачал скрипт, засунул его в Макс 12, делал все по инструкции, указываю путь к папке Shapes а модельки не открывается, приложу видео для просмотра проблемы более понятно, заранее спасибо большое за помощь VID_20250110_190403_802.mp4 I downloaded the script, put it in Max 12, did everything according to the instructions, I specify the path to the Shapes folder, but the models do not open, I will attach a video to view the problem more clearly, thank you very much in advance for
-
currently the lua api function land.getSurfaceType(table vec2 ) returns form the following enumerator land.SurfaceType LAND 1 SHALLOW_WATER 2 WATER 3 ROAD 4 RUNWAY 5 I would like to propose adding 1 or 2 new values first and most important, FOREST, not talking about like small treelines or anything custom placed, I mean the actual forest areas. These are part of the maps and should be already known by the sim, if we could have access to that it would enable a lot of features for lua scripters second, less important but would still be nice is a URBAN or CITY value, basically anywhere that is inside a town or city, for similar reasons, thugh unlike forest i dont know if this information is as accessible so it is not the primary ask cheers
-
Hey, seems I am back with another round of issues I would like to report. I have worked on a script to change the warehouse item values so that we can save what was in the warehouse at the mission restart, etc. However, I have come across and issue where some of the items are not being given to the script when using Warehouse.getInventory( ) so we are being left with items in the warehouse, or not being able to change the values that the warehouse has of the items. I set the warehouse values to 100 using the Fill Col in the mission editor. Then I will make sure Dynamic spawns etc is available. Doubt this would matter, but I did it. In my case , I am using "DCS Lua Runner" in Visual Studio Code to run the script this way I can make faster iterations when the script fails. Also, keep in mind, this script will save a few files to your disk, and you will need to set the location you want them to be saved to inside the script. Otherwise, obviously this will fail. First the script will make a small text file so that it knows for later that every other run afterwards is no longer the "First Run" since we do not want to loose the initial set values we started with. Then after each server or mission restart, when run it will then clear the entire warehouse inventory and then set all the values to what is in the CSV file. In this image you can see that certain items are not set to 5000 like the CSV should be. And no, this is not because it is more than the max value, even if I set it to 5 it doesn't make a difference. Anyways, back to the issue... It seems that, when the script asks for the entire inventory of the airbase it is not getting everything that is in the airbase. Some items seem to be omitted, and as far as I can see it is new-er aircraft like the KIOWA, CH-47, and F-5? Of course this is completely breaking any possibility of having a dynamic, warehouse/supply based mission for the time being. I would attach the mission file, however you will need to have your DCS environment sanitized and make some light modifications to the script for it to function. So, instead I will attach a blank mission that's ready to go and you will have to modify and load the script on your own. I attached the CSV's for an example of what the script gets when it is first run. Both on an airfield with items set from the mission editor to 100, and one where it is set to 0 for everything. Hopefully something can be figured out with this, and maybe I am super confusing with what I wrote. I hope not null Warehouse Test Cauc.miz unit and warehouse saving.lua Senaki-Kolkhi_Blue.csv Kutaisi_Blue.csv
- 6 replies
-
- warehouse
- warehouses
-
(and 2 more)
Tagged with:
-
In order to quickly find ports on the map, the mission creator shouldn't have to scour the map and write down lat/longs for them. The maps that have ports detailed and modelled should have them marked and selectable and the mission editor should have a layer showing all the 'modelled ports'. The scripting engine should also be able to grab a list of ports and get data about them. i.e. max size of ship, number of berths etc.
-
I have the following events handled (amongst all the others) S_EVENT_PLAYER_ENTER_UNIT S_EVENT_PLAYER_LEAVE_UNIT When I enter the F14, I see a S_EVENT_BIRTH followed by a S_EVENT_PLAYER_ENTER_UNIT. Then I ask my RIO to join in, I get the on-screen allow someone to join dialog (would be nice if this could have a keybinding as finding the mouse pointer esp in VR is a pita) and then I click allow... After a few seconds I get the blue banner saying my RIO has joined, and he confirms he's in the back. Yet NO events fire. Nothing. But when he jumps out, I get the expected S_EVENT_PLAYER_LEAVE_UNIT to fire. Obviously I can't give you a track or anything because you need two people and a multi-crew aircraft to do this, but it's a simple test. Without the S_EVENT_PLAYER_ENTER_UNIT event firing then it's impossible for my Player Manager to work out that they are a backseater and set things up accordingly.
- 5 replies
-
- scripting engine
- events
-
(and 3 more)
Tagged with:
-
As the title says. If I output the value for Unit.getByName(unitName):getID() it is surrounded by quotes and it's type is a string But if I do this: Unit.getGroup(Unit.getByName(unitName)):getID() It's type is number. So to make the first statement work I have to cast the return value 'tonumber'.
- 4 replies
-
- wrong return value type
- scripting engine
-
(and 3 more)
Tagged with:
-
So I know the documentation, such that it is and unofficial etc, but here: https://wiki.hoggitworld.com/view/DCS_singleton_net It says that there are many functions, including 'log', in that singleton. However, when looking into it via Visual Studio Code (https://github.com/asherao/DCS-Scripting-Library), log and many of the others, is no longer inside 'net'. e.g. I understand these are a third party creation so they can't be relied to be The Truth. So, I did an investigation. I made a logging script with a logging function: function LogWrite(moduleString, level, message, ...) -- THIS FAILS net.log.write(moduleString, net.log[level:upper()], string.format(message, ...)) -- THIS WORKS log.write(moduleString, log[level:upper()], string.format(message, ...)) end If log is supposed to exist inside the 'net' singleton, then the first line should work, however it only works as it's own 'singleton' or a global function. Can we get some clarification on this please? @Grimes Do you have any thoughts or knowledge about why log breaks with net.log?
- 1 reply
-
- documentation
- net
-
(and 3 more)
Tagged with:
-
At the moment the only commonality between the data extracted using the net singleton and the DCS Scripting Engine is the PLAYER NAME. This means, that unless the user / mission creator is keeping track of all player names, then it's impossible to link the data from the net singleton back into the DCS Scripting Engine. e.g. There is no way to link PLAYER NAME and SLOT data back to the UNITID in the DCS Scripting Engine.
-
- net
- scripting engine
-
(and 4 more)
Tagged with:
-
env.mission has the following: -- date : table : The date the mission takes place at with Year, Month, and Day entries -- descriptionText : string : Mission briefing defined under the "Situation" page on the briefing panel -- descriptionBlueTask : string : Blue coalition task defined on the briefing panel -- descriptionNeutralsTask: string : Neutral coalition task defined on the briefing panel -- descriptionRedTask : string : Red coalition task defined on the briefing panel -- drawings : table : Table containing information on any drawing placed in the editor. -- pictureFileNameN : table : Neutral coalition briefing images -- pictureFileNameB : table : Blue coalition briefing images -- pictureFileNameR : table : Red coalition briefing images -- result : table : Conditions and actions defined by mission goals in the editor to decide if a mission is "won" -- start_time : number : Time in seconds since midnight for the date set when the mission starts -- sortie : string : Name of the mission as defined in the briefing panel. -- theatre : string : Name of the map the mission takes place on Almost everything in this list is able to be accessed through lua/scripting Engine, but for these three: pictureFileNameN pictureFileNameB pictureFileNameR Instead of getting the actual picture image (found in l10n/DEFAULT/<imageName>.<extension>), what is returned is an obfuscated 'ResKey' for it. Because there is no way to use the 'ResKey' in it's place, it means that for these three items only, they are hidden from the scripting environment (and I can't see a good reason why). There is no equivalent 'getValueByKey' for objects in the mapResource file. Could these be 'un-obfuscated' or could an additional command be added to retrieve the actual file url from the 'ResKey' Thanks
-
- images
- scripting engine
-
(and 3 more)
Tagged with:
-
I ask because whilst I'm building my own zone manager, I'd like to be able to send to the Mission Editor the same events - i.e. moving in zone or group in zone etc, so that mission designers can use my zone manager but not have to use any lua, and access it from the ME trigger conditions.
- 1 reply
-
- world.event
- mission editor
-
(and 2 more)
Tagged with:
-
There is no option to STOP the currently transmitting message via a STOP CONDITION for the PERFORM COMMAND -> TRANSMIT MESSAGE function inside the Mission Editor or Scripting. If you had both a START and a STOP condition, then interactive and dynamic communications could happen between players and AI aircraft, by having multiple TRANSMIT MESSAGES stacked up, each with their own START and STOP conditions.
-
- mission editor
- scripting engine
- (and 3 more)
-
fixed CTD when exploding a single-unit group
Mr Nobody posted a topic in Scripting Tips, Tricks & Issues
Had an issue pop up while working on some VBIED stuff. The general gist is that I'm using the "Perform Command > Run Script" at a vehicle's final waypoint to have it explode. The code I'm using to grab the vehicle's position and destroy it is: local thisGroup = ... local firstUnit = thisGroup:getUnit(1) local firstUnitCoords = firstUnit:getPoint() trigger.action.explosion(firstUnitCoords, 200) This works fine if there's more than 1 vehicle in the group, but if the vehicle is alone in the group, then DCS crashes as the explosion triggers (you can see the initial effect of the explosion in the right spot as the crash happens, so the explosion part of it is still "working"). No scripting errors pop up and dcs.log doesn't show anything out of the ordinary for me. Am I misunderstanding something about getUnit or using it incorrectly, or is there some kind of quirk with how it works when there's a single unit in a group? I also tried making a function that checks that the group size is >= 1 before grabbing the unit and exploding it, and then calling that from the vehicle waypoint, but it still results in the same crash. Test mission is attached with 2x Urals that will drive forward a little bit and the lead unit explodes, as intended. If you reduce the group size to 1, it will crash the game instead. VBIED Test.miz -
With the function 'searchObjects' we can search for objects in a volume. Some of the types are sphere and box. When using a BOX type to search for objects in a area, lets use the MGRS Grid for this, there is only two points available to define to box. This means that we cannot rotate the box in any way to line up with the MGRS grid, this causes the search volume to out of the "bounds" that we intend to have. I created a simple mission showing what happens, and the drawings on the map show what "should" be happening. The Black dotted line is where the SearchVolume see's, and the White to Blue boxes are just showing if the unit is detected. All he does is drives back and forth through the MGRS Grids so you can see what the Volume is doing. It would probably be best to have the ability to give four points on the box rather than two, or maybe I am missing something? I've attached a track file, the mission, and the scripts I made for this. 2 CaucasusAirbases.lua 1 Caucasus ScanZone.lua 3 Caucasus ZoneMarks.lua Cauc-Zone-Detection-Test.miz SearchVolumeTestCauc.trk