Jump to content

Cougar

Members
  • Posts

    1247
  • Joined

  • Last visited

Everything posted by Cougar

  1. You could use mist and use mist.getRoll()....im not at home but certainly someone can give you the exact syntax..
  2. Well if it can help better the main script ;) dont feel bad about it
  3. On the next update ive remove the need for zones ;)....wiyh noodle idea selecting target via f10 menu will make it instead of the complex trigger zone mess... Post it up or pm with your script which mihht help pass on some bumps im having here and there ..
  4. Correct It will be something tricky unfortunatly....
  5. No it shouldnt be a problem to remove aircraft....as long the unit name remain the same if you add new items within the limits of the number of present in the mission..... Ive progressed a bit on the updated code but just lacking of time at the moment but new code will be better i assume ;)
  6. Reworking the script for the better.....will update the first post when done....
  7. I'm getting an error trying to index a nil value...grrrr Seem likes the makeunittable isn't working..... Reedit: makeunittable works.... unitsInPoly = {} for index, unitName in pairs(mist.makeUnitTable({'[blue][plane]'})) do unitsInPoly[unitName] = unitName trigger.action.outText(mist.utils.tableShow(unitsInPoly),10) end Returns { ['test] = 'test' ['true'] = ['true'] ['Pilot #003'] = 'Pilot #003' } Wonder if because there's a" true" entry it somewhat make the mist.pointInPolygon call return an error as there's no pilot named 'true'.... Edit: True is a unit that I had set to Player...doh here's the error i get: 00072.290 ERROR DCS: Mission script error: : [string "local unitsInPoly = {}..."]:5: attempt to index a nil value stack traceback: [C]: ? [string "local unitsInPoly = {}..."]:5: in main chunk
  8. Also @St3v3f How I would use this script with units in polygon if possible at all? I've browses the mist 3.2 and there doesn't seem to have any specification about getunitsinzones for that one so maybe that's why I'm not able to avhieve anything on that side :/
  9. Sorry to revive this thread but I'm stuck and can't find a way to make it happen so looking for help once more... local units = mist.makeUnitTable({'[blue][plane]'}) local flag = 11 local zones = {'1', '2', '3', '4','5','6','7','8','9','10','11','12','13','14',} -- it equal of about 2 NM in lenght local zone_type = 'cylinder' function StrafePit1OnOff(result) local ret = mist.getUnitsInZones(units, zones, zone_type) if #ret == 0 and result == true then trigger.action.setUserFlag(flag, 0) result = false if namesS1 ~= nil then namesS1={} end elseif #ret > 0 and result == false then trigger.action.setUserFlag(flag, 1) result = true for i = 1, #ret do namesS1[#namesS1] = ret[i]:getName() end end mist.scheduleFunction (StrafePit1OnOff, {result}, timer.getTime() + 1) end StrafePit1OnOff(false) In the above it just allow 1 unit to be added to the "namesS1" table which is the first unit to enter the zone. Now if I do namesS1[#namesS1 + 1] = ret[i]:getName() It will add all the units name that are in the zone once the flag is activated thought its not what I'm looking for. What I'm trying to get is to be able to update that table so if gets the current unit inside the zone. If I add another statement Elseif #ret > 0 and result == true then namesS1[#namesS1 + 1] = ret[i]:getName() It will add the new units but table will be populated over and over and that's not what I'm looking for again lol If I do the following elseif #ret > 0 and result == true then If namesS1 ~= nil then namesS1 ={} namesS1[#namesS1 + 1] = ret[i]:getName() Was thinking that clearing the table first then adding the names would work but using mist tanbleshow it return {} so its not working.... Anyone have an idea how to make it work so it only add new names that are not already in the tables and remove the ones that aren't inside anymore. Thanks Cougar
  10. Use the uncontrolled tick box with late activation if I remember right
  11. http://forums.eagle.ru/showthread.php?t=116119 near bottom first page and answer of Grimes second page
  12. Nice ;) can't wait to see your modification ;)
  13. Hi guys, First of all I would like to say thank you to everyone who posted snippets and answered question that I had in this section which helped me alot as Im no expert in lua scripting. The script is far from being complete IMO but wife isnt happy about it so that's why Im posting it and maybe someone can continue to work on it to give it more content faster than me ;) Important note: I haven't tested it on multiplayer scale so there might be some bugs....crossing fingers there's none lol but just a note of caution ;) So what the script is about? Training indeed :) and is based on the assets of the 476th vFG Air Weapons Range Objects So far it's pretty much setup for gun strafing training for planes and helicopters but could be expanded for rockets and possibly a good mix with SNAFU's Bdu bomb pratice script. This script is basicaly counting every hit you get with your gun rounds(for now) when you are lined up correctly with the target you intend to hit. To ensure people hitting the right target, I've setup zones before the targets and only when you're inside the hit will be counted. Important note here, the first unit inside a zone will be the only one to be able to make hits, if there's a second unit at the same time in the target zone, his hit wont be counted if he fires but as soon the unit leaves the second unit name will be entered in the list and only then his hit will count. You can view your total hit count for each target with the F-10 comms menu which are specific to planes or helicopters. You can also reset all your hit counts also. I've thought about resetting the score of the plane once it get to a specific distance but I haven't had the time to make it happen though it might be better that way. The only options which might be good is to reset when players select another aircraft but it has to be implemented ;) I've also added one IPplanes and one IPheli unit which can act as the tower through the F7 view to direct pilots in or to train them. These 2 units will receive message when units enter target zones with there Intended target, unit name(not player name) and hit count. New message will overwrite the initial message in the same format once hits are being made. Anyways the best way to describe it is to let you guys have a go at it ;) What You'll need: - Mist 3.2 with small hot fix for mist.message.add attached in this post - 476th vFG Air Weapons Range Objects - attached files I like the do script better then the do script file so I'll attach the revelant files here but everything is set in the ME trigger section. Planes/Helicopters name Planes Targets name Helicopters Targets name Planes Targets zone name Helicopters Targets zone name I hope you guys find some potential in that script and any comments or hints is appreciated. P.S.: I think I forgot to change the mission settings so sorry if that's the case...getting late here. Cheers! Training Range Script.rar Training_Range_Script.miz Mistv3_2.lua
  14. Eno, if you're using notepad++ when u click function, if , for etc you can see red line on the left where it will tell you where it ends ;) pain in the butt lol when you're searching where there's a missing or too much ends . Hope it helps
  15. Alright I think I've worked it out.... Msg to units which are planes for now works.....but they need to be added first to the mission, as soon you put a ground units then it doesnt work if you add more planes and try to send msgs.... but the first planes added will receive the msgs. Like I said thats weird as coa works but not units....
  16. Ok that's weird....Ive created a new mission with only a plane with one of the units name and its working......I wonder is my other mission is broken....
  17. Well I was flying the unit itself but no joy grrrr Ill keep trying :)
  18. Trying to play arround with mist.message but no matter what trying to use msg.msgfor = { units = { 'Hawg11', 'Hawg12' } } doesnt show the message Pilot name or even group name.... CA = blue send the message to any unit and not only CA vehicles... I must be doing something wrong...
  19. Or use mist respawn in zone with Israel f-15 on red flying somewhere then repawn the group when the mutiny happen. If trigger.misc.getUserFlag (1) == 1 then mist.respawnInZone ('groupname','zonename') end Not at home right now cant remember by heart what is needed for the mist respawn script but might be an option for you.
×
×
  • Create New...