Page 1 of 1

Suggestion for better waypoint navigation

Posted: Wed Apr 21, 2010 10:11 pm
by rock5
I been thinking for awhile now that there is no really reliable waypoint navigation control.

When using "__WPL:setWaypointIndex(index)" if you add waypoints it will no longer point to the correct point. Plus it can be hard to find the right waypoint index if the commented numbers are wrong because of manual changes to the file.

You can use "__WPL:setWaypointIndex(__WPL:getNearestWaypoint(X, Z));" but it is possible to, either intentionally or unintentionally, have different waypoints with the same x, z values. So it's possible to go to the wrong waypoint.

What I envision is being able to add tags to the waypoints that get loaded when the waypoint list gets loaded. Something like this;

Code: Select all

	<!-- #  27 --><waypoint x="1111" z="2222" tag="Repair">	</waypoint>
So when it loads it records somewhere that "Repair"=27, maybe in an array. Then you could make a function to get that value, maybe GetTagIndex("Repair") which returns 27.

So to go to the correct waypoint without fail you would use;

Code: Select all

__WPL:setWaypointIndex(GetTagIndex("Repair"))
You also get the added benefit that you can copy code from 1 waypoint file to another similar waypoint file without having to change all the index values or x, z addresses. You would just need to put the tags at the correct waypoint. Also it wouldn't interfere with the functionality of any current waypoint files.

I don't believe it would be difficult to implement. All you would need to do is add an extra step when loading the waypoint file to read and store the tag values and create a function to get them.

What do you think.

Re: Suggestion for better waypoint navigation

Posted: Fri Apr 23, 2010 2:29 am
by Administrator
This is included in r437. The the function is CWaypointList:findWaypointTag(tagname). It is case-insensitive, and does not check for unique identifiers (that's up to the user to manage).

Example:

Code: Select all

	<!-- #  1 --><waypoint x="-265" z="-6430" tag="first"></waypoint>
	<!-- #  2 --><waypoint x="-260" z="-6430" tag="second">
		__WPL:setWaypointIndex(__WPL:findWaypointTag("first"));
	</waypoint>

Re: Suggestion for better waypoint navigation

Posted: Fri Apr 23, 2010 4:18 am
by rock5
Thanks again, you're a star.

I did think it was a good idea. :)