Jump to content

Recommended Posts

Hello, I made a tiny script to add two waypoints. But as soon as the unit goes to the first one he doesn't move to the second one, help?

 

	nicholas enableAI "PATH";
	
	// First waypoint
	_wp1 = group nicholas addWaypoint [getPos nicholas_wp_1, 0];
	_wp1 setWaypointType "MOVE";
	[group nicholas, 0] setWaypointVisible false;
	[group nicholas, 0] showWaypoint "NEVER";
	[group nicholas, 0] setWaypointCompletionRadius 5;
	
	// Second waypoint
	_wp2 = group nicholas addWaypoint [getPos nicholas_wp_2, 1];
	_wp2 setWaypointType "MOVE";
	[group nicholas, 1] setWaypointVisible false;
	[group nicholas, 1] showWaypoint "NEVER";
	[group nicholas, 1] setWaypointCompletionRadius 1;

 

Share this post


Link to post
Share on other sites

I think you redefine the 'group Nicholas' twice in the wp2.

Try to define a unique variabile for group Nicholas.

_groupN = group Nicholas;

And use this for the two wp.

 

Share this post


Link to post
Share on other sites

This ...

40 minutes ago, sizraide said:

[group nicholas, 0]

and this...

40 minutes ago, sizraide said:

[group nicholas, 1]

Should be the waypoint, much like you have done for setWaypointType, ie. _wp1 and _wp2 respectively.

 

This...

42 minutes ago, sizraide said:

addWaypoint [getPos nicholas_wp_1, 0];

the 0 here is random placement around the given point, not the waypoints index.

 

43 minutes ago, sizraide said:

[group nicholas, 0]

Index 0 is a special waypoint that relates to where the unit spawns and is pointless to change it.

  • Like 2

Share this post


Link to post
Share on other sites
17 minutes ago, Enigx said:

I think you redefine the 'group Nicholas' twice in the wp2.

 

Nothing is being redefined. 

//groupName addWaypoint [center, radius, index, name]

_wp1 = group nicholas addWaypoint [getPos nicholas_wp_1, 0];

 

Two thoughts:

 

Is the position "nicholas_wp_2" correctly named?

 

Is the unit actually able to get within 5 meters of the first waypoint?

 

*edit* - and what @Larrow said. Good to see you!

Share this post


Link to post
Share on other sites
1 hour ago, Larrow said:

This ...

and this...

Should be the waypoint, much like you have done for setWaypointType, ie. _wp1 and _wp2 respectively.

 

This...

the 0 here is random placement around the given point, not the waypoints index.

 

Index 0 is a special waypoint that relates to where the unit spawns and is pointless to change it.



I did this, and it still occurs?

	nicholas enableAI "PATH";
	_grp = group nicholas;
	
	// first waypoint
	_wp1 = _grp addWaypoint [getPos nicholas_wp_1, 0];
	_wp1 setWaypointType "MOVE";
	_wp1 setWaypointVisible false;
	_wp1 showWaypoint "NEVER";
	
	// second waypoint
	_wp2 = _grp addWaypoint [getPos nicholas_wp_2, 0];
	_wp2 setWaypointType "MOVE";
	_wp2 setWaypointVisible false;
	_wp2 showWaypoint "NEVER";

 

Share this post


Link to post
Share on other sites
1 hour ago, Harzach said:

 

Nothing is being redefined. 


//groupName addWaypoint [center, radius, index, name]

_wp1 = group nicholas addWaypoint [getPos nicholas_wp_1, 0];
 

 

Two thoughts:

 

Is the position "nicholas_wp_2" correctly named?

 

Is the unit actually able to get within 5 meters of the first waypoint?

 

*edit* - and what @Larrow said. Good to see you!


Yep, tested it. He does.

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

×