{"id":21586731,"url":"https://github.com/behringer24/dcs-industry","last_synced_at":"2025-04-10T20:21:01.893Z","repository":{"id":63345403,"uuid":"566247039","full_name":"behringer24/DCS-Industry","owner":"behringer24","description":"Industry script for DCS World","archived":false,"fork":false,"pushed_at":"2024-07-13T20:09:17.000Z","size":98,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T17:55:25.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/behringer24.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-15T09:18:40.000Z","updated_at":"2024-11-03T11:21:17.000Z","dependencies_parsed_at":"2023-12-04T09:22:39.566Z","dependency_job_id":"5f4c18dc-132f-424e-aaa2-8774b52a17c9","html_url":"https://github.com/behringer24/DCS-Industry","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behringer24%2FDCS-Industry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behringer24%2FDCS-Industry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behringer24%2FDCS-Industry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/behringer24%2FDCS-Industry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/behringer24","download_url":"https://codeload.github.com/behringer24/DCS-Industry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248289862,"owners_count":21078922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T15:14:31.056Z","updated_at":"2025-04-10T20:21:01.875Z","avatar_url":"https://github.com/behringer24.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DCS-Industry\nIndustry script for DCS World\n\n## Description\nIndustry adds a ressource management and respawn system to DCS missions. All AI units need ressources to\nrespawn. If the mission is well balanced this leads to a very dynamic battlefield where the player(s) make\nthe difference. Industry can be used for single- or multiplayer missions.\n\nRessources are generated through factories. Production is increased per laboratory and ressources are evenly\nstored in storage facilities. All are represented by static units of your choice, they only have to have the correct unit names (see below).\n\nDiscuss on Discord: https://discord.gg/bTzjqZKa\n\n## Features\n- Regular production of new ressources in factories\n- Delivery of ressources by aerial transport missions or convoys on the ground\n- Convoy deliveries are evaluated if the right units (e.g. Trucks and how many of them) are still in the group upon delivery\n- Limited storage of ressources in storage facilities\n- Respawns (of AI units for now) depending on available ressources\n- Automatic handling of AI unit crashes, dead groups, RTB on bingo fuel or out of ammo\n- factories, storages and transports can (and should) be destroyed in player or AI missions\n- additional optional 'secondary' strike objectives can be placed to allow casual scoring\n- mission ends if no storages are left (limits ressources to 0) and allows a 10 minutes countdown\n\n## Requirements\nIndustry relies on MIST. The latest tested version to work with Industry is MIST version 4.5.126\n- Wiki/Homepage: https://wiki.hoggitworld.com/view/Mission_Scripting_Tools_Documentation\n- ED-Forum: https://forum.dcs.world/topic/82178-mission-scripting-tools-mist-enhancing-mission-scripting-lua\n- GitHub: https://github.com/mrSkortch/MissionScriptingTools\n\n## Installation\n- Download and unpack the MIST .lua file from https://github.com/mrSkortch/MissionScriptingTools/releases\n- Download the industry.lua file from this repo\n- Copy both files where you will find them in the mission editor file open dialog\n- In your DCS mission editor add a trigger with once, time \u003e 1sec and two \"do script file\" actions.\n  In the first action load the MIST .lua file, in the second load the Industry .lua file\n\n## Mission setup\n### Adding factories\nFactories produce 10 tons of ressources every cycle if they are not destroyed. The amount can be configured (see below).\n\nYou can use any static object to use as a factory facility. I prefer to use the oil pump, or some bigger factory-like looking buildings.\n\nTo be detected / handled as a factory, the static objects unit name just has to start with \"Factory[...]\". The rest of the name can be whatever you like.\n\n### Adding laboratories\nLabs increase the production of factories by 10% (each, not stacked). The percentage boost can be configured.\n\nUse any static object as a lab. To be handled as a laboratory, the static objects unit name just has to start with \"Laboratory[...]\".\n\n### Adding storages\nAny static object can be used as a storage facility. Just place a static object that looks like a storage (like a liquid-tank or \"small werehouse\").\n\nTo be detected / handled as a storage facility, the static objects unit name just has to start with \"Storage[...]\".\n\nStorages hold 1000 tons of ressources per default until they are destroyed.\n\nRessources are distributed evenly between storages. If a storage is destroyed then the ressources are lost in the quota that had been hold in that storage.\n\n### Adding additional objectives\nAny static object can be aded as an additional objective to the mission. These objectives are regarded as optional and are useful as additional strike missions.\n\nTo be detected / handled as an aditional objective, the static object unit name just has to start with \"Secondary[...]\".\n\n### Adding convoys\nCreate a group that acts as a convoy and set its waypoints.\n\nAt the destination waypoint add an \"Advanced Waypoint Action\" \"Perform Command\" -\u003e \"Script\" and add into the text box\n\n``` lua\nindustry.addRessourcesConvoy(\"ConvoyBlue-1\", \"M 818\", 100);\nindustry.queueRespawn(\"ConvoyBlue-1\", 0)\n```\n\n* *industry.addRessourcesConvoy* is the command to add ressources of a convoy to the storages\n* *ConvoyBlue-1* is the name of the group. The name is just an example, replace this with the name of your group\n* *M 818* is the DCS type name of the units in the group that carry the ressources. In this case it is the internal name of the M939 truck.\n* *100* is the amount of ressources each unit (M 818 in this case) carries\n* *industry.queueRespawn* is the command to put the \"*ConvoyBlue-1*\" group into the queue for respawning\n* *0* is the amount of ressources the respawn will cost. In this case 0 tons. The convoy was not destroyed but reached its destination. more in the chapter about *queues*.\n\n### Adding air transports\nAir transports, that deliver ressources, work a bit different than convoys. The reason is that the end waypoint does not allow scripts and air units might land at a different airports due to damages or other AI decisions.\n\nJust add a single air transport unit and send it to your \"homebase\" airport with a landing waypoint.\n\nYou need to create a trigger for each air transport. The Industry script handles the engine shutdown for each air unit and queues them for respawn (if they are in a respawn group, see below). Set the trigger to \"Continuous\", or this trigger would only work once.\n\nFor Rules add \"Flag is true\" and for the flag name enter then name of the unit (not group!) and append \"*_landed*\" for example: \"*TransportBlue-1-1_landed*\".\n\nFor \"Actions\" add a \"Do Script\" action and enter\n\n``` lua\nindustry.addRessourcesTransport(\"blue\", 800)\n```\n\n* *addRessourcesTransport* is the command to add ressources for a coalition due to this event.\n* *\"blue\"* the coalition to add ressources for, red or blue. But do not forget the quotes.\n* *800* the amount in tons to add\n\nYou also need to set the Flag back to false via the addidional action \"Clear flag\" and the name of the flag above, in our example: \"*TransportBlue-1-1_landed*\". Or this would trigger every second again and again.\n\n### Respawning groups\nYou can set every group you like as an automatic respawn group. When the group is dead it is queued for respawn. Different events are detected to determine the death of a unit and if it was the last one the whole group.\n\nYou can turn every AI group into a respawn group (NOT player/client groups!).\n\nWhen the mission starts (and after industry script was initialized) you just need to call\n\n```lua\nindustry.addRespawnGroup(\"RedCAP-3\", 200)\n```\n\n* *addRespawnGroup* is the command to add a group to the list of automatically respawning groups\n* *RedCAP-3* is the name of your group you want to respawn. The name is just an example, replace this with the name of your group\n* *200* are the cost of ressources in tons to respawn this group, can also be 0\n\nI set this into a \"Do script\" command in the same trigger where I load the MIST and industry .lua files. I prefer creating an additional init.lua file, where i put all of the addRespawnGroup commands and configuration parameters.\n\n### Configuration\nIndustry supports the following configurations (with its default values).\n\n``` lua\nindustry.config.startRessources = 200\nindustry.config.factoryProduction = 30\nindustry.config.storageCapacity = 1000\nindustry.config.productionLoopTime = 300\nindustry.config.respawnLoopTime = 60\nindustry.config.labsboost = 10\nindustry.config.checkDeadGroupsTime = 300\nindustry.config.respawnRetriesOnQueue = 2\nindustry.config.winCountdownLength = 600\nindustry.config.tickets = 100\nindustry.config.ticketsLow = 20\n```\n\n#### industry.config.startRessources\nhow many tons of ressources does each coalition have right from the start of the mission. Has direct consequences how the mission continues after the first wave of spawned ai units have clashed.\n\n#### industry.config.factoryProduction\nHow many ressources one factory produces each round/loop run. This is later increased by laboratories. This value is increased by 1 for all factories together (to avoid only 10th of increasement and add some variation to the numbers)\n\n#### industry.config.storageCapacity\nHow many ressources can be stored in each storage facility.\n\n#### industry.config.productionLoopTime\nHow many seconds does ech production cycle take. After this the ressources are added to the storages. If a factory was destroyed during a production cycle the ressources produced so far (in this factory) are lost.\n\n#### industry.config.respawnLoopTime\nHow long does a respawn loop take. After this amount of seconds the four queues are checked and tried to respawn. See below for how queues work and retries/force.\n\n#### industry.config.labsboost\nA percentage value calculated from the base production of all factories together. So if we have 3 factories producing 30 tons each we have a base production of 90. so each laboratory increases production by 10% of 90 = 9 tons. Five labs would add 45 tons of produced ressources each turn.\n\n#### industry.config.checkDeadGroupsTime\nThis is more of a technical feature and usually does not need to be changed. This is how often (time in seconds) the script checks for dangling dead groups and adds them to the respawn queue. they still need to be configured as respawn group.\n\n#### industry.config.respawnRetriesOnQueue\nThis is more of a technical feature and usually does not need to be changed. If a group cannot respawn, because one unit is not (finally) dead like a plane shot down but not already crashed. The respawn is retried and this is the maximum amount of retries.\n\n#### industry.config.winCountdownLength\nHow many seconds does the RTB countdown take after one side has one (or mission is draw). Should be a multiple of 60 sec (one minute). Only the last seconds are count down and displayed. Until then every full minute is shown.\n\n#### industry.config.tickets\nWith how many tickets does each side start. Tickets are reduced by one every minute. Tickets are reduced by one with each human player death and by destructions of labs, factories and storages (the infrastructure as primary mission goals).\n\n## How it works\n### Tickets\nThere are two different types of ressources in Industry. The first one are *tons of production ressources* usually only called *ressources* and there are *tickets*. Tickets are limiting the time for one mission, so you server resets after a maximum number of minutes (measured in tickets). They are the main unit to focus on for winning the mission.\n\nTickets are reduced for both sides by one every minute. So if you set the *industry.config.tickets' config value to 120 the maximum time for the mission is 2 hours (120 minutes).\n\nEach time a human pilot/player is killed (his plane, so ejecting does not help) the number of tickets for his coalition is reduced by one.\n\nEach time a storage, lab or factory is destroyed the amount of tickets is reduced too.\n\nIf a HQ is destroyed the remaining tickets are reduced by half of the remaining tickets. So if 48 tickets where left, the tickets are reduced to 24, for example.\n\nFocussing on the mission goals (destroying strategic targets like HQs, labs, factories and storages) and shooting down players makes your side winning.\n\n### Ressources\nRessources are produced by factories, delivered by air-transport or convoys. The mission designer could also set up trains. This totally depends on the mision design.\n\nFactory production is increased per lab by a configured percentage amount.\n\nRessources are needed to respawn (AI) units that are queued for respawning.\n\n### Queues\nIndustry uses four respawn queues. One for \"free\" (0 tons of ressources) respawns and one for respawns that cost more than 0 tons of ressources. And these two queues for red and blue side each.\n\nRespawns are triggered every 60 seconds, this is the default value and can be configured. The process checks the top of each of the four queues and respawns that group if the ressources are available. Then the group is removed from the top of the queue.\n\nNew units to respawn (convoy or destroyed groups) are added to the end of the queue (FIFO principle) and wait for their turn.\n\nThis is why there is a free queue for blue and red side - they should not wait for groups that can't be afford due to low ressources.\n\n### Find lost groups and retries\nThe DCS AI has some very special cases where the unit does not exist any more but it is not triggered as a \"death\". So every 300 seconds / 5 minutes the script checks all respawn groups if there are no more units alive and tries to requeue them for respawn. Like a garbage collection.\n\nIf a group is already in the respawn group and ready to respawn, but the group is not dead (still falling plane wreck from the sky) the respawn is postponed - this avoids removing the crashed plane from the middle of its descent and respawn it at its origin. This would look weird. So the respawn will be retried the next loop run. This is retried maximum of 2 times (can be configured), then the respawn is forced (due to crash landed dead but undead wrecks and such).\n\n### Pilot ejects\nOne of these cases that are not trivial in some cases are pilot ejects from units that are not destroyed (crashed but not destroyed helicopters). Industry script does explode the plane after the pilot ejects to make sure the unit is dead afterwards. This is only done for auto respawning groups.\n\n### Respawning convoys or transports\nJust an idea for your mission design: set the respawn costs for convoys and transports to 0, so these can still respawn if this coalition is very low on ressources. Or the coalition would not be able to recover - and nothing respawns. The mission could get stuck or leave them helpless even if the player does nothing.\n\n## Custom Flags\nSome events set custom flags to be used outside the script and directly in the mission editor of DCS\n\n### Destroyed objectives\nFor each destroyed objective a custom flag is set to true.\n\n### Automatic CSAR misions\nIf a pilot succesfully landed his parachute (player or AI) industry creates an automatic CSAR mission. You only have to have an uncontrolled helicopter unit on each side named blueSAR or redSAR (name of the group). Ideally the helicopter should have a recognizeable livery to show them as CSAR missions.\n\n```\n[name of object]_destroyed\n```\n\n[name of object] is the full name you gave the object in the edit that has been destroyed. Can be caught with a trigger/once.\n\nExample:\n```\nStorageBlue-1_destroyed // if the object was named \"StorageBlue-1\"\n```\n\nAddidtionally a \"class\" type flag is set to true, too. For example these flags can be used to play custom sounds or add more events switched from the editor level.\n\n```\n[red/blue]FactoryDestroyed\n[red/blue]StorageDestroyed\n[red/blue]LaboratoryDestroyed\n[red/blue]HQDestroyed\n```\n\nExample:\n\n```\nblueStorageDestroyed // if it was a blue storage that got destroyed\n```\n\nIn the class type triggers do not forget the flag back to false or 0 after it got handled in the editor so it can be handled multiple times (if needed).\n\n### Threshold for tickets\nIf the tickets of one side run below a threshold a corresponding trigger (\"ticketsLowBlue\" or \"ticketsLowRed\") is set to true. You can use this trigger to switch events in your custom mission.\n\nThe threshold is configured by the variable\n```\nindustry.config.ticketsLow = 20 // default\n```\nand can be set in your config.\n\n### Plane landed\nIf a plane landed and shut down its engines a flag with the name\n\n```\n[name of unit]_landed\n```\n\n[name of unit] is the full name you gave the unit (not the group!) in the editor. This can be used to set up air transports in the editor or trigger other events.\n\n### Group respawned\nIf a group is respawned by the industry script a custom flag is set to true\n\n```\n[name of group]_respawned\n```\n\nIf you use this event do not forget to set it back to false, so the event can be re-triggered.\n\n### Side won\nIf one side loses because their tickets are down to zero first a custom flag is set to true\n\n```\nmissionWinRed\nmissionWinBlue\nmissionWinNeutral\n```\n\nIf both sides have 0 tickets left the flag missionWinNeutral is set. You should use these events to handle the end of the mission in the editor.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbehringer24%2Fdcs-industry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbehringer24%2Fdcs-industry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbehringer24%2Fdcs-industry/lists"}