Jump to content
Sp0oX

(SOLVED) how to move a waypoints position with a trigger?

Recommended Posts

hey guys I've been trying to figure this out for a few days now, i have searched google and here and reddit but can seem to find a solution for what I'm doing wrong. to give you an idea of what im attempting to do I want to have several units on patrol across a map and when a unit leader dies I want a helicopter to take off do a search and destroy at the death position then return and land back at takeoff point if its not destroyed. now each unit leader has a variable name so ill just use one as an example. so the setup is as follows a unit with leader variable postest1 a helicopter with variable name helo1 that has 4 waypoints wp1 is a Hold wp2 Seek and destroy wp3 land wp4 cycle. then I have a trigger set up as a Type: SkipWaypoint (linked to the Hold WP of the helo) with !alive postest1 as condition and in the On Activation I have the following 

heloSAD setWaypointPosition [position postest1, 0];

where heloSAD is the name I gave in the "Identified" field of the helos wp2 (the seek and destroy)

now I'm obviously doing something wrong because when postest1 dies the trigger skips the hold wp like its supposed to but then the seek and destroy wp does not change positions to the death location of postest1.
If anyone knows how to fix this or even a better way of doing it I would really appreciate some help here.

Share this post


Link to post
Share on other sites

In the command, identify the waypoint by its number.
Also try the setCurrentWaypoint command:

[group driver heli1, 3] setWaypointPosition [position postest1, 0];
// As far as it is clear from the explanation, the heli1 waypoint SAD has the ordinal number 3.
(group driver heli1) setCurrentWaypoint [group driver heli1, 3];

 

  • Like 1

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/setWaypointPosition:

 

Quote

Parameters: waypoint: Array - format Waypoint

 

So your code needs to be something along the lines of:

[myHeloGroup, 2] setWaypointPosition [position postest1, 0];

//OR, FOR EXACT POSITION

[myHeloGroup, 2] setWaypointPosition [getPosASL postest1, -1];

 

  • Like 1

Share this post


Link to post
Share on other sites

Hey thank you for the quick and awesome response!!!! I was able to get it working with your help! my problem was I never clicked in to the "group" aspect fo the waypoint I had tried using my variable name for the helicopter instead never realized i had to use the group instead. thank you guys again!!!!

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

×