From 0392c43835a246bd50675d5965eb8ba3571a7dfb Mon Sep 17 00:00:00 2001 From: bobprofisker Date: Sat, 20 May 2023 22:16:41 +0100 Subject: [PATCH] Add files via upload Wasn't sure if you were serious about wanting the code for how to get all the coalitions out of the mission file, this is how you do it and how you can get a string for what it actually is if that is needed. --- scripts/coals.lua | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 scripts/coals.lua diff --git a/scripts/coals.lua b/scripts/coals.lua new file mode 100644 index 00000000..445e1473 --- /dev/null +++ b/scripts/coals.lua @@ -0,0 +1,47 @@ +coal = {} + +function coal.notify(message, displayFor) + trigger.action.outText(message, displayFor) +end + +function coal.listRed() + coal.coals = env.mission.coalitions.red --solid naming this + coal.notify(mist.utils.tableShow(coal.coals),5) + pickOne = math.random(#coal.coals) + countryIs = country.name[coal.coals[pickOne]] + coal.notify(countryIs,10) +end + +function coal.listBlue() + coal.coals = env.mission.coalitions.blue --solid naming this + coal.notify(mist.utils.tableShow(coal.coals),5) + pickOne = math.random(#coal.coals) + countryIs = country.name[coal.coals[pickOne]] + coal.notify(countryIs,10) +end + +function coal.listNeutrals() + coal.coals = env.mission.coalitions.neutrals --solid naming this + coal.notify(mist.utils.tableShow(coal.coals),5) + pickOne = math.random(#coal.coals) + countryIs = country.name[coal.coals[pickOne]] + coal.notify(countryIs,10) +end + + +do + longRangeShots = missionCommands.addSubMenu("Coal check") + missionCommands.addCommand ("List reds", longRangeShots, coal.listRed) + missionCommands.addCommand ("List blue", longRangeShots, coal.listBlue) + missionCommands.addCommand ("List neutrals", longRangeShots, coal.listNeutrals) + +end + +coal.notify("coals.lua loaded", 2) + + +-- env.mission.coalitions.red +-- env.mission.coalitions.blue +-- env.mission.coalitions.neutrals + +--coalition.getCountryCoalition(countryID) \ No newline at end of file