ADuke 1 Posted August 18, 2011 Hi, I am editing a script that adds waypoints. I want to add 3 waypoints. All at different locations relevant to "_targetpos". The first position.... _wp = _group addWaypoint [[_targetpos select 0,[color="Red"]????[/color] select 1], 0]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; [_group, 1] setWaypointCompletionRadius 500; As you can see, the position for the North/South coordinates (????) I do not know how to do, but I want it to be 500 meters North of "_targetpos" and this is what I am having trouble with. The second waypoint's position I would like to be 100 meters North of "_targetpos". The last waypoint would be right on top of "_targetpos" but that I know how to do. Your help is appreciated, -AD Share this post Link to post Share on other sites
kylania 568 Posted August 18, 2011 (edited) _group = group player; _targetPos = getMarkerPos "mrk_start"; // Wait till the Functions module is ready. waituntil {!isnil "bis_fnc_init"}; _firstPos = [_targetPos, 500, 0] call BIS_fnc_relPos; _secondPos = [_targetPos, 100, 0] call BIS_fnc_relPos; _wp = _group addWaypoint [_targetpos, 1]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; [_group, 1] setWaypointCompletionRadius 5; _wp2 = _group addWaypoint [_secondPos, 2]; [_group, 2] showWaypoint "NEVER"; [_group, 2] setWaypointSpeed "NORMAL"; [_group, 2] setWaypointType "MOVE"; [_group, 2] setWaypointCompletionRadius 5; _wp3 = _group addWaypoint [_firstPos, 3]; [_group, 3] showWaypoint "NEVER"; [_group, 3] setWaypointSpeed "NORMAL"; [_group, 3] setWaypointType "MOVE"; [_group, 3] setWaypointCompletionRadius 5; I think this demo mission is backwards from what you wanted, but shows how to do it. :) Also with 500 completion radius they'll all trigger about the same time. Edited August 18, 2011 by kylania Share this post Link to post Share on other sites
ADuke 1 Posted August 18, 2011 _group = group player; _targetPos = getMarkerPos "mrk_start"; // Wait till the Functions module is ready. waituntil {!isnil "bis_fnc_init"}; _firstPos = [_targetPos, 500, 0] call BIS_fnc_relPos; _secondPos = [_targetPos, 100, 0] call BIS_fnc_relPos; _wp = _group addWaypoint [_targetpos, 1]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; [_group, 1] setWaypointCompletionRadius 5; _wp2 = _group addWaypoint [_secondPos, 2]; [_group, 2] showWaypoint "NEVER"; [_group, 2] setWaypointSpeed "NORMAL"; [_group, 2] setWaypointType "MOVE"; [_group, 2] setWaypointCompletionRadius 5; _wp3 = _group addWaypoint [_firstPos, 3]; [_group, 3] showWaypoint "NEVER"; [_group, 3] setWaypointSpeed "NORMAL"; [_group, 3] setWaypointType "MOVE"; [_group, 3] setWaypointCompletionRadius 5; I think this demo mission is backwards from what you wanted, but shows how to do it. :) Also with 500 completion radius they'll all trigger about the same time. OK, thanks, I would have never even thought of going that route... I am assuming that any mission in which I am executing this script will need the functions module present? How about spawning the functions module in the script before hand? I only ask because this script is executed via an eventhandler within a unit's config. Thanks, -AD Share this post Link to post Share on other sites
kylania 568 Posted August 18, 2011 Yup, you'd need the functions module. You can create them, but I forget how at the moment. However for the math route you can use the examples in this post from Carl Gustaffa. :) Share this post Link to post Share on other sites
ADuke 1 Posted August 19, 2011 Yup, you'd need the functions module. You can create them, but I forget how at the moment. However for the math route you can use the examples in this post from Carl Gustaffa. :) Awesome, thanks for that, I will have to go the math route, but your example will definitely be useful for other things. Cheers :), -AD ---------- Post added at 12:38 AM ---------- Previous post was Yesterday at 11:36 PM ---------- Well I did this.... _wp1 = _group addWaypoint [(getpos _targetpos select 0), (getpos _targetpos select 1) +500, 1]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; _wp2 = _group addWaypoint [(getpos _targetpos select 0), (getpos _targetpos select 1) +100, 2]; [_group, 2] showWaypoint "NEVER"; [_group, 2] setWaypointSpeed "LIMITED"; [_group, 2] setWaypointType "MOVE"; _wp3 = _group addWaypoint [_targetpos, 3]; [_group, 3] setWaypointStatements ["true", "this land ""LAND"""]; [_group, 3] showWaypoint "NEVER"; [_group, 3] setWaypointSpeed "LIMITED"; [_group, 3] setWaypointType "MOVE"; But that didn't work :( Any suggestions? ---------- Post added at 02:16 AM ---------- Previous post was at 12:38 AM ---------- OK, so I was successful in creating the waypoints with this.... _wp1 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +500], 1]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; _wp2 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +100], 2]; [_group, 2] showWaypoint "NEVER"; [_group, 2] setWaypointSpeed "NORMAL"; [_group, 2] setWaypointType "MOVE"; _wp3 = _group addWaypoint [_targetpos, 3]; [_group, 3] setWaypointStatements ["true", "_driver land ""LAND"""]; [_group, 3] showWaypoint "NEVER"; [_group, 3] setWaypointSpeed "LIMITED"; [_group, 3] setWaypointType "MOVE"; But now, the problem is, the helicopter does not land at the third waypoint? :confused: Share this post Link to post Share on other sites
demonized 20 Posted August 19, 2011 "_driver land ""LAND"" "[b](vehicle this)[/b] land ""LAND"" Share this post Link to post Share on other sites
ADuke 1 Posted August 19, 2011 "_driver land ""LAND"" "[b](vehicle this)[/b] land ""LAND"" Ya, now I have this.... _wp1 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +500], 0, 1]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; _wp2 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +100], 0, 2]; [_group, 2] showWaypoint "NEVER"; [_group, 2] setWaypointSpeed "NORMAL"; [_group, 2] setWaypointType "MOVE"; _wp3 = _group addWaypoint [_targetpos, 0, 3]; [_group, 3] showWaypoint "NEVER"; [_group, 3] setWaypointSpeed "LIMITED"; [_group, 3] setWaypointType "MOVE"; [_group, 3] setWaypointStatements ["true", "(vehicle this) land 'LAND'"]; But that doesn't work either, getting frustrated :mad: Also tried.... _wp1 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +500], 0, 1]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; _wp2 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +100], 0, 2]; [_group, 2] showWaypoint "NEVER"; [_group, 2] setWaypointSpeed "NORMAL"; [_group, 2] setWaypointType "MOVE"; _wp3 = _group addWaypoint [_targetpos, 0, 3]; [_group, 3] showWaypoint "NEVER"; [_group, 3] setWaypointSpeed "LIMITED"; [_group, 3] setWaypointType "MOVE"; [_group, 3] setWaypointStatements ["true", "(vehicle this) land ""LAND"""]; Share this post Link to post Share on other sites
demonized 20 Posted August 19, 2011 i placed this in the init of the heli and it flys to me and lands... _null = (group this) spawn { _wp3 = _this addWaypoint [(getPos player), 0, 3]; _wp3 showWaypoint "NEVER"; _wp3 setWaypointSpeed "LIMITED"; _wp3 setWaypointType "MOVE"; _wp3 setWaypointStatements ["true", "(vehicle this) land ""LAND"""]; _this setCurrentWaypoint _wp3; }; maybe you have an issue with missing a suitable lz? i only tested on airport grounds. Share this post Link to post Share on other sites
ADuke 1 Posted August 19, 2011 i placed this in the init of the heli and it flys to me and lands... _null = (group this) spawn { _wp3 = _this addWaypoint [(getPos player), 0, 3]; _wp3 showWaypoint "NEVER"; _wp3 setWaypointSpeed "LIMITED"; _wp3 setWaypointType "MOVE"; _wp3 setWaypointStatements ["true", "(vehicle this) land ""LAND"""]; _this setCurrentWaypoint _wp3; }; maybe you have an issue with missing a suitable lz? i only tested on airport grounds. Right before these waypoints are created I have this.... _HLand = "HeliH" createVehicle (_targetpos); I can see it on the ground so it does in fact get created, I'm at a loss. :confused: ---------- Post added at 05:29 AM ---------- Previous post was at 05:01 AM ---------- OK, now it worked.... _HLand = "HeliH" createVehicle (_targetpos); _wp1 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +500], 0, 1]; [_group, 1] showWaypoint "NEVER"; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointType "MOVE"; _wp2 = _group addWaypoint [[_targetpos select 0, _targetpos select 1 +100], 0, 2]; [_group, 2] showWaypoint "NEVER"; [_group, 2] setWaypointSpeed "NORMAL"; [_group, 2] setWaypointType "MOVE"; _targetpos = getMarkerPos "mark_airsupport"; _wp3 = _group addWaypoint [_targetpos, 0, 3]; [_group, 3] showWaypoint "NEVER"; [_group, 3] setWaypointSpeed "LIMITED"; [_group, 3] setWaypointType "MOVE"; _wp3 setWaypointStatements ["true", "(vehicle this) land 'LAND'"]; It seems that I had to remind the code between the waypoints what "_targetpos" was. That and I changed the setWaypointStatements syntax slightly... Very, very odd -AD Share this post Link to post Share on other sites
demonized 20 Posted August 19, 2011 yeah it seems odd indeed, ,most likely a scope issue, though sometimes its just plain odd, some "sleep" and a fresh start might fix it, maybe you edited script and forgot to save it when re testing, maybe you have 2 different versions of the script and edited the wrong one etc... As you see i used _wp3 instead of [_group, 3] wich is the same thing, just makes it easier to keep track off, and easier/faster to type or copy paste. Share this post Link to post Share on other sites
Charles Darwin 10 Posted August 19, 2011 I spent about an hour racking my brain on why a script wasn't working only to find out that I had done exactly that I had created a second mission folder to save the original files so that as I was editing them I did not change 1 that was working semi well and discovered that I was editing 1 mission and testing the other 1. Lol Share this post Link to post Share on other sites