Jump to content

shnicklefritz

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by shnicklefritz

  1. Thanks, I just thought there might be a place as at the end of the mission in the debriefing you can sift through the different events, sorting by event, initiator, coalition, etc. I just didn't want to create an event handler and have a massive table if there was a more efficient way of going back through and adding it retrospectively.
  2. If I'm not mistaken, when you assign a tanker the task on the menu bar, on the right hand side of the mission editor, it will have the tanker task through all of its waypoints. As a result, it will respond to rejoin requests at anytime during the flight, regardless of where it is on its flight path. This is subject to the exception that if RTB on bingo is set true (or checked), it will go straight home and won't respond to anything. If you delete that task (the one that is in all waypoints) and instead add the tanker task say, for example, at waypoint 5 and ends at waypoint 8, it will only respond to rejoin requests after it reaches 5 and will cease after reaching 8. Also, if you have orbit at 7, it will orbit at 7, to the waypoint 8 point, but will not trigger waypoint 8. This is my experience, and someone may have other information / experience that may be along shortly. Hope this helps.
  3. It's a feature in CTLD. You would need to setup the zones that you want where troops/diplomats/whatever are going to be picked up, these are under the ctld.pickupZones table. Just look at the instructions in CTLD for pickup zones. You can set a limit on the zones. But when in a pickupzone, you will be allowed to pickup all of the types of troops from the ctld.loadableGroups table. So you will want to make sure your loadable groups are named and limited appropriately. After you have the CTLD settings you like, you need to create the extract zones. These are the zones where you return troops/diplomats/whatever. To create these, paste these in DO SCRIPT action with a condition of time more, 1 or more seconds to allow the main CTLD file to upload. Paste the following for every extract zone you want to create, also make sure you have these zones created in the mission editor with the names matching exactly: mind the caps, lua is case sensitive. ctld.createExtractZone(_zone, _flagNumber, _smoke) For example, ctld.createExtractZone(MyZone, 100, 0) will create a extract zone at the location in the mission editor called "MyZone." Every time troops are dropped in the zone, flag 100 will increase by the number of troops dropped, i.e., if there are 10 troops in your loadableGroups, Flag 100 will equal 10 on the first drop and increment by 10; 0 would mean green smoke. Then in a separate mission editor trigger, have a trigger that when FLAG EQUALS, 100 and whatever value you want, then whatever ACTION you want.
  4. Can anyone tell me if there is a way to sift through events after they happen, rather than on event with an event handler?
  5. Paste this code in ONCE trigger, No Conditions, ACTION DO SCRIPT; then change the names in the "EWR_GroupNames" table to the group names you have in the mission editor. Also, set the "activeScanTime to the number of seconds each EWR will scan. It doesn't necessarily account for randomization of the EWR group if one dies, nor does it account for more than three EWRs, though these two issues can be changed; however, it does what you ask. EWR_GroupNames = { --exact Group names from the mission editor, include #001 if applicable. "GroupNameFromMissionEditor", "GroupNameFromMissionEditor2", "GroupNameFromMissionEditor3", } activeScanTime = 300 --seconds, how long each EWR will scan for i=1, #EWR_GroupNames do --this turns the EWRs off, initially. local group = Group.getByName(EWR_GroupNames[i]) if group ~= nil and group:isExist() then group:getController():setOnOff(false) end end activeScanner = {} --keeps track of active scanner function ewrScanner() local r = nil local activeGroup = nil if #activeScanner == 0 or activeScanner == nil then r = math.random(1, 3) else r = math.random(1, 2) activeGroup = Group.getByName(activeScanner[1]) if activeGroup ~= nil and activeGroup:isExist() then activeGroup:getController():setOnOff(false) table.remove(activeScanner, 1) table.insert(EWR_GroupNames, activeGroup:getName()) end end local newScanner = Group.getByName(EWR_GroupNames[r]) if newScanner ~= nil and newScanner:isExist() then newScanner:getController():setOnOff(true) table.insert(activeScanner, newScanner:getName()) table.remove(EWR_GroupNames, r) end timer.scheduleFunction(ewrScanner, nil, timer.getTime() + activeScanTime) end ewrScanner()
  6. There is no way to reference which specific unit triggered your condition in a zone based on current mission editor triggers. There is a way to reference or iterate, rather, through each group, then each groups units’ positions to see if any one of them is in the zone. I personally am unaware of any other way. This is why MiST exist. In fact, MiST has a function that does exactly what you describe. https://wiki.hoggitworld.com/view/Mission_Scripting_Tools_Documentation function unitsInZone() local allBlueAircraft = coalition.getGroups(2, 0) -- (1=RED 2=BLUE, 0==AIRCRAFT) local zone = trigger.misc.getZone("myMissionEditorZoneName") for i, group in pairs(allBlueAircraft) do if group ~= nil and group:isExist() == true then local units = group:getUnits() for _i, unit in pairs(units) do local uPos = unit:getPoint() if (((uPos.x - zone.point.x)^2 + (uPos.z - zone.point.z)^2)^0.5 <= zone.radius) then local unitName = unit:getName() trigger.action.outText("This unit is in the mother lovin zone: "..unitName, 10) --other functions can be run here too. end end end end timer.scheduleFunction(unitsInZone, nil, timer.getTime() + 5) --will run the function every five seconds for the entirety of the mission end unitsInZone() --initiates the function
  7. Currently I am thinking you have to call the destroy function and then respawn the group with the added unit. Is there an easier way to add a unit, to an existing group, that was killed / destroyed back into that group to simulate a repair? Thanks in advance.
  8. This code should help, sorry, I mis-read what you posted earlier; for some reason I thought you wanted to delete some on a trigger at one time and some and a later time. This code works for me: do local statObj = coalition.getStaticObjects(2) --(1=Red 2=Blue) for i, static in pairs(statObj) do local staticName = static:getName() if string.match(staticName, "StaticDelete.*") then --test names are "StaticDelete" the .* tells is to ignore anything after this. static:destroy() end end end
  9. Updated the above code, if anyone is interested. Accepts both coalitions. If a proper tanker isn't available, i.e., need a boom but only basket is available, the aircraft ignores the command. No need to input aircraft names, automatically tracks all coalition aircraft that are refuellable in air and tasks them to refuel based on the parameters you set. You can set a parameter that if the aircraft is within x meters of base, it will ignore the task to refuel. Will update this, eventually, to add message to coalition when aircraft tasks to a tanker. lowFuelPercentage = 35 --number, percentage: percent when aircraft dips below that will prompt it to go for fuel lowFuelCheckTime = 60 --number, seconds: How often the function will check aricraft fuel levels lowFuelCoalition = "Blue" --string: "Both" or "Red" or "Blue" Which coalition are you sending to tanker distanceFromEnemy = 30000 --number, meters: 30km Not working at moment distanceFromBase = 92600 --number, meters: 92.6km (50nm) distance from final waypoint that a group will ignore the command to go to tanker aircraftTaskedToRefuel = {} function fuelTracker() local aircraftTable = {} local aircaftLowFuel = {} aircraftTable = populateAircraft() for i, grpName in pairs(aircraftTable) do if grpName ~= nil then if not aircraftTaskedToRefuel[grpName] then local group = Group.getByName(grpName) if group:isExist() == true then local closerToBase = areCloseToBase(grpName) if closerToBase == true then local units = group:getUnits() if units ~= nil then for x, unit in pairs(units) do if unit:hasAttribute("Refuelable") == true then if unit:hasAttribute("Tankers") == false then local fuel = unit:getFuel() if (fuel / .01) <= lowFuelPercentage then local groupName = unit:getGroup():getName() aircaftLowFuel[#aircaftLowFuel+1] = groupName end end end end end end end end end end for i, grpName in pairs(aircaftLowFuel) do if grpName then aircraftTaskedToRefuel[grpName] = {unitNo = {}} local group = Group.getByName(grpName) local units = group:getUnits() for x, unit in pairs(units) do aircraftTaskedToRefuel[grpName].unitNo[#aircraftTaskedToRefuel[grpName].unitNo+1] = {unitName = unit:getName(), unitFuel = unit:getFuel() / .01, unitCall = unit:getCallsign()} end end end for i, grpName in pairs(aircaftLowFuel) do if grpName then --local enemyNear = aircraftDetectedTars(groupName) --if enemyNear == false then goToTanker(grpName) aircaftLowFuel[grpName] = nil --end end end timer.scheduleFunction(fuelTracker, {}, timer.getTime() + lowFuelCheckTime) end function areCloseToBase(groupName) local points = mist.getGroupPoints(groupName) local maxWypt = 0 for i, v in pairs(points) do if i >= maxWypt then maxWypt = i end end local maxWyptPoint = points[maxWypt] local unitPos = Group.getByName(groupName):getUnit(1):getPoint() local distToHome = getDistanceAir(maxWyptPoint, unitPos) local maxDistFrom = distanceFromBase if distToHome >= maxDistFrom then return true else return false end end function checkForTanker(groupName) local side = Group.getByName(groupName):getCoalition() local groups = coalition.getGroups(side, 0) for i, group in pairs(groups) do if group then if group:isExist() == true then if group:getUnit(1):isActive() == true then if group:getUnit(1):hasAttribute("Tankers") == true then return true end end end end end end function goToTanker(groupName) local isTanker = checkForTanker(groupName) if isTanker == true then local group = Group.getByName(groupName) local task = { id = 'Refueling', params = {} } local controller = group:getController() controller:pushTask(task) end end refuelStopEvent = {} function refuelStopEvent:onEvent(event) if event.id == 14 and event.initiator:getPlayerName() == nil then local unit = event.initiator local group = unit:getGroup() --if #aircraftTaskedToRefuel[group:getName()].unitNo > 1 then --timer.scheduleFunction(removeGroupFromTasked, {group:getName()}, timer.getTime() + 20) --else timer.scheduleFunction(removeGroupFromTasked, {group:getName()}, timer.getTime() + 120) --end end end world.addEventHandler(refuelStopEvent) function removeGroupFromTasked(args) local groupName = args[1] aircraftTaskedToRefuel[groupName] = nil end function populateAircraft() local aircraftTable = {} local lowFuelCoaCheck = string.lower(lowFuelCoalition) if lowFuelCoaCheck == "blue" then local blueAircraft = coalition.getGroups(2,0) for i, ac in pairs(blueAircraft) do if ac ~= nil then if ac:isExist() == true then aircraftTable[#aircraftTable+1] = ac:getName() end end end end if lowFuelCoaCheck == "red" then local redAircraft = coalition.getGroups(1,0) for i, ac in pairs(redAircraft) do if ac ~= nil then if ac:isExist() == true then aircraftTable[#aircraftTable+1] = ac:getName() end end end end --lowFuelCoaCheck == "red" or "both" doesn't ****ing work... if lowFuelCoaCheck == "both" then local redAircraftAll = coalition.getGroups(1,0) local blueAircraftAll = coalition.getGroups(2,0) for i, ac in pairs(redAircraftAll) do if ac ~= nil then if ac:isExist() == true then aircraftTable[#aircraftTable+1] = ac:getName() end end end for i, ac in pairs(blueAircraftAll) do if ac ~= nil then if ac:isExist() == true then aircraftTable[#aircraftTable+1] = ac:getName() end end end end return aircraftTable end function getDistanceAir(point1, point2) local xUnit = point1.x local yUnit = point1.y local xZone = point2.x local yZone = point2.y local xDiff = xUnit - xZone local yDiff = yUnit - yZone return math.sqrt(xDiff * xDiff + yDiff * yDiff) end
  10. Yes it will. The only thing, that I am aware of, with fuel tanks is that -n aircraft will return greater than 1.00 or 100% with fuel tanks. So for example, when fully fueled with fuel tanks, a hornet might show 1.45 (145%) or whatever; I am making that up. But it will steadily reduce to 0 over time and doesn’t effect the script. Disclaimer: I haven’t tested this script without a tanker, meaning it might throw an error when tasking the AI if the tanker is killed, RTBs, or otherwise disappears from the missions. I am away from my desktop and will not be able to test it until later this week. But I will try to add something in anyway when I get time.
  11. Tasking an AI to go to the nearest tanker at a given fuel level is not challenging. The difficulty arises when deciding 1) when the aircraft should NOT go for fuel; and 2) after the aircraft is done refueling, what then? Once an AI is done refueling at a tanker, it will simply return to its route. And if the next route is return to base, it will do so. Example: if an aircraft is on its way to base from a mission, if it meets the parameters, i.e., below percentage of fuel, it could abandon its approach and attempt to go to the nearest tanker, which could be 200nm away. Here is a start. To run this: 1) change the names "Hornet", "Hornet2" in the aircraft table to the group names in the mission editor that you want to track. You can add group names to the table, just make sure they follow the same format, i.e., wrapped in "" followed by a comma. 2) Change the percentage to your liking. Right now its set to send the AI once the get to or below 30%. 3) Set how often you want the function to run. Currently, it will check every 30 seconds. You can change that to whatever you want. Make sure it is a number. 4) Set trigger in the mission editor "ONCE," no conditions, Do script, and paste the below code in the box. 5) Set another trigger with a time delay of whatever, 30 seconds, doesn't matter, but should be at least 1 second, Do script and paste fuelTracker() in it. This will run the function once, but then the function is built to repeat itself ever x amount of seconds (as you set in the lowFuelCheckTime parameter). I will add to this when I have time. Hopefully this will help you get started. lowFuelPercentage = 30 lowFuelCheckTime = 30 aircraftTable = { "Hornet", "Hornet2", } aircaftLowFuel = {} function fuelTracker() local tempTable = {} for i, grp in pairs(aircraftTable) do if grp ~= nil then local group = Group.getByName(grp) if group:isExist() == true then local units = group:getUnits() if units ~= nil then for x, unit in pairs(units) do tempTable[#tempTable+1] = unit:getName() end end end end end for i, val in pairs(tempTable) do if val ~= nil then local unit = Unit.getByName(val) local fuel = unit:getFuel() local fuelThresh = (lowFuelPercentage *.01) if fuel / 1 <= fuelThresh then local dispFuel = math.floor(fuel) local groupName = unit:getGroup():getName() if not aircaftLowFuel[groupName] then aircaftLowFuel[groupName] = {unitName = unit:getName(), fuel = unit:getFuel() / 1} end end end end for groupName, t in pairs(aircaftLowFuel) do if groupName then goToTanker(groupName) aircaftLowFuel[groupName] = nil end end timer.scheduleFunction(fuelTracker, {}, timer.getTime() + lowFuelCheckTime) end function goToTanker(groupName) local group = Group.getByName(groupName) local task = { id = 'Refueling', params = {} } local controller = group:getController() controller:pushTask(task) end
  12. Does anyone know if there is any function that can be used to determine, or any trigger that occurs, when all of the Airborne Group Units have loaded on to a Huey/Mi-8 when the player uses F7 menu? Alternatively, is there any way to figure out when a player presses the F7 Embark / Embarking / GroupName menu to figure out which unit / player has the group? Any input / feedback is appreciated. Thank you kindly.
  13. This may be a hardware issue. But, I was flying the Ka-50 post 2.20.2020 update and... I've had an erection lasting for more than four hours now so...
  14. Thanks for looking at this. See the attached tracks. The mission is the same mission, one was ran in stable version and the other was in open beta 2.5.6 just a moment ago. One thing I noticed that was different in 2.5.6 is the new "ALL" option under vehicle group. Pre 2.5.6 all was not an option and so long as the field was blank, either a UH-1 or Mi-8 was able to pick up the group. There are two infantry groups in the test: One is given the embark task at WP1; the others are auto tasked on event landing. Please let me know if you need anything else. Thanks again. server-20200216-132940 (run in beta 2.5.6).trk server-20200216-133340 (run in stable version).trk
  15. Just FYI, and a low priority I'm sure, EmbarkToTransport is not working; either in the mission editor group waypoint triggers, nor via a scripting function. Also, just a thought. Is there any way in a future update that the F7 "Airborne Troops" menu might be able to contain a function that tasks troops to embark that are within a certain proximity of the helicopter, say 500 meters?
  16. You are a hero, Sir. Thank you for this.
  17. Stores Management, Client Slots I apologize for two posts: But I had an idea for the stores management as well as client slots. But this idea is rather abstract and requires an imagination. What if when add a client aircraft, let's say F/A-18C. You add the waypoints and other information for the aircraft. Rather than copying and pasting the newly created aircraft to get the desired number of aircraft available at this airbase, why not select a number of client slots available at this airbase based on this "template" if you will. When a slot is selected, rather than ten slots available, it reduces to nine, and so on. See below. This would then reduce the long list of available aircraft on some of the bigger servers, as it is condensing the list. I know this would be a challenge, specifically with callsigns. But if there were a way to increment the callsigns or auto select a callsign that isn't in use, this would aid in decluttering the slot selection and would be great for Stores Management. I know that stores management is a hot button issue. But, if there were a way to limit individual pylons to certain types of weapons, i.e., Missiles, Bombs, Fuel tanks, etc., or even specific weapons, i.e., AIM-54C, JSOW, AIM-120C, etc., this would be a major benefit for server hosts and multiplayer mission designers. I know that this would be a challenge, and is really only a multiplayer issue, but the stores management, specifically when attempting to limit weapons, is not possible without scripting. [TABLE]AVAILABLE AIRCRAFT PlayerName Role Unit Country Task GroupName StartPosition Available Slots Pilot F/A-18C Switzerland Ground Attack F/A-18C Al Dhafra 9 Pilot F-16 UAE Ground Attack F-16 Al Dhafra 14 Pilot F/A-18C US CAP F/A-18C Stennis 9 Pilot F-14B US Intercept F-14B Stennis 19 Pilot Mi-8MTV2 Ukraine Transportation Mi-8MTV2 Ground 5 **Scroll Down** OCCUPIED AIRCRAFT PlayerName Role Unit Country Task GroupName StartPosition smeagle Pilot F/A-18C Switzerland Ground Attack F/A-18C Al Dhafra goofy Pilot F-16 UAE Ground Attack F-16 Al Dhafra buddy Pilot F-14B US Intercept F-14B Stennis RIO F-14B US Intercept F-14B Stennis [/TABLE]
  18. Cargos Thank you for taking the time to read all of these and the opportunity to post! Please, please, please, a "Cargo Type Unhooked in Zone" condition with a required number counter would be extremely beneficial. For example: **And, if the AI task "cargo transportation" could be linked to a type of cargo, rather than a specific piece of cargo would be wonderful. TRIGGER: Switched Condition CONDITION: "Cargo Type in Zone" Cargo Type: UH-1H cargo Required Number: Numerical value 1-99 Zone: zoneName ACTION: "Destroy Cargo Type In Zone" (An action that would call the destroy function to remove a specified number of cargo type units when the conditions are met would be great.) Cargo Type: UH-1H cargo Number: 1-99 Zone: zoneName <AND> ACTION: setUserFlag or Do Script or whatever, etc. optional: ACTION: "Cargo Counter In Zone" Zone: zoneName Message displaying the number of cargo pieces by type in the zone. This would be extremely helpful, as you would not have to set a ONCE trigger for each individual cargo, as if it is a switched condition, a player could spam the action by merely hooking and unhooking several times on the ground. $* Persistence: An action at mission end that would save the current state of the mission in a specified file name and a specified location? Don't know how doable this is, but for campaign building, it would be an immense tool. *Also, client slots with late activation and removal would be great. The ability to add slots that are not available or visible to players until a given condition is satisfied; and, also, the ability to remove client slots from visibility when a condition is met, of course accounting for slots that are occupied by a client when the slot removal condition is satisfied. **Also, communicating mission information to the player(s) is still one of the most difficult aspects of mission building, in my opinion. If there were a way to add text on the map, with different color text, shapes, etc., that would be visible to the respective coalition, or groups, etc. This would be an immense tool in marking objective and target areas more easily to find for players. Edit: I love the idea that was posted on here earlier (the Arma idea, sorry no quote, couldn't find it), this would be a fantastic addition. ***Also, the ability to have different types of aircraft and rotary wing in a group, respectively. For example, Apaches generally travel in a group of three, one of which will have the radome on the rotor, the other two have the appearance of the A model in the ME. Not overly important, but if it is doable, why not?
  19. First, which would solve the second question, does anyone know of a way to get a unit to perform the escort task when both aircraft are set to late activation? I am using a do script command in the unit route options to complete this currently rather than the perform task feature. Either way, the result is the same, no escorting is being had. To get around this I have been having to forego the late activation and instead call the destroy() function. This destroys the groups; then I respawn them with MiST. This works great and escort service is working. However, leading into my second question, when I call the destroy() function it messes up another function of mine (reconInZone, below), which works perfectly until the destroy function is called. Please see below. The only thing that I can think of is that it is screwing with the mist.makUnitTable(), because as I said, the function works great until the destroy() function is introduced, whether it's by do script, in the same file, or delayed long after the reconInZone function has run. Any thoughts, input, and recommendations are welcome and appreciated. Thank you. --Problem code local despawnAirAtStart = { "Red4: An-30M", "Red4: F-4E", "Red4: F-4E_2", "Red4: F-5E", "Red4: M-2000C", "Red4: MiG-21Bis", "Red4: MiG-23MLD", "Red4: MiG-25PD", "Red4: MiG-25RBT", "Red4: MiG-29S", "Red4: Su-24MR", "Red4: Su-24MR_2", "Red4: Su-30", "Red4: Tu-142", } do for i = 1, #despawnAirAtStart do local uName = Unit.getByName(despawnAirAtStart[i]) local despawn = uName:destroy() end end --Works great reconFlagCounter = 0 function reconInZone() local allRedAircraft = mist.makeUnitTable({"[red][plane]"}) for i = 1, #allRedAircraft do if Unit.getByName(allRedAircraft[i]):getTypeName() == "An-30M" or "Su-24MR" or "MiG-25RBT" or "Tu-142" then local zUnit = Unit.getByName(allRedAircraft[i]) local zType = zUnit:getTypeName() local pos = zUnit:getPosition().p local zone = trigger.misc.getZone("Red1: InnerReconZone") local oZone = trigger.misc.getZone("Red1: OuterReconZone") if (((pos.x - zone.point.x)^2 + (pos.z - zone.point.z)^2)^0.5 <= zone.radius) then if zType == "An-30M" then reconFlagCounter = reconFlagCounter + 10 end if zType == "Su-24MR" then reconFlagCounter = reconFlagCounter + 10 end if zType == "MiG-25RBT" then reconFlagCounter = reconFlagCounter + 4 end if zType == "Tu-142" then reconFlagCounter = reconFlagCounter + 20 end else if (((pos.x - oZone.point.x)^2 + (pos.z - oZone.point.z)^2)^0.5 <= oZone.radius) and (((pos.x - zone.point.x)^2 + (pos.z - zone.point.z)^2)^0.5 > zone.radius) then if zType == "An-30M" then reconFlagCounter = reconFlagCounter + 5 end if zType == "Su-24MR" then reconFlagCounter = reconFlagCounter + 5 end if zType == "MiG-25RBT" then reconFlagCounter = reconFlagCounter + 2 end if zType == "Tu-142" then reconFlagCounter = reconFlagCounter + 10 end end end end end if reconFlagCounter >= 500 then trigger.action.setUserFlag("ReconPoints", 500) else trigger.action.setUserFlag("ReconPoints", reconFlagCounter) end end mist.scheduleFunction(reconInZone, {}, timer.getTime() + 5, 20)
  20. Thank you for the reply. I suspect the conditions aren't being met, but I will look into "pairs." Sorry again for the sloppy code; it is formatted differently in my program and was lost when I pasted. I will make some changes and keep you posted. Thanks again. Best, Shnickle
  21. Thank you for the reply. I should have mentioned that some of this script was taken from other sources, i.e., from Grimes as well as Smarter SAMs, and "reverse engineering" (for lack of better terminology) to suit my needs. I am getting an event; in the ME, artillery are firing at a point within the one of the zones listed. Before I was using getPosition() instead of getPoint(). I will look into this more. I suspect it has to do with the table iteration. As mentioned, I am new with lua and I do not have a wealth of knowledge in the topic. I will look into pairs or ipairs; thank you for the suggestion. My apologies for the sloppy formatting of the code; I copied it in and it didn't keep the formatting that I had. Thank you again for looking at it. Best, Shnickle
  22. Trying to create a function that records on HIT. The script I am using is when any fired weapon hits within trigger zones defined in a table, then display message (going to change so that only artillery hits are recorded). However, since every hit is recorded, I would very much like to prevent a spam message on every hit. So when a hit occurs, the zone will be added into a separate table (recentTargetedZones) that will be "emptied" periodically. Here is what I have so far, no errors are occurring, but my outText is not displaying: Any help is appreciated. (Sorry for the sloppy code, still not great with writing) myZoneTable = { "FOB Alpha", "FOB Bravo", "FOB Charlie", "FOB Delta", "FOB Echo", "FOB Foxtrot", } recentTargetedZones = {} targetedZones = {} function targetedZones:onEvent(event) if world.event.S_EVENT_HIT == event.id and event.initiator:getPlayerName() == nil then local grp = Unit.getGroup(event.initiator) local groupName = grp:getName() local groupCat = grp:getCategory() local firedweapon = event.weapon local weaponTarget = event.target local tarPos = weaponTarget:getPoint() for i = 1, #myZoneTable do --see if the hit occured from the zones listed local zones = trigger.misc.getZone(myZoneTable) --should zone be local or global? if (((tarPos.x - zones.point.x)^2 + (tarPos.z - zones.point.z)^2)^0.5 <= zones.radius) then if recentTargetedZones == nil then -- check to see if the table is empty table.insert(recentTargetedZones, zones) trigger.action.outText("Zone Added", 60) else for x = 1, #recentTargetedZones do -- is the zone already listed in the recently target zones? local targeted_zones = trigger.misc.getZone(recentTargetedZones) if targeted_zones ~= zones then table.insert(recentTargetedZones, zones) trigger.action.outText("Zone Added", 60) --finish the function end end end end end end end world.addEventHandler(targetedZones)
  23. Quick question: I have a unit with several waypoints and a run script command at some of those waypoints as well as lua predicates. Are those scripts and predicates evaluated every second, or only when/if the unit reaches that waypoint? Edit: Also, what happens to the scripts if the unit, for example a AWACS, is shot down? Any help is appreciated. Thank you.
×
×
  • Create New...