Home   Help Search Login Register  

Author Topic: Adding waypoint to a vehicle  (Read 1655 times)

0 Members and 1 Guest are viewing this topic.

Offline Callsign

  • Members
  • *
Adding waypoint to a vehicle
« on: 18 Jan 2012, 16:59:57 »
Hi guys,

I'm hoping to copy a BIS PMC mission slightly by having a player (Pat) (in a heli) follow another group (leader name Ryan) that is in a suv (suv1).
For this to work I just need a waypoint to appear over the suv as its moving to it's destination, then when it does I want the script (if there is any) to end so the player goes on to the next waypoint. I've searched but the other threads don't seem to be relevant or are only for AI.

Any ideas?


Callsign

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Adding waypoint to a vehicle
« Reply #1 on: 18 Jan 2012, 17:13:56 »
Since waypoints are (unless disabled in the difficulty settings) always visible while in an aircraft, the easiest way is to have a waypoint that never finishes - for instance a Hold WP - and then just moving that one around as you see fit. The command for this is setWaypointPosition. Simply move the waypoint when necessary from objective to vehicle.

Now, the problem with a moving vehicle of course is that you'd either need a loop to make sure it stays on the vehicle all the time, or then you need to attach the WP to the vehicle (like when you double-click on a unit and place a Destroy waypoint over it, that WP will remain on top of the vehicle even when you move it around the map, and the same is true in-game). The command for this in turn is waypointAttachVehicle. I'm not entirely sure, but I would assume you can unattach it either by setting the waypoints position somewhere else, or by "attaching" it to ObjNull.

Those two commands should be enough to solve your dilemma :)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Callsign

  • Members
  • *
Re: Adding waypoint to a vehicle
« Reply #2 on: 18 Jan 2012, 18:35:21 »
Thanks Wolfrug,

Problem solved -

Using your above suggestions, I added a hold waypoint for the player on the suv1 (empty vehicle that Ryan then gets in). In the On Activation box I added the following;
[Pat, 1] waypointAttachVehicle vehicle suv1; [Pat, 1] setWaypointPosition [position suv1, 0]

It updates every 2 to 4 seconds over the position of the vehicle which is fine.

Thanks