zagor64bz 1225 Posted September 8, 2019 Ok..it's me, again. I have this snippet which tells my AI heli driver to move to that location. It opens the map and all. All working ok. IF ((Gunner (vehicle player)) == player) THEN {openMap true; onMapSingleClick " openMap false; Driver (vehicle player) move _pos; (vehicle player) vehiclechat 'ROGER, en route to destination'; onMapSingleClick '';"; }; What I've tried to do in the past couple of hours is to add waypoints to that. Specifically the "LOITER" ones. I try with: IF ((Gunner (vehicle player)) == player) THEN {openMap true; onMapSingleClick " openMap false; Driver (vehicle player) move _pos; Driver (vehicle player) setBehaviour "CARELESS";Driver (vehicle player) setCombatMode "BLUE";Driver(vehicle player) limitSpeed 220; wp = Driver (vehicle player) addWaypoint [_pos, 0]; wp setWaypointType "LOITER"; wp setWaypointLoiterType "CIRCLE_L"; wp setWaypointLoiterRadius 1500; (vehicle player) forceSpeed 60; onMapSingleClick '';"; }; NO JOY!!! Share this post Link to post Share on other sites
engima 328 Posted September 9, 2019 ”If another waypoint was added soon after the LOITER waypoint, the LOITER waypoint will act as a MOVE waypoint” According to the exclamation marked text here: https://community.bistudio.com/wiki/Waypoint_types 1 Share this post Link to post Share on other sites
POLPOX 778 Posted September 9, 2019 Do not use "" inside "". Also, onMapSingleClick also accepts code {} so I'd really recommend to use code instead. Also addWaypoint accepts group not an object. openMap true ; onMapSingleClick { openMap false ; _grp = group player ; _grp setBehaviour "CARELESS" ; _grp setCombatMode "BLUE" ; vehicle playewr limitSpeed 220 ; vehicle playewr forceSpeed 60 ; _wp = _grp addWaypoint [_pos,0] ; _wp setWaypointType "LOITER" ; _wp setWaypointLoiterType "CIRCLE_L" ; _wp setWaypointLoiterRadius 1500 ; onMapSingleClick {} ; } ; 2 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 9, 2019 3 hours ago, POLPOX said: Do not use "" inside "". Also, onMapSingleClick also accepts code {} so I'd really recommend to use code instead. Also addWaypoint accepts group not an object. openMap true ; onMapSingleClick { openMap false ; _grp = group player ; _grp setBehaviour "CARELESS" ; _grp setCombatMode "BLUE" ; vehicle playewr limitSpeed 220 ; vehicle playewr forceSpeed 60 ; _wp = _grp addWaypoint [_pos,0] ; _wp setWaypointType "LOITER" ; _wp setWaypointLoiterType "CIRCLE_L" ; _wp setWaypointLoiterRadius 1500 ; onMapSingleClick {} ; } ; ABSOLUTE JOY!!!! Thank you POLPOX!!! Share this post Link to post Share on other sites
Larrow 2818 Posted September 9, 2019 Dont use onMapSingleClick, it will be overridden by any other use of it. Instead use the MEH version which is stackable( can be used multiple times without effecting other uses of it ). Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 9, 2019 0 Advanced issues found ▲ 1 4 minutes ago, Larrow said: Dont use onMapSingleClick, it will be overridden by any other use of it. Instead use the MEH version which is stackable( can be used multiple times without effecting other uses of it ). Ok.... thank you LARROW..but I'm a little confused. If I got this correctly, you're telling me that if I have 2 onMapSingleClick snippets one will override the other? Let's say 1 is for a move command, and the other is for the loiter ones. If I use the move ones my AI group will execute the command, but if I use the loiter ones before they actually get where I send them, the move command will be overridden by the loiter ones? Those are the only 2 "onMapSingleClick" use for this mission so that it will not be a problem if they cancel each other out. Anyway, how would I use the EH you mention? Share this post Link to post Share on other sites
Larrow 2818 Posted September 9, 2019 Quote but if i use the loiter ones before they actually get where I send them, the move command will be overridden by the loiter ones? No if you issue a onMapSingleClick then another onMapSingleClick is used, the first will be overridden( will not exist, there can only ever be one onMapSingleClick set ). You may not be doing this yourself but if any other scripts/addons use it yours maybe overridden. Always safer to use MEH version. Quote Anyway, how would I use the EH you mention? openMap true ; addMissionEventHandler [ "MapSingleClick", { params[ "_units", "_pos", "_alt", "_shift" ]; openMap false ; _grp = group player ; _grp setBehaviour "CARELESS" ; _grp setCombatMode "BLUE" ; vehicle player limitSpeed 220 ; vehicle player forceSpeed 60 ; _wp = _grp addWaypoint [_pos,0] ; _wp setWaypointType "LOITER" ; _wp setWaypointLoiterType "CIRCLE_L" ; _wp setWaypointLoiterRadius 1500 ; removeMissionEventHandler[ "MapSingleClick", _thisEventHandler ]; }]; 2 Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 9, 2019 30 minutes ago, Larrow said: No if you issue a onMapSingleClick then another onMapSingleClick is used, the first will be overridden( will not exist, there can only ever be one onMapSingleClick set ). You may not be doing this yourself but if any other scripts/addons use it yours maybe overridden. Always safer to use MEH version. openMap true ; addMissionEventHandler [ "MapSingleClick", { params[ "_units", "_pos", "_alt", "_shift" ]; openMap false ; _grp = group player ; _grp setBehaviour "CARELESS" ; _grp setCombatMode "BLUE" ; vehicle player limitSpeed 220 ; vehicle player forceSpeed 60 ; _wp = _grp addWaypoint [_pos,0] ; _wp setWaypointType "LOITER" ; _wp setWaypointLoiterType "CIRCLE_L" ; _wp setWaypointLoiterRadius 1500 ; removeMissionEventHandler[ "MapSingleClick", _thisEventHandler ]; }]; That also works, thank you. Now..I realize that before adding a waypoint, I have to delete the previous one, right? As suggested HERE, I tried this openMap true ; addMissionEventHandler [ "MapSingleClick", { params[ "_units", "_pos", "_alt", "_shift" ]; openMap false ; _grp = group player ; while {(count (waypoints _grp)) > 0} do { deleteWaypoint ((waypoints _grp) select 0); };///as suggested _grp setBehaviour "CARELESS" ; _grp setCombatMode "BLUE" ; vehicle player limitSpeed 220 ; vehicle player forceSpeed 60 ; vehicle player flyInHeightASL [500, 500, 500];///added this for a smooth circling of loiter waypoint _wp = _grp addWaypoint [_pos,0] ; _wp setWaypointType "LOITER" ; _wp setWaypointLoiterType "CIRCLE_L" ; _wp setWaypointLoiterRadius 1500 ; removeMissionEventHandler[ "MapSingleClick", _thisEventHandler ]; }]; Works as intended now. 2 Share this post Link to post Share on other sites
Larrow 2818 Posted September 9, 2019 24 minutes ago, zagor64bz said: Now..I realize that before adding a waypoint, I have to delete the previous one, right? No, just set the groups current waypoint as the one you added. _wp = _grp addWaypoint [_pos,0] ; _wp setWaypointType "LOITER" ; _wp setWaypointLoiterType "CIRCLE_L" ; _wp setWaypointLoiterRadius 1500 ; _grp setCurrentWaypoint _wp; 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 9, 2019 5 minutes ago, Larrow said: No, just set the groups current waypoint as the one you added. _wp = _grp addWaypoint [_pos,0] ; _wp setWaypointType "LOITER" ; _wp setWaypointLoiterType "CIRCLE_L" ; _wp setWaypointLoiterRadius 1500 ; _grp setCurrentWaypoint _wp; I see....it works , thanks! 1 Share this post Link to post Share on other sites