Jump to content
Sign in to follow this  
dragonsyr

addwaypoint position

Recommended Posts

i want to add a waypoint in a place without the use of another object ex

_wpfollow = fm addWaypoint [position _helipad, 0];

but something like this

_wpfollow = fm addWaypoint [position {1797.8877,5.5,5777.0903}, 0];

is this possible?

Share this post


Link to post
Share on other sites

Yes, I think it is this:

_wpfollow = fm addWaypoint [[1797.8877,5.5,5777.0903], 0];

Dirty Haz

Share this post


Link to post
Share on other sites

Syntax:

Array = groupName addWaypoint [center, radius] or [center, radius, index]

Parameters:

groupName: Group

[center, radius]: Array

center: Position or Object

index: Number

Return Value:

Array - format Waypoint

Examples

Example 1:

_wp = grp addWaypoint [position player, 0]

Postion is an arrray. Normaly addwaypoint [[x,z,y],0] but i'm not sure. Try it

Share this post


Link to post
Share on other sites

i have this

fmdriver assignAsDriver followme;
[fmdriver] orderGetIn true;
_wpfollow = fm addWaypoint [[1797.8877,5.5,5777.0903], 0];//this is the position of _helipad as i get it from the mission.sqm (position[]={1797.8877,5.5,5777.0903};)
//_wpfollow = fm addWaypoint [position _helipad, 0];
[fm, 2] setWaypointBehaviour "CARELESS";
[fm, 2] setWaypointCombatMode "BLUE";
[fm, 2] setWaypointSpeed "FULL";
waitUntil { (currentWaypoint (_wpfollow select 0)) > (_wpfollow select 1) };
_wpfollow1 = fm addWaypoint [position speakerfm, 0];
[fm, 2] setWaypointBehaviour "CARELESS";
[fm, 2] setWaypointCombatMode "BLUE";
[fm, 2] setWaypointSpeed "FULL";
//[fm, 2] setWaypointType "GETIN NEAREST";
waitUntil { (currentWaypoint (_wpfollow1 select 0)) > (_wpfollow1 select 1) };
[fmdriver] orderGetIn false;

the commented line is the place i want the unit go. with this is working.

but as it is , the unit get in the car, waiting for 4-5secs and get out again....

Share this post


Link to post
Share on other sites

Try something like this:

_vfm = vehicle fm;
_wpfollow = _vfm addWaypoint [[1797.8877,5.5,5777.0903], 0];

Dirty Haz

Share this post


Link to post
Share on other sites

Do not use [fm, 2] unless your absolutely sure that is the correct index. As you have just added the waypoint and you have a reference to it in _wpfollow use that instead.

There is no need for the first waituntil as waypoints are added to the units list sequentially.

What is fm ? You show no code that this is the units group, below i have replaced fm with (group fmDriver).

Heres a quick example of your code with changes that i have just tested in the editor - working.

	fmdriver assignAsDriver car1;
[fmdriver] orderGetIn true;
_wpfollow = (group fmdriver) addWaypoint [[1850.04,5669.85,0], 0];
_wpfollow setWaypointBehaviour "CARELESS";
_wpfollow setWaypointCombatMode "BLUE";
_wpfollow setWaypointSpeed "FULL";
_wpfollow = (group fmdriver) addWaypoint [[1716.58,5698.64,0], 0];
_wpfollow setWaypointBehaviour "CARELESS";
_wpfollow setWaypointCombatMode "BLUE";
_wpfollow setWaypointSpeed "FULL";
waitUntil { (currentWaypoint (_wpfollow select 0)) > (_wpfollow select 1) };
[fmdriver] orderGetIn false;

fmDriver gets in car1 drives to the two waypoints and then gets out. For this type of functionality you dont even need the waituntil (i know i gave you this code in another thread but it was a cover all situation dependant on the code in that thread) instead you can use the setWaypointStatements command instead e.g

	fmdriver assignAsDriver car1;
[fmdriver] orderGetIn true;
_wpfollow = (group fmdriver) addWaypoint [[1850.04,5669.85,0], 0];
_wpfollow setWaypointBehaviour "CARELESS";
_wpfollow setWaypointCombatMode "BLUE";
_wpfollow setWaypointSpeed "FULL";
_wpfollow = (group fmdriver) addWaypoint [[1716.58,5698.64,0], 0];
_wpfollow setWaypointBehaviour "CARELESS";
_wpfollow setWaypointCombatMode "BLUE";
_wpfollow setWaypointSpeed "FULL";
_wpfollow setWaypointStatements ["true", "[fmdriver] orderGetIn false"];

On reaching the waypoint the statement will fire making fmDriver getout of the vehicle

Share this post


Link to post
Share on other sites

[1797.8877,5.5,5777.0903]

x = 1797.8877

y = 5.5

z = 5777.0903

z would be nearly 6000 meters elevation

to get the correct position use getpos,getpsASL or getposATL

copytoclipboard str getpos obj;

Then you can paste the co-ords in the script example [1596.09,5272.27,0.00143862]

Share this post


Link to post
Share on other sites

Nice catch Sel didnt notice that

Share this post


Link to post
Share on other sites

fm is the groupname of the unit

in unit init fm=groupthis;
( i thought that the waypoint need only goupnames for working)

and for the coordinates i have there , i get from the mission sqm as i say.....

ok then, i ll try all that you gave me ...

---------- Post added at 19:26 ---------- Previous post was at 19:20 ----------

to get the correct position use getpos,getpsASL or getposATL

copytoclipboard str getpos obj;

Then you can paste the co-ords in the script example [1596.09,5272.27,0.00143862]

ok i must figure out how can i do that... is a good help for find out the positions that i want to set...

---------- Post added at 19:36 ---------- Previous post was at 19:26 ----------

my total script is this and is a test for follow me car in airport (i hope )

_cf = "FlagChecked_F" createVehicle [0,0,0];
_chem = "Chemlight_yellow" createVehicle [0,0,0]; 
//playSound3D [_sdplay5, speakerfm, true, getPos speakerfm, 10, 1, 150];//speakerfm say3D "alarmfm";
fmdriver assignAsDriver followme;
[fmdriver] orderGetIn true;
_wpfollow =  fm addWaypoint [position pad, 0];
if (isNil {missionNamespace getVariable "f_light"}) then
{
follow_m_array = []; // Define once
if ((count follow_m_array) == 0) then
{
_cf attachTo [followme,[ 0,-3,0.5]];
_chem attachTo [followme,[ 0,-3,0.7]];
follow_m_array set [(count follow_m_array), _cf];
 follow_m_array set [(count follow_m_array), _chem];
getPos player;copytoclipboard str getpos obj;
};
missionNamespace setVariable ["f_light", follow_m_array];
};


fmdriver assignAsDriver car1;
   [fmdriver] orderGetIn true;
   _wpfollow = (group fmdriver) addWaypoint [[1802.43,5795.26,0.00143862], 0];
   _wpfollow setWaypointBehaviour "CARELESS";
   _wpfollow setWaypointCombatMode "BLUE";
   _wpfollow setWaypointSpeed "FULL";
waitUntil { (currentWaypoint (_wpfollow select 0)) > (_wpfollow select 1) };
hint"Follow me waiting.....";sleep 2;
   _wpfollow = (group fmdriver) addWaypoint [[1889.53,5716.83,0.00143147], 0];
   _wpfollow setWaypointBehaviour "CARELESS";
   _wpfollow setWaypointCombatMode "BLUE";
   _wpfollow setWaypointSpeed "FULL";
   waitUntil { (currentWaypoint (_wpfollow select 0)) > (_wpfollow select 1) };
   hint"Follow me back in place.....";sleep 2;
   [fmdriver] orderGetIn false;  

//[]execvm"atc\followme.sqf";
if (!isNil {missionNamespace getVariable "f_light"}) then {{ follow_m_array = follow_m_array - [_x]; deleteVehicle _x;} forEach follow_m_array; f_light = nil;};

this is it, i post it for you to know excactly what im trying to do..

the car is vehicle="B_MRAP_01_F";

working perfect

Edited by dragonsyr

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×