Cryptdik 5 Posted April 13, 2017 https://community.bistudio.com/wiki/addWaypoint Looking to change a mission from using predetermined waypoints for enemies to travel to upon your detection to repeatedly creating a seek and destroy waypoint at the activator of the detection trigger every ~30 seconds or so to keep them chasing you while you are detected. My set up is this: Init on group leader of friendly squad: this setGroupid ["group1"] Trigger that detects enemy Init: this && isNil "myVariable" OnAct: _wp = group1 addWaypoint [getposatl (thislist select 0), 0]; [group1, 0] setWaypointType "MOVE"; myVariable = true; OnDeAct: 0 = [] spawn {sleep 25; myVariable = nil} Still pretty new to this so I don't fully understand all of it, I'm piecing it together from other examples I've seen xD Share this post Link to post Share on other sites
pierremgi 4898 Posted April 14, 2017 setGroupId? Simpler: name the group in the group icon variable attribute! (editor): You should try just one addWaypoint, "SAD" rather than "MOVE" type but it's not mandatory if you want to keep some "non alerted patrol" behavior. I guess you don't want to add waypoints over waypoints over waypoints. So, as far as we are in a loop (25sec one as you defined on deact), you can cope with the fact there is no previous "SAD" waypoint, then add a one-shot check on that. I hope this chronology will make it simpler: 1 your group is patrolling or guarding: no waypoints (type returns "") or some "MOVE"/"CYCLE" waypoints; 2 your group detects player(s); 3 if the current waypoint of the group isn't an "SAD" one, // try to make it true! (see 1) 3.1 disregard all previous waypoints (if any); 3.2 addwaypoint "SAD" type. 4 update the SAD position by the trigger loop. In other words, onAct becomes: 0 = thisList spawn { _target = _this select 0; if (waypointType [group1,currentWaypoint group1] != "SAD") then { while {count waypoints group1 > 0} do {deleteWaypoint ((waypoints group1) select 0)}; gr1Wp = group1 addWaypoint [getpos _target,0]; gr1Wp setWaypointType "SAD"; gr1Wp setWaypointSpeed "FULL"; }; if (!isnil "gr1Wp") then {gr1Wp setWaypointPosition [getpos _target,0]}; }; myVariable = true; Share this post Link to post Share on other sites
Cryptdik 5 Posted April 14, 2017 I actually came up with a new idea. I made a set of waypoints for example a Move on SAFE to make them idle, then on detect a GET IN on careless to make them get into vehicles and such, and finally a SEARCH AND DESTROY on combat mode. Then I synced the GET IN (for vehicle squads) to a trigger that simply moves the location of each of the SAD waypoints to the player every 10 seconds instead of creating new ones. The OnAct: [SAD1] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD2] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD3] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD4] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD5] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD6] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD7] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD8] setWaypointPosition [getposatl (thislist select 0), 0]; [SAD9] setWaypointPosition [getposatl (thislist select 0), 0]; myVariable3 = true; A bit simpler and doesn't require them to be patrolling actively or anything. I may actually use the OnAct you posted for a couple of small patrols as well so there's some movement before you start an attack. Gonna test, I'll have to post a link to the finished mission or something so you can see the fruits of my labor xD Also for setting the GroupID in the editor, is it the Variable Name line above the Init box? Share this post Link to post Share on other sites
Cryptdik 5 Posted April 14, 2017 Shit, I spoke too soon. Tested it out and getting this error: Error 1 elements provided, 2 expect https://community.bistudio.com/wiki/setWaypointPosition I can't tell where I'm missing an element in this, making it [SAD1, 0] didn't fix [SAD1] setWaypointPosition [getposatl (thislist select 0), 0]; Share this post Link to post Share on other sites
Cryptdik 5 Posted April 15, 2017 Bump. Still haven't figured this out and it's mission breaking. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted April 15, 2017 (edited) see setWaypointPosition: Syntax: waypoint setWaypointPosition [center, radius] Parameters: waypoint: Array - format Waypoint but what is waypoint ? array of format waypoint? just click the link "Waypoint" there to get enlighted... Waypoint Format: [group, index] that is what you need. [group, index] setWaypointPosition [position, number] EDIT: earlier you wrote this: gr1Wp = group1 addWaypoint [getpos _target,0]; gr1Wp is an array of type waypoint. so maybe u need something like this: gr1Wp setWaypointPosition [getposatl (thislist select 0), 0]; Edited April 15, 2017 by sarogahtyp Share this post Link to post Share on other sites
Cryptdik 5 Posted April 15, 2017 Ugh this is frustrating as hell. I'm trying to get a squad to enter a heli (or any vehicle for that matter) and unload at a waypoint determined by the player position, then a SAD at the same position. I have a waypoint set to SAFE to make the squad idle. Then a GET IN waypoint on CARELESS synced to a trigger that detects BLUFOR by OPFOR. Then I put this in the OnAct of the waypoint: heloTU = helogroup1 addWaypoint [getposatl (thislist select 0), 0]; heloTU setWaypointType "UNLOAD"; heloTU setWaypointCombatMode "RED"; heloSAD = helogroup1 addWaypoint [getposatl (thislist select 0), 1]; heloSAD setWaypointType "SAD"; heloSAD setWaypointCombatMode "RED"; I've tried several different things already but the biggest problem is that the group will enter the chopper but not ever take off. Edit: Tried something else now too. Took out the waypoints, stuck everyone in the chopper with moveindriver/moveincargo and made a trigger that detects blufor with this onAct: heloTU = helogroup1 addWaypoint [getposatl (thislist select 0), 0]; heloTU setWaypointType "UNLOAD"; heloTU setWaypointCombatMode "RED"; heloSAD = helogroup1 addWaypoint [getposatl (thislist select 0), 1]; heloSAD setWaypointType "SAD"; heloSAD setWaypointCombatMode "RED"; Can't get this sucker to even turn on the blades. Edit Again: Fixed part of it. The group will still not take off for an unexplained reason, but will not enter the chopper and wait a minute before getting out and coming after me. _wp = helogroup1 addWaypoint [getposatl (thislist select 0), 0, 0, heloTU]; heloTU setWaypointType "MOVE"; heloTU setWaypointCombatMode "YELLOW"; _wp2 = helogroup1 addWaypoint [getposatl (thislist select 0), 0, 0, heloSAD]; heloSAD setWaypointType "TU UNLOAD"; heloSAD setWaypointCombatMode "RED"; Share this post Link to post Share on other sites
pierremgi 4898 Posted April 15, 2017 thislist has no sense for a waypoint. It works in trigger on act field only. The solution is not so far but there are some missing points for understanding. For example, is there any separate crew already in helo, or is your squad jumping in helo and driving? load/Tr unload have sense for a separate crew (when synced with getIn/getout for squad) . If the helo is empty, you have to assign/ unassign squad members to helo. Share this post Link to post Share on other sites
Cryptdik 5 Posted April 15, 2017 Either way, I started with it as an empty Helo and a crew to jump into it. Now i'm just trying to get it to work so I put moveincargo in their init fields and restarted with a chopper that has a pilot but is part of the same group. And as for the waypoint I do now have it in a single trigger's OnAct with no waypoints pre-made. It seems that they are successfully doing the UNLOAD part since they will exit after a few seconds and start moving towards me. No idea why it won't take off though. Edit: Sigh, it looks like they are automatically exiting the chopper when being shot at and still not taking off regardless. Edit: Success!! FINALLY. Started back from square one and ended up using this in the OnAct of a trigger: heloway1 = (group helopilot1) addWaypoint [getposatl (thislist select 0), 0]; heloway1 setWaypointType "MOVE"; heloway1 setWaypointBehaviour "aware"; heloway1 setWaypointCombatMode "yellow"; heloway1 setWaypointSpeed "FULL"; heloway1 setWaypointCompletionRadius 30; I even made a secondary set that changes the waypoint to UNLOAD and COMBAT and it works perfect. The helo will actively launch a volley of rockets at you if you are in a vehicle before circling around and unloading nearby. Case closed. Share this post Link to post Share on other sites