Jump to content
Sign in to follow this  
Meatball0311

Scripting Waypoints

Recommended Posts

Situation - man named "ins14"

Marker - marker named "ins14pos1"

How do I create waypoints? How do I make "ins14pos1" a waypoint so I can setWaypointBehavior, setWaypointCombatMode, setWaypointType, etc......

*EDIT* I have learned how to create a waypoint

this is what I got:

_ins14 = ins14

_ins14gp = ins14gp

_ins14pos1 = getMarkerPos "ins14pos1"

_wp114 = _ins14gp addWaypoint [_ins14pos1, 0]

_wp114 setWaypointType "MOVE"

_ins14 doMove _wp114

**the error that I keep on getting is "_ins14 doMove _wp114 error group expect number"

PLEASE HELP

Share this post


Link to post
Share on other sites

addWayoint looks like it will do the trick.

getMarkerPos returns the position of your marker.

edit: doMove expects a position array, not a waypoint array. Use setCurrentWaypoint instead. To clear any move orders they may have and get them heading to the waypoint, doMove the unit to their own position.

Share this post


Link to post
Share on other sites

I dont understand what I am doing wrong?

;declaring variables

_ins14 = ins14

_ins14gp = ins14gp

;using getmarkerpos

_ins14pos1 = getMarkerPos "ins14pos1"

;using addWaypoint

_wp114 = _ins14gp addWaypoint [_ins14pos1, 0]

;setting waypoint type

_wp114 setWaypointType "MOVE"

;using setCurrentWaypoint

_ins14gp setCurrentWaypoint [_ins14gp, 0]

*EDIT*

I also tried this. I did not get any errors, but my man still did not move to waypoint?

ins14gp addWaypoint [getMarkerPos "ins14pos1", 0]

[ins14gp, 0] setWaypointType "MOVE"

ins14gp setCurrentWaypoint [ins14gp, 0]

How do I get the unit to move to the waypoint? And what is the waypoints name?

Share this post


Link to post
Share on other sites

Remember that a group always has a waypoint 0 created at it's leaders initial position. Try something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">group1 addWaypoint [position player, 0]

[group1, 1] setWaypointType "MOVE"

group1 setCurrentWaypoint [group1,1]

Share this post


Link to post
Share on other sites

_ins14 = ins14

_ins14gp = ins14gp

ins14gp addWaypoint [position ins14, 0]

ins14gp addWaypoint [getMarkerPos "ins14pos1", 1]

[ins14gp, 1] setWaypointType "MOVE"

ins14gp setCurrentWaypoint [ins14gp, 1]

**I get no errors, but still the unit does not move to waypoint**

Share this post


Link to post
Share on other sites
Quote[/b] ]ins14gp addWaypoint [position ins14, 0]

ins14gp addWaypoint [getMarkerPos "ins14pos1", 1]

I'm not sure why you have added two waypoints here.

My posted example works as expected when the unit is static (no waypoints in the editor) and when it is already moving to an existing waypoint. A unit (including the group leader?) with individual movement orders (eg doMove) will not follow group waypoints until he has completed his individual movement order, which may be the case for you? AI leaders tend to give a lot of individual orders in ArmA. If so, unitName doMove position unitName will stop him and he will return to the group.

The only other thing I can think of is using an undefined group name (no errors).

Share this post


Link to post
Share on other sites

I am using this and it is working fine ATM.

_ins14 = ins14

_ins14gp = ins14gp

_wp114 = _ins14gp addWaypoint [getMarkerPos "ins14pos1", 10]

[ins14gp, 1] setWPPos getMarkerPos "ins14pos1"

_ins14gp setCurrentWaypoint _wp114

_wp114 setWaypointType "SAD"

_wp114 setWaypointSpeed "LIMITED"

_wp114 setWaypointCombatMode "RED"

**Question**

How do you give the group a second waypoint to go to AFTER they complete the first one?

Share this post


Link to post
Share on other sites

By using addwaypoint again. The 2 most likely things that are fouling you up (should you have tried it already) are setCurrentWaypoint and making the waypoints search and destroy types. If you setCurrentWaypoint to the second waypoint, the first will be skipped (obviously). SAD waypoints take some time to achieve. For testing, set it temporarilly to a move waypoint.

Example (not tested, so you'll have to correct maybe):

_ins14 = ins14

_ins14gp = ins14gp

_wp114 = _ins14gp addWaypoint [getMarkerPos "ins14pos1", 10]

[ins14gp, 1] setWPPos getMarkerPos "ins14pos1"

_wp114 setWaypointType "MOVE"

_wp114 setWaypointSpeed "LIMITED"

_wp114 setWaypointCombatMode "RED"

_ins14gp setCurrentWaypoint _wp114

_wp214 = _ins14gp addWaypoint [getMarkerPos "ins14pos2", 10]

[ins14gp, 1] setWPPos getMarkerPos "ins14pos2"

_wp214 setWaypointType "MOVE"

_wp214 setWaypointSpeed "LIMITED"

_wp214 setWaypointCombatMode "RED"

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  

×