DCS command script: Difference between revisions
From DCS World Wiki - Hoggitworld.com
m 1 revision imported |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 30: | Line 30: | ||
'''Optional Parameters''': | '''Optional Parameters''': | ||
|enum= N/A | |enum= N/A | ||
|exam= | |exam= The following would be used to automatically update a table with the current waypoint an AI group is on. The first segment of code is a globally accessible function that will populate and +1 the value associated with a given group. | ||
local aiCurrentWaypoints = {} | |||
function iterWP(gp) | |||
local gName = gp:getName() | |||
if not aiCurrentWaypoints[gName] then | |||
aiCurrentWaypoints[gName] = 0 | |||
end | |||
aiCurrentWaypoints[gName] = aiCurrentWaypoints[gName] + 1 | |||
end | |||
The following would need to be added to every single waypoint as a script command for the groups you wish to update their WP status. | |||
local gp = ... | |||
iterWP(gp) | |||
|notes= | |notes= | ||
See article [[Mission Editor: AI Tasking]] for more information on how AI tasking is handled within DCS. | See article [[Mission Editor: AI Tasking]] for more information on how AI tasking is handled within DCS. | ||
See: [https://www.lua.org/pil/5.2.html Lua documentation on variable number of arguments] in DCS this variable can be used within the script and script file group tasks to reference the "self" group object of the group. | |||
Latest revision as of 02:09, 2 April 2024
