Jaghiti Posted August 21, 2019 Posted August 21, 2019 (edited) Ok, I've got the AI taking off now but they are spawning indefinitely instead of filling the client slots only. Has anyone seen this behaviour before or know how to stop it? I'm spawning F-14s so I originally thought they were spawning 1 AI for the pilot and 1 for the RIO but they just keep spawning EDIT After adding a second AI balancer to spawn another flight, it is the last balancer spawn that adds aircarft indefinitely. The original F-14s now spawn as intended but the next flight of F/A-18s now spawn indefinitely Edited August 21, 2019 by Jaghiti
Hardcard Posted August 21, 2019 Posted August 21, 2019 @Jaghiti Last time I tried the AI BALANCER it wasn't working properly What version of MOOSE are you using? [sIGPIC][/sIGPIC]
Jaghiti Posted August 21, 2019 Posted August 21, 2019 tried latest stable and latest development versions guess I'll try something else. cheers
MasterZelgadis Posted August 23, 2019 Posted August 23, 2019 I'm fiddling around with M.O.O.S.E. a bit. the documentation is huuge.. But I just can't find one probably very simple thing: I have a zone and I want to check whether there are units of the red coalition in there..Or even better, I want to execute code when a red unit enters the zone. I already found, how I can check whether a given unit is inside a given zone, but I don't want to iterate over all units or groups to check whether theyare in my zone.. "Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler." http://www.space-view.net
funkyfranky Posted August 23, 2019 Posted August 23, 2019 I already found, how I can check whether a given unit is inside a given zone, but I don't want to iterate over all units or groups to check whether theyare in my zone.. I guess, then the only option is to first perform a scan in the zone area. Would that be a viable solution for you? Is it a circular or more complex zone? A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
MasterZelgadis Posted August 23, 2019 Posted August 23, 2019 Circular zone. Now trying if I can use the capture zones for it. But I can't imagine, that a simple function like "is there a red unit in zone xy"? doesn't work.. There even is a trigger for it in the editor, but I don't want to create triggers for nearly 100 zones. "Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler." http://www.space-view.net
funkyfranky Posted August 23, 2019 Posted August 23, 2019 Circular zone. Now trying if I can use the capture zones for it. But I can't imagine, that a simple function like "is there a red unit in zone xy"? doesn't work.. There even is a trigger for it in the editor, but I don't want to create triggers for nearly 100 zones. Hmm, unless you monitor which units enters/leaves a zone, there is no way to determine whether it is inside/outside the zone other than iterating over all units in question. The trigger function will probably do the same internally. I'd check https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Set.html##(SET_GROUP).AnyInZone That looks like the most convenient way :) A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
MasterZelgadis Posted August 23, 2019 Posted August 23, 2019 (edited) Thanks :) Now I tried the capture zones, but here I don't really understand the event mechanism that moose uses, or better, that lua uses. I want to make a lot of cities on the map capturable, so I created zones for them. Now as I read it, I would have to do the following: City1Zone = ZONE:New( "City1ZoneName" ) City2Zone = ZONE:New( "City2ZoneName" ) City3Zone = ZONE:New( "City3ZoneName" ) ... ZoneCaptureCoalition1 = ZONE_CAPTURE_COALITION:New( City1Zone , coalition.side.RED ) ZoneCaptureCoalition2 = ZONE_CAPTURE_COALITION:New( City2Zone , coalition.side.RED ) ZoneCaptureCoalition3 = ZONE_CAPTURE_COALITION:New( City3Zone , coalition.side.RED ) ... function ZoneCaptureCoalition1:OnEnterGuarded( From, Event, To ) ... function ZoneCaptureCoalition2:OnEnterGuarded( From, Event, To ) ... function ZoneCaptureCoalition3:OnEnterGuarded( From, Event, To ) ... ... function ZoneCaptureCoalition1:OnEnterEmpty() ... function ZoneCaptureCoalition2:OnEnterEmpty() ... function ZoneCaptureCoalition3:OnEnterEmpty() ... ... I have a class called "city", which I could give the "captureZone" attribute, so it looks like: City = { ClassName = "City", name = "", capZone = {}, capZoneCoalition = {}, } function City:create( name ) local cty = {} setmetatable(cty, City) cty.name = name cty.capZone = ZONE:New( "City-" .. cty.name ) --all city zones are named "City-[name]" capZoneCoalition = ZONE_CAPTURE_COALITION:New( cty.capZone , coalition.side.RED ) return cty end cities = { City:create("Abasha"), City:create("Ambrolauri"), City:create("Batumi"), } But how can I register those events inside the class? Edited August 23, 2019 by MasterZelgadis "Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler." http://www.space-view.net
MasterZelgadis Posted August 23, 2019 Posted August 23, 2019 Okay, looks like some kind of rubber-ducking happened here, I was able to figure out... City = { ClassName = "City", name = "", capZone = {}, capZoneCoalition = {}, } function City:create( name ) local cty = {} setmetatable(cty, City) cty.name = name cty.capZone = ZONE:New( "City-" .. cty.name ) --all city zones are named "City-[name]" capZoneCoalition = ZONE_CAPTURE_COALITION:New( cty.capZone , coalition.side.RED ) return cty end function City.capZoneCoalition :OnEnterGuarded( From, Event, To )... function City.capZoneCoalition:OnEnterEmpty()... ... cities = { City:create("Abasha"), City:create("Ambrolauri"), City:create("Batumi"), } for i, city in ipairs(cities) do city.capZoneCoalition:Start( 5, 30 ) end And tadaa... a lot of markers appeared on the map :) "Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler." http://www.space-view.net
funkyfranky Posted August 23, 2019 Posted August 23, 2019 And tadaa... a lot of markers appeared on the map :) Well, not surprised you figured it out given your knowledge :thumbup: A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
MasterZelgadis Posted August 23, 2019 Posted August 23, 2019 Hm, was happy a little too early. The markers appear, but the events, or rather hook functions, do not get called. Damn.. "Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler." http://www.space-view.net
hancerPL Posted August 26, 2019 Posted August 26, 2019 The question is whether you can get the group name from the table. ZoneA = ZONE:New( "Zone A" ) GroupTable = { "MED #1", "MED #2", "MED #3" ,"MED #4" } ... function() if GroupTable:IsCompletelyInZone( ZoneA ) then Blu:Activate() Blu:FlareGreen() end So that no matter which unit (MED #1", "MED #2....)entered the zone trigger would work. Specialization A-10C https://vbw304.pl/
Hardcard Posted August 26, 2019 Posted August 26, 2019 (edited) @hancerPL You need to create a for loop, which will iterate through that table. This is basic lua, here, you'll find these quite helpful: https://www.tutorialspoint.com/lua/lua_for_loop.htm http://lua-users.org/wiki/TablesTutorial Also check out Nicol Bolas' answer here (last example): https://stackoverflow.com/questions/7616260/for-loop-on-lua ZoneA = ZONE:New( "Zone A") GroupTable = { "MED #1", "MED #2", "MED #3" ,"MED #4" } for i, name in ipairs(GroupTable) do if GROUP:FindByName(name) ~= nil then if GROUP:FindByName(name):IsCompletelyInZone( ZoneA ) then Blu:Activate() Blu:FlareGreen() end end end Edited August 26, 2019 by Hardcard [sIGPIC][/sIGPIC]
Arkangel Posted August 26, 2019 Posted August 26, 2019 I am using the MOOSE detection script and I would like to adjust the coordinate system to that of the Hornet, since it gives it to me in MGRS.
hancerPL Posted August 26, 2019 Posted August 26, 2019 The script works but only for AI, if I give a multi and for a man no longer works. ------------Convoy----------- Escort_1 = GROUP:FindByName( "Convoy #001" ) Escort_Heli_1 = GROUP:FindByName( "Dodge" ) Zone_Escort_1 = ZONE_GROUP:New( "ZoneEscort", Escort_1, 400) trigger.action.setUserFlag(1100, false) Escort_Start_1 = SCHEDULER:New( nil, function() if Escort_Heli_1:IsCompletelyInZone( Zone_Escort_1 ) then trigger.action.setUserFlag(1100, true) end if Escort_Heli_1:IsNotInZone(Zone_Escort_1) then trigger.action.setUserFlag(1100, false) end end, {}, 0, 4 ) The convoy is launched via trigger in ME. Specialization A-10C https://vbw304.pl/
Hardcard Posted August 26, 2019 Posted August 26, 2019 (edited) Check that the given names are valid and also check dcs.log. You might be getting nil errors if the groups you're referencing in the script don't exist in the mission when the script runs. Also, keep in mind that flag 1100 is being set to 0 (when false) and to 1 (when true) Edited August 26, 2019 by Hardcard [sIGPIC][/sIGPIC]
hancerPL Posted August 26, 2019 Posted August 26, 2019 That is if: Escort_Heli_1 = GROUP:FindByName( "Dodge" ) the 'Dodge' group is AI, the script will work because it sees it at startup. If it is a client, it will not work because the script did not see it at startup. But the unit is on a mission regardless of whether it's AI or Client. Specialization A-10C https://vbw304.pl/
Hardcard Posted August 26, 2019 Posted August 26, 2019 @hancerPL If you want this to work with clients spawning at some point after mission start, you'll need to either use a scheduler or a birth event handler (I'd use the birth event handler if I were you) [sIGPIC][/sIGPIC]
hancerPL Posted August 29, 2019 Posted August 29, 2019 @hancerPL If you want this to work with clients spawning at some point after mission start, you'll need to either use a scheduler or a birth event handler (I'd use the birth event handler if I were you) Thanks now works. Specialization A-10C https://vbw304.pl/
fargo007 Posted September 1, 2019 Posted September 1, 2019 Hey MOOSEnauts, Point me in the right direction (Classes/methods/technique) to get a ship to essentially follow, or parallel the course of another one. I have a scheduler, and within it I get random points of the target vessel with ZONE_UNIT and pass the vec2 back to the chasing boat, but this produces a very stop-start-stop-start effect. Wondering if there's a better way. Have fun. Don't suck. Kill bad guys. https://discord.gg/blacksharkden/
hancerPL Posted September 3, 2019 Posted September 3, 2019 Someone will help ! With the help of the script I start the radio lanterns for broadcasting with a time of 10 minutes. The problem is that it can't be restarted within 10 minutes. Someone restarting the frequency is changed. Is it possible to lock the menu for 10 minutes after starting? Sample script: MenuFarp = MENU_COALITION:New( coalition.side.BLUE, "Farps-Beacon" ) London = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "London", MenuFarp, function() ctld.createRadioBeaconAtZone("beaconZone1","blue", 10,"London") end, nil) :helpsmilie: Specialization A-10C https://vbw304.pl/
hancerPL Posted September 3, 2019 Posted September 3, 2019 Something is probably wrong with this time ? trigger.action.setUserFlag('3120', false) Farp_menu_1 = SCHEDULER:New( nil, function() if trigger.misc.getUserFlag('3120') == 0 then London = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "London", London, function() trigger.action.setUserFlag('3120', true) London:Remove() ctld.createRadioBeaconAtZone("beaconZone1","blue", 1,"London") timer.scheduleFunction(timer_1, {}, timer.getTime() + 61) function timer_1() trigger.action.setUserFlag('3120', false) end end, nil) end end, {}, 0, 1 ) The function adds the menu nicely but only once and after 61 seconds it should add the menu again. Specialization A-10C https://vbw304.pl/
Habu_69 Posted September 4, 2019 Posted September 4, 2019 Setting user flags to boolean values has proved unreliable for me. Try setting the flags to numeric values. Also might be a problem defining timer_1 function after calling it. Try moving the function definition before the scheduler.
hancerPL Posted September 4, 2019 Posted September 4, 2019 I gave it as you wrote but no changes. He only creates the menu once. function timer_1() trigger.action.setUserFlag('3120', 0) end Farp_menu_1 = SCHEDULER:New( nil, function() if trigger.misc.getUserFlag('3120') == 0 then London = MENU_COALITION_COMMAND:New( coalition.side.BLUE, "London", London, function() trigger.action.setUserFlag('3120', 1) London:Remove() ctld.createRadioBeaconAtZone("beaconZone1","blue", 1,"London") timer.scheduleFunction(timer_1, {}, timer.getTime() + 61) end, nil) end end, {}, 0, 1 ) Specialization A-10C https://vbw304.pl/
hancerPL Posted September 4, 2019 Posted September 4, 2019 You can solve the problem through the zone. Because he puts the unit to broadcast the signal. Only how to pull out the coalition is in the zone and then it is gone. Specialization A-10C https://vbw304.pl/
Recommended Posts