Jump to content
Sign in to follow this  
jakkob4682

how to check in unit is waypoint? or check if the groups waypoint completed?

Recommended Posts

Hopefully not beating a dead horse, but can you use the "in" command to check if a unit is in a waypoint? i.e. a created a waypoint in a script and need to check if the unit the waypoint belongs to is "in" the waypoint in order for the unit to call another function.

Share this post


Link to post
Share on other sites

Hey take a look at this

sleep 15;

hint "Squad Leader advance to the sector that you want Squad Hawk to engage in combat";

//staging sector

wp1 = GroupA addwaypoint [position Player, 100];

wp1 setwaypointtype "MOVE";

wp1 setWaypointCombatMode "RED";

wp1 setWaypointFormation "VEE";

wp1 setWaypointSpeed "FULL";

wp1 setWaypointBehaviour "AWARE";

wp1 setWaypointCompletionRadius 25;

wp1 setWaypointStatements ["true", "hint 'Hawk1';"];

wp1 setWaypointTimeout [5,5,5];

here is a example of a waypoint via script to a squad the command you are looking for is setWaypointStatements

Hope this helps.

Share this post


Link to post
Share on other sites
Hey take a look at this

sleep 15;

hint "Squad Leader advance to the sector that you want Squad Hawk to engage in combat";

//staging sector

wp1 = GroupA addwaypoint [position Player, 100];

wp1 setwaypointtype "MOVE";

wp1 setWaypointCombatMode "RED";

wp1 setWaypointFormation "VEE";

wp1 setWaypointSpeed "FULL";

wp1 setWaypointBehaviour "AWARE";

wp1 setWaypointCompletionRadius 25;

wp1 setWaypointStatements ["true", "hint 'Hawk1';"];

wp1 setWaypointTimeout [5,5,5];

here is a example of a waypoint via script to a squad the command you are looking for is setWaypointStatements

Hope this helps.

I know how to setwaypointStatement what I want to know is how to check when the waypoint is complete. I.E. waitUntil {currentWaypoint _grp complete} or waitUntil {_vehicle in list _wp} something along those lines.

Share this post


Link to post
Share on other sites

I am telling you the setWaypointStatements ["true", "hint 'Hawk1';"]; will tell you when the waypoint is done! The hint will not go off until the waypoint movements is completed and a 5 second delay before the next waypoint will start. You can set the delay what ever time you want just adjust the timeout [5,5,5,]. Maybe I don't understand what you are looking for. You want to know when a waypoint you set via script is done/completed?

Share this post


Link to post
Share on other sites
I am telling you the setWaypointStatements ["true", "hint 'Hawk1';"]; will tell you when the waypoint is done! The hint will not go off until the waypoint movements is completed and a 5 second delay before the next waypoint will start. You can set the delay what ever time you want just adjust the timeout [5,5,5,]. Maybe I don't understand what you are looking for. You want to know when a waypoint you set via script is done/completed?
You want to know when a waypoint you set via script is done/completed?
yes. I.E.

_i = 1;
_wp = currentWaypoint _group;
_wpIdx = _wp + _i;
//if(_wp completed?) or if(_veh in list _wp) then
{
//create another waypoint
// _rtb = _group addWaypoint [_rtbPos,50,_wpIdx];
}

Edited by jakkob4682

Share this post


Link to post
Share on other sites

is there a better way to do it? you can't use local variable inside of waypointStatements or trigger statements so i'm not really sure how to tell the script when to create the second waypoint since I don't know how to check if the waypoint is complete without using waypoint statements, which as I stated won't work since the group the waypoint belongs to is created locally.

---------- Post added at 09:45 PM ---------- Previous post was at 09:38 PM ----------

I guess one simple solution is to make the group a global variable, and create a seperate function to add the next waypoint and call that from the waypointStatements?

Share this post


Link to post
Share on other sites

I don't know brother! the waypointStatement is the only way I know how to check if the waypoint is reached. I am still a little lost with the whole locally

vs global thing and my overall scripting knowledge is cut and paste codes with no real knowledge of scripting language. Trail and error method lol a lot of error(: Good luck and please post if you find out I would like to know.

Share this post


Link to post
Share on other sites
I don't know brother! the waypointStatement is the only way I know how to check if the waypoint is reached. I am still a little lost with the whole locally

vs global thing and my overall scripting knowledge is cut and paste codes with no real knowledge of scripting language. Trail and error method lol a lot of error(: Good luck and please post if you find out I would like to know.

i think you can use getWPPos and run a distance check also to see if the waypoint is reached. I.E. if the waypointCompletionRadius is 50 then you could simply check if vehicles distance from the waypoint is <= 50

jsut checked and the distance check using getWPPos does indeed work. placed a waypoint for the player, placed a trigger. In the trigger condition field "player distance (getWPPos [group player,1]) < 100)" in the activation "hint 'complete'. and that did the trick. Assuming the distance is equal to the completion radius should work fine. Next step is to add an eventHandler for landed i guess to check that the helo/plane has indeed landed.

Edited by jakkob4682

Share this post


Link to post
Share on other sites

AVIBIRD 1 already gave you the information you wanted:

setWaypointStatements - The waypoint is done only when the condition is fulfilled. When the waypoint is done, the statement expression is executed.

Why would you want to place a trigger just to check if a player was inside a waypoint radius??? The waypoint already has a radius which triggers via the condition....

Condition:

yourUnit in thisList - see the linked page for the use of this, and thisList

You may also try unitReady, but make note of Rube's findings at the bottom

As for you question regarding using local variables in the statement:

see post from Demonized - although I have never had to use this method

Another option by DTM2801:

Mulitple vehicle - transport script

Edited by panther42

Share this post


Link to post
Share on other sites

@panther42. I know you gave me the formation I was just trying to pass it on to jakkob. It was has thread and question(:

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  

×