HartofARMA 6 Posted February 27, 2021 Hello everyone, I've been watching and reading a few tutorials on triggers but I am not having much luck on the repeatability of my triggers based on met conditions. My intent is for a side to seize an area and for set AI Groups to repeatedly spawn every 60 seconds (for test purposes) until the other side seizes back the objective. So far I am able to get both west/east side's groups to initially spawn per the triggers below but I would like them to consistently spawn on my "marker" once the "seized" conditions are met by the first trigger. I can only get the repeatability to work when the first trigger is consistently tripped by the player, side ai, or using not present activation type due to the nature of a trigger... is there anyway around this to have the second trigger flip on regardless based on the first so long as the area has been seized? One thought that I had was to make the condition off of the marker, such as "marker" is colorblue/colorred and for that to activate the second trigger but I am unsure as to how to do this For reference I have these four triggers on the map: Spoiler Trig1 (100 meter radius) Type: None Activation: Seized by BLUFOR Activation Type: Detected by BLUFOR Repeatable: checked Condition: this Activation: "marker" setmarkercolor "colorblue"; hint "Spawn is now controlled by Blufor!" Deactivation: Trig2 Type: None Activation: None Activation Type: None Repeatable: checked Condition: this && round (time %60) ==60; triggerActivated trig1; Activation: [getMarkerPos "marker", west, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; Deactivation: Trig3 (100 meter radius) Type: None Activation: Seized by OPFOR Activation Type: Detected by OPFOR Repeatable: checked Condition: this Activation: "marker" setmarkercolor "colorred"; hint "Spawn is now controlled by OpFor!" Deactivation: Trig4 Type: None Activation: None Activation Type: None Repeatable: checked Condition: this && round (time %60) ==60; triggerActivated trig3; Activation: [getMarkerPos "marker", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup; Deactivation: I'd be very appreciative of any help and hope that I am not overlooking something very simple 😅, thank you! Share this post Link to post Share on other sites
pierremgi 4879 Posted February 28, 2021 Condition: this && round (time %60) ==60; triggerActivated trig1; ???? this doesn't have sense with a "none none" trigger && round (time %60) ==60 why not, I'd rather use setTriggerInterval instead. Anyway, this && round (time %60) ==60; triggerActivated trig1; is same as triggerActivated trig1 (the last part of the code. && is missing) So, your first step is to write in plain language what you want to do; My intent is for a side to seize an area and for set AI Groups to repeatedly spawn every 60 seconds (for test purposes) until the other side seizes back the objective. It's vague. What you can do (example): Just one trigger, set to "none", "none", repeatable, server only. Condition field : isNil "MGItest" // so true at start on act field: MGItest = true; 0 = thisTrigger spawn { private _units = allUnits select {_x inArea _this && side _x in [WEST,EAST]}; private ["_grp","_wp"]; if (EAST countSide _units >= WEST countSide _units) then { _grp = [getMarkerPos "marker", west, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; "marker" setmarkercolor "ColorWEST"; hint "Spawn is now controlled by BluFor!"; } else { _grp = [getMarkerPos "marker", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup; "marker" setmarkercolor "ColorEAST"; hint "Spawn is now controlled by OpFor!" }; _wp = _grp addWaypoint [getpos _this,0]; _wp setWaypointType "SAD"; }; Note: the variable MGItest is now defined so the trigger is deactivated but the code continues with: if no unit in area of the trigger or BLUE > RED then spawn BLUE on marker... else spawn RED on marker addwaypoint for conquest of the area then, on deact field: 0 = [] spawn { sleep 60; MGItest = nil; }; Note: the code waits for 60 sec then rearms the trigger. Simple. If you need something more complex >>> 1 Share this post Link to post Share on other sites
HartofARMA 6 Posted February 28, 2021 @pierremgi Thank you very much for your time and tutoring! I will give this a shot today and also check out your custom spawn group module, I believe that I stumbled on your YouTube channel during my initial research. 🙂 Share this post Link to post Share on other sites
HartofARMA 6 Posted February 28, 2021 @pierremgi, I really enjoyed learning from your code above! An obstacle that I am having is with the <=, >=, <, > statements for what I am trying to do. If I use <= or >= (less than, greater than or equal to) either the OPFOR or BLUFOR immediately controls the spawn area. In my tinkering with your code, I took out the equal to and left only the less than or greater than statement; however this then requires constant occupation of the area by BLUFOR or OPFOR. Is there any way around this by just having a “last to occupy statement?” I hope to be less vague in my intent: I am working on a capture the island like mission where BLUFOR and OPFOR are fighting over strategic objectives using Rydiger/NR6 excellent Hetman AI commander. When a neutral (not yet activated) or adversary objective area is taken (within the trigger area) it’s important for immediate detection to be visualized (marker color change) to indicate that the area has changed possession and then later for reinforcements to spawn every 30 minutes so long as the capture conditions continue to be met. (Testing every 60 seconds; it’s also okay if there is an immediate group to spawn but not preferred). This was my original thinking trying to experiment originally with multiple triggers. // I removed the waypoint order (HETMAN AI commander will handle; replaced <=/>= with < and > to stop immediate BLUFOR ownership and added the redundant if line after } else { for my visual learning. Spoiler MGItest = true; 0 = thisTrigger spawn { private _units = allUnits select {_x inArea _this && side _x in [WEST,EAST]}; private ["_grp"]; if (EAST countSide _units < WEST countSide _units) then { _grp = [getMarkerPos "marker", west, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; "marker" setmarkercolor "ColorWEST"; hint "Spawn is now controlled by BluFor!"; } else { if (EAST countSide _units > WEST countSide _units) then { _grp = [getMarkerPos "marker", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup; "marker" setmarkercolor "ColorEAST"; hint "Spawn is now controlled by OpFor!" }; }; }; Share this post Link to post Share on other sites
pierremgi 4879 Posted February 28, 2021 14 minutes ago, HartofARMA said: @pierremgi, I really enjoyed learning from your code above! An obstacle that I am having is with the <=, >=, <, > statements for what I am trying to do. If I use <= or >= (less than, greater than or equal to) either the OPFOR or BLUFOR immediately controls the spawn area. In my tinkering with your code, I took out the equal to and left only the less than or greater than statement; however this then requires constant occupation of the area by BLUFOR or OPFOR. Is there any way around this by just having a “last to occupy statement?” Yes, you could customize the variable MGItest setting the tempo for spawning, so you'll keep a value about the last occupation. Something like: MGItest = "neutral"; // default when area is clear so when _allunits isEqualTo [] in the context MGItest = "blue" or MGItest = "red" along with superiority Then your deact code (with occurs as soon as the variable is not nil), could also test any change in this variable. No tested. Not at home. 1 Share this post Link to post Share on other sites
HartofARMA 6 Posted February 28, 2021 @pierremgi, I hope to not monopolize your time, but would you be able to show me a little bit more on how to implement what you are saying in the code when you have the time? I have not been able to get the MGItest variables (neutral, red, blue) to work to set the value of last occupation just yet... I really appreciate your guidance thus far. Share this post Link to post Share on other sites
pierremgi 4879 Posted February 28, 2021 the basic: cond: isNil "MGItest" on act: 0 = thisTrigger spawn { private _units = allUnits select {_x inArea _this && side _x in [WEST,EAST]}; private ["_grp","_wp"]; call { if (EAST countSide _units > WEST countSide _units) exitWith { _grp = [getMarkerPos "marker", west, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; "marker" setMarkerColorLocal "ColorWEST"; "marker" setMarkerAlphaLocal 1; hint "Spawn is now controlled by BluFor!"; _wp = _grp addWaypoint [getpos _this,0]; _wp setWaypointType "SAD"; MGITest = "red"; }; if (EAST countSide _units < WEST countSide _units) exitWith { _grp = [getMarkerPos "marker", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup; "marker" setMarkerColorLocal "ColorEAST"; "marker" setMarkerAlphaLocal 1; hint "Spawn is now controlled by OpFor!"; _wp = _grp addWaypoint [getpos _this,0]; _wp setWaypointType "SAD"; MGITest = "blue"; }; "marker" setMarkerAlphaLocal 0; MGITest = "neutral"; }; }; This way, MGItest is "neutral" for empty area or balanced group (no more spawn, shorten wait til next check (see on deact). You can do other things with "blue" or "red" cases. It's a good hint for who is dominent in area (in term of nbr of units. If you want to weight tank, car ,infantry.... that demands more code). on deact: 0 = [] spawn { sleep ([60,1] select (MGItest == "neutral")); MGItest = nil; }; Now, you can make difference between an empty area (for OPFOR / BLUFOR, not civilian or INDEP...) and a balanced count of OPFOR/BLUFOR units, simply adding a new case: on act: 0 = thisTrigger spawn { private _units = allUnits select {_x inArea _this && side _x in [WEST,EAST]}; private ["_grp","_wp"]; call { if (_units isequalTo []) exitWith { MGItest = "empty"; "marker" setMarkerAlphaLocal 0; }; if (EAST countSide _units > WEST countSide _units) exitWith { _grp = [getMarkerPos "marker", west, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; "marker" setMarkerColorLocal "ColorWEST"; "marker" setMarkerAlphaLocal 1; hint "Spawn is now controlled by BluFor!"; _wp = _grp addWaypoint [getpos _this,0]; _wp setWaypointType "SAD"; MGITest = "red"; }; if (EAST countSide _units < WEST countSide _units) exitWith { _grp = [getMarkerPos "marker", east, (configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup; "marker" setMarkerColorLocal "ColorEAST"; "marker" setMarkerAlphaLocal 1; hint "Spawn is now controlled by OpFor!"; _wp = _grp addWaypoint [getpos _this,0]; _wp setWaypointType "SAD"; MGITest = "blue"; }; "marker" setMarkerAlphaLocal 0; MGITest = "neutral"; }; }; on deact: 0 = [] spawn { sleep ([[60,120] select (MGItest == "empty"),1] select (MGItest == "neutral")); MGItest = nil; }; This way, the delay is 1 sec. for empty area, 60 sec for fighting area with a dominant side, 120 sec. for balanced count of EAST/WEST. 1 Share this post Link to post Share on other sites
HartofARMA 6 Posted March 1, 2021 Thank you so much Pierre! Especially for your time and patience! Seeing it spelled out from your examples helps me so much. I am eager to continue learning via the pinned topics. 1 Share this post Link to post Share on other sites