chromium Posted January 14, 2014 Posted January 14, 2014 Hi all, I'm builing a chunk where a defined group will start to move to a defined point "tgt", but I want them to stop if they get in LOS with any enemy units in the range of 5000 mt. Then, after 120 seconds they will try to resume the route but if again in LOS with an enemy they will hold again. The routing part is ok (MIST), the LOS part should be ok (MIST, I will check if any entry "vis" exist every 61 seconds. if yes, than execute the "hold" chunk). There if LOS exist I need a chunk that command "hold" position for the group, and then stop the hold condition after about 60 seconds, but I'm not familiar with inserting task or similar by code. Another way could be a command that set speed of the group to 0 for 60 seconds.. but... I don't really like this way (cause hold could also be customizable in formation). May I ask if someone of you have already done something similar to this hold function by script? Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
chromium Posted January 14, 2014 Author Posted January 14, 2014 found this changing the search parameters in the forum: http://forums.eagle.ru/showpost.php?p=1926110&postcount=78 now tell me that this will work and make me feel very stupid, please... If Yes I'll simply need to schedule the resume function ever 60 secs. Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
ENO Posted January 14, 2014 Posted January 14, 2014 If I'm reading what you want to do correctly I guess you'd just need a "time since flag" and action "Group resume." "ENO" Type in anger and you will make the greatest post you will ever regret. "Sweetest's" Military Aviation Art
chromium Posted January 15, 2014 Author Posted January 15, 2014 Yes but I won't do that with trigger cause it could be applied to more than 300 groups, in different times, besides another logic :) that command movement start, and must work on more than 1 mission edited by more than 1 people every two weeks. Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
mwd2 Posted January 15, 2014 Posted January 15, 2014 what, if you use the function timer.scheduleFunction(FunctionToCall functionToCall, any functionArgument, Time time) something like local function hold() for n=1, #AllGroundGroups do ..check of LoS if LoS true ... return timer.getTimer() + 120 end timer.scheduleFunction(hold, nil, timer.getTimer() + 120) Playing: DCS World Intel i7-13700KF, 64GB DDR5 @5600MHz, RTX 4080 ZOTAC Trinity, WIN 11 64Bit Prof. Squadron "Serious Uglies" / Discord-Server: https://discord.gg/2WccwBh Ghost0815
chromium Posted January 15, 2014 Author Posted January 15, 2014 ok that's a practical suggestion. I may add hold() as a generic function and then load it in my group movement script. but why you wrote this: return timer.getTimer() + 120 ? it's already in the timer.scheduleFunction, isn't it? thanks for explanation :) Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
chromium Posted January 26, 2014 Author Posted January 26, 2014 Hi all, I prepared the function but it does not work: (groupXname and range are defined at function launch, DGWS is a table of function already working for other functions). DGWS.StopMovLOSwEnemy = function(groupXname, range) local IsLOSwEnemy = false -- is there a better way to do not create a global variable? for _,unitData in pairs(mist.DBs.aliveUnits) do if unitData.groupName == groupXname then local OwnCoalition = unitData.coalition local unitsTable = unitData.unitName local inLOS = {} if OwnCoalition == "red" then inLOS = mist.getUnitsLOS({unitsTable},2,{"[blue][vehicle]"},2,range) elseif OwnCoalition == "blue" then inLOS = mist.getUnitsLOS({unitsTable},2,{"[red][vehicle]"},2,range) end if next(inLOS.vis) ~= nil then IsLOSwEnemy = true trigger.action.groupStopMoving(Group.getByName(groupXname)) end end end end I scheduled this function with MIST: (groupToMove is a group name string) mist.scheduleFunction(DGWS.StopMovLOSwEnemy,{groupToMove, 5000},timer.getTime() + 40,14400) but the starting group move along the enemy even passing at <10 meters from it... (both has hold fire ROE option activated). Any suggestions? :( Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
chromium Posted January 26, 2014 Author Posted January 26, 2014 solved whitout using mist.getUnitsLOS :) Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Recommended Posts