Jump to content

DCS: World Scripting Engine


Recommended Posts

Hello all

 

DCS: World has new powerful tool for experienced mission designers - the Scripting Engine. The system provides control overt game objects behavior during the mission by using lua scripts. All you need is to be a programmer.

 

That was where I stopped reading. What about you?

ED have been taking my money since 1995. :P

Link to comment
Share on other sites

  • Replies 148
  • Created
  • Last Reply

Top Posters In This Topic

LOL, that's where they lost me too leafer.

 

I can see how it's a powerful new tool for us to use, but for guys like me, who have no programming experience, I'd like to just have a pre made selection box that I can check when I make simple missions for things like, I dunno...

 

Say when a Tank gets hit, that's part of a group, and is only damaged, crew gets out and runs to nearest cover, with a certain % chance the commander will stay with his tank and use the machine gun to fire back, other vehicles in the group scatter and move to nearest cover and attempt to attack while disembarking troops, and popping smoke to obscure target area.

 

APC's immediately stop when under attack and squads disembark to nearest cover, those with Igla's or stingers take up position and attack threat.

 

Would make for some interesting and more true to life reactions I think.

Link to comment
Share on other sites

It allows for more enhanced capabilities of what can happen within a mission. The scope of it really depends on what the mission builder wants to use the it for. It is possible to use it for very simple, mundane tasks, however it excels at complex logic and capabilities. For example a user could create an Integrated Air Defense Network between multiple groups and testing Line of Sight between the different radars and taking all sorts of other factors into account.

 

Wow, this is excellent stuff!

There are only 10 types of people in the world: Those who understand binary, and those who don't.

Link to comment
Share on other sites

This is awesome,

 

I´ve added the Wiki Link to the Mission Editing and Scripting section in the Wiki

 

to find it follow this path: ED Wiki > main page > Block Technical Office and Editing follow the DCS Mission Editor (ME) link > Advanced Scripting/Editing block.

 

This is really an awesome option for Mission designers. Thanks Святой and Thanks ED

DCS-Tutorial-Collection       

BlackSharkDen - Helicopter only

Specs:: ASrock Z790 Pro RS; Intel i5-13600K @5,1Ghz; 64GB DDR5 RAM; RTX 3080 @10GB; Corsair RMX Serie 750; 2x SSD 850 EVO 1x860 EVO 500GB 1x nvme M.2 970 EVO 1TB; 1x nvme M.2 980 Pro 2TB+ 3 TB HDD

Hardware: Oculus Rift S; HOTAS Warthog; Saitek Rudder Pedals, K-51 Collective

Link to comment
Share on other sites

The beauty of this is that the programmers can write the scripts, post them up with an explanation of their use. All the non-programmers need to do is copy the script and drop it into the Mission editor in the triggered action -> run script.

 

An example would be a line of sight script linked to a trigger zone. In the ME you would have

CONTINUOUS -> blank -> RUN SCRIPT (copy and paste script into box)

CONTINUOUS -> FLAG 1 SET -> Message to coalition ("scramble, zee enemy are approaching") ; FLAG 1 FALSE

 

The script would simply set flag 1 if any enemy aircraft that enters the trigger zone with LOS for say 5 seconds.

 

its a simple script that uses the functions

Unit.getByName(string name)

Object.getPosition(self)

land.isVisible(Vec3 from, Vec3 to)

 

Obviously gets a little more complicated when you start populating with lots of units and want to check for any enemy aircraft but again possible in lua.


Edited by Druid_
sp

i7-7700K : 16Gb DDR4 2800 Mhz : Asus Mobo : 2TB HDD : Intel 520 SSD 240gb : RTX 2080ti: Win10 64pro : Dx10 : TrackiR4 : TM Warthog : ASUS ROG SWIFT PG348Q

Link to comment
Share on other sites

LOL, that's where they lost me too leafer.

 

I can see how it's a powerful new tool for us to use, but for guys like me, who have no programming experience, I'd like to just have a pre made selection box that I can check when I make simple missions for things like, I dunno...

 

While it helps greatly to have knowledge of programming or scripting, I'd say its not required. A few of us who have been testing the SSE and building scripts for it are trying to make the scripts as easy to use and understand as possible.

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

Fine :thumbup:

 

Finally will we be able to use (in ME-Triggers/Actions) the PLAY ARGUMENT command also ? (on assigned objects: as buildings, air/rotorcrafts, vehicles, ships ? )

 

...and would be nice to add more starting options like:

wsBirthPlace_Air,

wsBirthPlace_RunWay,

wsBirthPlace_Park,

wsBirthPlace_Heliport_Hot,

wsBirthPlace_Heliport_Cold,

 

Would be great more (instead of wsBirthPlace_Park)

 

wsBirthPlace_Park_Hot ---> will B great for A-10C - shortening startup time - i mean no startup time ;)

and

wsBirthPlace_Park_Cold

 

SSE functions currently do not include many of the actual trigger actions- (such as activate group, stop and deploy to template, etc). For now, use trigger.action.setUserFlag to make your Lua interface with trigger logic.

 

Starting options cannot be modified by Lua. You can, however, assign AI aircraft a brand new mission (complete with new waypoints, etc) while in the air.

 

Edit:

Though... that said... I've never tried assigning a "Mission" task to an unactivated aircraft group. The thought of doing so simply never crossed my mind.

 

Unfortunately, I am away from the flying machine this week, and only have my laptop with me.


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

Debug Message script

 

Is there something like a debug or tracing script?

 

We do have (quite complex) missions that soetimes "kill" the server.

But we do not understand the cause of the server crash. Trace messages to protocol could help when searching for the cause. Every script action should be written to file.

After a crasch we could check the mission trace file.

Windows 10, I7 8700k@5,15GHz, 32GB Ram, GTX1080, HOTAS Warthog, Oculus Rift CV1, Obutto R3volution, Buttkicker



[sIGPIC][/sIGPIC] ЯБоГ32_Принз





Link to comment
Share on other sites

Is there something like a debug or tracing script?

 

We do have (quite complex) missions that soetimes "kill" the server.

But we do not understand the cause of the server crash. Trace messages to protocol could help when searching for the cause. Every script action should be written to file.

After a crasch we could check the mission trace file.

 

Lua does not cause server crashes, and will not illuminate the cause of them. Errors in C++, which is what the majority of the game is programmed in, causes server crashes. ED has their own internal debugging versions. Best thing to do is to find a way to duplicate your crash, then report this crash, in detail with the method to duplicate, to an ED tester, who will then forward the bug to an ED dev for fixing.


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

i hope someone is sharing "simple" scripts with us as examples in mission files ...

 

I wish I had a whole mission completed to show off.

What kind of an example are you looking for?


Edited by Grimes

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

i hope someone is sharing "simple" scripts with us :music_whistling: as examples in mission files ...

 

I'm not at my computer right now, so I can't test anything I make, but I can still make them- what exactly are you looking for though?

 

Well, here's one example, something you can't do with the mission editor, at least without creating lots of annoying zones and triggers to detect units in zone.

 

Create signal flare on a group of units:

--in a doscript trigger action
local units = Group.getByName('convoy1'):getUnits()  -- "convoy1" is the name of the group in the ME
if #units > 0 then
local unit1pos = units[1]:getPosition().p
trigger.action.illuminationBomb({x = unit1pos.x, y = unit1pos.y + 1000, z = unit1pos.z})
end

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

I wish I had a whole mission completed to show off.

What kind of an example are you looking for?

 

 

i have a trigger zone - it checks, which fix wing (A-10C for Blue and Su-25T for Red) is in the zone. Everytime one side is able to push all aircrafts out of the zone, they get points.

 

At the moment i have 4x A-10C on one side and 4x Su-25T on Red - i can solve this in the ME

with this

Switch Condition (B has_AirSup) / Unit inside Zone(Eagle 1-1,AirSup) 	/Flag On (250) && Flag Off (350)
			Unit outside Zone (Fulcrum 1-1,AirSup)		
			Unit outside Zone (Fulcrum 1-2,AirSup)
			…
			[or]
			Unit inside Zone(Eagle 1-2,AirSup)
                               Unit outside Zone (Fulcrum 1-1,AirSup)		
			Unit outside Zone (Fulcrum 1-2,AirSup)		

 

so it is not a problem to setup this stuff - but if i increase the numbers of aircrafts on both side (FC-3 is coming :music_whistling: ), the conditions setup will be a cluster **** (in particular is you search for errors).

 

So i like to check the condition for the trigger zone with a script.

I hope, that i need only to add or removed the unit names to a list and not add all conditions for the new aircraft again and again.

 

Edit: i can`t check for Blue or Red outside of the trigger zone, because Ka-50 and ground units shouldn`t count for it!


Edited by mwd2

Playing: F-16C

Intel i7-13700KF, 64GB DDR5 @5600MHz, RTX 4080 ZOTAC Trinity, WIN 11 64Bit Prof.

Squadron "Serious Uglies" / Discord-Server: https://discord.gg/2WccwBh

Ghost0815

Link to comment
Share on other sites

what exactly are you looking for though?

 

A script intended to be loaded at mission start (or, example, +10 seconds, like SLmod) that activate a particoular triggered actions on it's group every time that the flag "n" is activated.

 

Reason: I want to use SLmod to activate Triggered AI task on groups by flag activations whithout have to set a trigger in the trugger system.

 

This is because I always use a "set" of group with defined names and triggered actions, I copy & paste them between mission files to keep all the advanced waypoints action and triggered actions instead of using templates. Be capable to load a defined script file by "RUN SCRIPT" action will let me to have all the wanted triggered actions in any mission whitout having to write down one or two hundred of trigger for any file.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Grimes/Speed/Druid..

 

Any chance we can get a WIP glimpse and the scripts you have to date.

 

Would love to see some wip stuff if possible rather than wait an undisclosed time for everything to be 'perfect'. :)

 

I understand you want to present a clean thoroughly tested script set... maybe you are close to releasing, or maybe you are months away.. just keen to 'have a go'. :)

i5-3570K @ 4.5 Ghz, Asus P8Z77-V, 8 GB DDR3, 1.5GB GTX 480 (EVGA, superclocked), SSD, 2 x 1680x1050, x-fi extreme music.



TM Warthog, Saitek combat pro pedals, TrackIR 4

Link to comment
Share on other sites

I'm not at my computer right now, so I can't test anything I make, but I can still make them- what exactly are you looking for though?

 

Well, here's one example, something you can't do with the mission editor, at least without creating lots of annoying zones and triggers to detect units in zone.

 

Create signal flare on a group of units:

--in a doscript trigger action
local units = Group.getByName('convoy1'):getUnits()  -- "convoy1" is the name of the group in the ME
if #units > 0 then
local unit1pos = units[1]:getPosition().p
trigger.action.illuminationBomb({x = unit1pos.x, y = unit1pos.y + 1000, z = unit1pos.z})
end

 

Eh? Unless i misunderstand.. its very easy to have a signal flare on a group of units within the editor.

 

(moving zone & flare on zone)

i5-3570K @ 4.5 Ghz, Asus P8Z77-V, 8 GB DDR3, 1.5GB GTX 480 (EVGA, superclocked), SSD, 2 x 1680x1050, x-fi extreme music.



TM Warthog, Saitek combat pro pedals, TrackIR 4

Link to comment
Share on other sites

Eh? Unless i misunderstand.. its very easy to have a signal flare on a group of units within the editor.

 

(moving zone & flare on zone)

 

Its a little more than that. What that script does is it always deploys an illumination flare on the first unit in the group. If for example that unit were to be killed the flare appears on the new "first unit." If done via triggers then the flare will always spawn on the first unit. If that unit dies the trigger stops working. You'd have to add additional triggers for this sort of thing to work via triggers. This script will work as long as the group is alive.

 

I'm a little hesitant to release code for unreleased missions/tools, especially for the stuff that isn't 100% mine. I'd also rather not release something until its completed, but here is a VERY useful script I had great interest in developing and Speed helped me out quite alot with. Attached below is whats called a "point in polygon" test using the crossing number method. You can find out some information about it here: http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm

 

It draws the shape by "connecting the dots" of the vehicle group and it allows for negative space. Odd numbers are "inside" even are outside.

 

 

@chromium, At least for ground units we don't have much control over these sort of commands with the scripting engine. Air units are a different matter. Unfortunately I have not experimented with it much so I can't be much help with you in this regard.

 

@mwd2. Here is a quick example... I didn't test this but the concept works:

 

local teamcount = 0
client_aircraft = {'Player_1', 'Player_2', 'Player_3', 'Player_4' , 'Player_5'} --name of units you want to check
for i = 1, #client_aircraft do
	local player = Unit.getByName(client_aircraft[i])

	local pos = player:getPosition()
	local px = pos.p.x
	local pz = pos.p.z
               if math.sqrt(((center_zone.point.x - px)^2) + ((center_zone.point.z - pz)^2)) < center_zone.radius  then
teamcount = teamcount+1
end
if teamcount > 0 then
print('this team has players in the zone')
end

end

 

Its not exact, but thats the general idea. You put the UNIT names in the client_aircraft table and it will step through it one at a time to see if the unit is in the zone and it will add to the teamcounter.

 

The general sort of script you want is something I am working on currently on a larger scale, but its not ready for release.

convex_zone_release.lua

pointInPolygon.miz

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

Is unit creation/spawning possible now? What about moving units from one point to another?

 

We cannot spawn units that were not placed in the editor.

We can't change the starting location of units. With aircraft we can change their flight plan to send em to any spot on the map. Ground units currently lack this capability.

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

Could this scripting engine be used to pause a server if nobody is connected and resume when somebody enters ?

 

This function is available in Servman, and actually the only one we'd need.

Since Servman is not updated for 1.2.1, this could be a nice alternative.

dUJOta.jpg

 

Windows 11 | i9 12900KF | 64GB DDR4 | RTX 3090 | TM Warthog HOTAS | Saitek Combat Rudder Pedals | TM MFDs + Lilliput 8" | TIR5 Pro

Link to comment
Share on other sites

  • Recently Browsing   0 members

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