ickyline Posted November 17, 2019 Posted November 17, 2019 Hi all, In my new mission i try to do some tips with activation and deactivation trigger. For now, I can activate a group when my airplane is on the trigger zone and deactivate this group when my airplane is not in the trigger zone. For that i use something like this : Trigger 1 : Do Once: Time +1 : activate flag 1.1 Trigger 2 : Condition : "If flag is 1.1" "unit myplane is in park triggerzone" : "set flag 1.2" Trigger 3 : Condition : "If Flag is 1.2" : "Activate group 1 "/ "set flag 1.1" Trigger 4 : Condition : "If flag is 1.1" "unit myplane is not in park triggerzone" : "set flag 1.3" Trigger 5 : Condition : "If flag is 1.3" : "Deactivate group 1"/ "set flag 1.1" It works fine at the moment. But my problem is, if i spawn on the trigger zone the group is activate, when i move out of the trigerzone the group deactivate. But if i go back in the trigger zone the group don't activate anymore. How can i create a cycle for entering and exit a trigger zone with activation and deactivation works each time i enter or exit?
Rudel_chw Posted November 17, 2019 Posted November 17, 2019 Use "SWITCHED CONDITION" trigger type, rather than "ONCE" For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar Mobile: iPad Pro 12.9" of 256 GB
SUNTSAG Posted November 17, 2019 Posted November 17, 2019 Unfortunately using a "SWITCHED" or now labelled "REPETITIVE ACTION" will not help here. The OP is deactivating a unit which will remove it from the mission entirely. Essentially there is nothing available to activate once deactivation has taken place. I hope that makes sense. Cheers. Callsign: NAKED My YouTube Channel [sIGPIC][/sIGPIC]
ickyline Posted November 17, 2019 Author Posted November 17, 2019 Unfortunately using a "SWITCHED" or now labelled "REPETITIVE ACTION" will not help here. The OP is deactivating a unit which will remove it from the mission entirely. Essentially there is nothing available to activate once deactivation has taken place. I hope that makes sense. Cheers. There is no script for this? like "mist" or something?
robgraham Posted November 17, 2019 Posted November 17, 2019 yeah you can use mist or moose to do what you want ickyline but you didn't ask that.. with moose for example you'd do something like this (note this isn't 100% it's just quick code) myZone = ZONE:New("Zone1") -- store our zone myPlayergroup = GROUP:FindByName("myPlayerGroup") -- store our player group Group1 = nil -- for our spawn isinzone = false -- so we don't' trigger multiple times below -- our function checker function checker() if myPlayergroup:IsAnyInZone(myZone) then if isinzone == false then Group1 = SPAWN:New("MyAIGroup"):Spawn() -- make our group save it in Group1 so we can kill it later isinzone = true -- we are in the zone so set this true and don't trigger again for now. end else if isinzone == true then if Group1 ~= nil then -- if our group isn't nil eg it did actually spawn Group1:Destroy() -- then destroy it. end isinzone = false -- we arne't in the zone no more so we can set this false end end end SCHEDULER:New(nil,checker,{},1,1) -- create a new scheduler for checker run it every second 2 i7 13700k, 64gb DDR5, Warthog HOTAS, HP Reverb G2 VR, win 11, RTX 3070 TGW Dedicated Server Admin, Australian PVE/PVP gameplay. (taskgroupwarrior.info/2020)
Paganus Posted November 17, 2019 Posted November 17, 2019 Switched condition still exists. Rather than remove the unit (deactivate) you could just turn the AI on and off. (Group AI on, Group AI off)
Colmillo Posted August 18, 2021 Posted August 18, 2021 On 11/17/2019 at 1:44 PM, robgraham said: yeah you can use mist or moose to do what you want ickyline but you didn't ask that.. with moose for example you'd do something like this (note this isn't 100% it's just quick code) myZone = ZONE:New("Zone1") -- store our zone myPlayergroup = GROUP:FindByName("myPlayerGroup") -- store our player group Group1 = nil -- for our spawn isinzone = false -- so we don't' trigger multiple times below -- our function checker function checker() if myPlayergroup:IsAnyInZone(myZone) then if isinzone == false then Group1 = SPAWN:New("MyAIGroup"):Spawn() -- make our group save it in Group1 so we can kill it later isinzone = true -- we are in the zone so set this true and don't trigger again for now. end else if isinzone == true then if Group1 ~= nil then -- if our group isn't nil eg it did actually spawn Group1:Destroy() -- then destroy it. end isinzone = false -- we arne't in the zone no more so we can set this false end end end SCHEDULER:New(nil,checker,{},1,1) -- create a new scheduler for checker run it every second Hi, thanks works perfect. Can you help me? I'm trying to set myPlayergroup as a coalition, so every time some of them inside the zone trigger the spawn. I cannot find the argument for that. Thanks in advance [sIGPIC][/sIGPIC] Intel(R) Core(TM) i9-10900KF CPU @ 3.70GHz 3.70 GHz ROG STRIX Z490-E GAMING RAM 128 M.2*2 2T total SSD*3 2.5T total GeForce RTX 3090 Orion2 HOTAS F-16EX Saitek Pro Rudder
robgraham Posted August 23, 2021 Posted August 23, 2021 On 8/19/2021 at 6:51 AM, Colmillo said: Hi, thanks works perfect. Can you help me? I'm trying to set myPlayergroup as a coalition, so every time some of them inside the zone trigger the spawn. I cannot find the argument for that. Thanks in advance For a coalition you'd do it a diffrent way around you'd look at the zone or do a set and then trigger off that. so something like. mz = ZONE:New("Test") -- Test would be the zone in ME. SCHEDULER:New(nil,function() if mz:IsSomeInZoneOfCoalition(coalition.side.BLUE) then -- code for spawning here end end,{},60,60) -- run this starting 1 minute in and every 1 minute after. i7 13700k, 64gb DDR5, Warthog HOTAS, HP Reverb G2 VR, win 11, RTX 3070 TGW Dedicated Server Admin, Australian PVE/PVP gameplay. (taskgroupwarrior.info/2020)
Colmillo Posted August 25, 2021 Posted August 25, 2021 On 8/23/2021 at 12:04 PM, robgraham said: For a coalition you'd do it a diffrent way around you'd look at the zone or do a set and then trigger off that. so something like. mz = ZONE:New("Test") -- Test would be the zone in ME. SCHEDULER:New(nil,function() if mz:IsSomeInZoneOfCoalition(coalition.side.BLUE) then -- code for spawning here end end,{},60,60) -- run this starting 1 minute in and every 1 minute after. Thank you so much for taking time to help me. Cheers! [sIGPIC][/sIGPIC] Intel(R) Core(TM) i9-10900KF CPU @ 3.70GHz 3.70 GHz ROG STRIX Z490-E GAMING RAM 128 M.2*2 2T total SSD*3 2.5T total GeForce RTX 3090 Orion2 HOTAS F-16EX Saitek Pro Rudder
aldo Posted March 21 Posted March 21 Ciao @robgraham, i'm not really a code man unfortunately. So the idea is to activate or deactivate a group when something happens , like a flag... this IMHO is very usefull for make a mission/scenario lighter for MP and servers. In this case (coalition one)...The code should run like: mz = ZONE:New("Test") -- Test would be the zone in ME. SCHEDULER:New(nil,function() if mz:IsSomeInZoneOfCoalition(coalition.side.BLUE) then -- code for spawning here ---> here I got confused <--- ??? should I insert this line ??? myPlayergroup = GROUP:FindByName("myPlayerGroup") -- store our player group end end,{},60,60) -- run this starting 1 minute in and every 1 minute after. er for checker run it every second
Recommended Posts