Jump to content

Recommended Posts

Hi guys, I want a truck to drive trough waypoints forever, "teleporting" from the last waypoint to the first one and then driving again trough all of them.
 

_wp1 = truck addWaypoint [[9111.79,6941.89,0], -1];
_wp1 setWaypointType "MOVE";
_wp2 = truck addWaypoint [[8480.47,7041.75,0], -1];
_wp2 setWaypointType "MOVE";
_wp3 = truck addWaypoint [[8341.9,7586.22,0], -1];
_wp3 setWaypointType "MOVE";
_wp3 setWaypointStatements ["true", "this setPos [9178.48,6907.43,0]"];

This applied to the composition makes only the driver to do what I want, but the vehicle itself stays on the last waypoint. Any ideas?   
 

Share this post


Link to post
Share on other sites

How about just use waypoints without scripting?

  • Like 1

Share this post


Link to post
Share on other sites
_wp3 setWaypointStatements ["true", "vehicle this setPos [9178.48,6907.43,0]; group this setCurrentWaypoint ( waypoints group this select 1 )"];

 

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, Larrow said:

_wp3 setWaypointStatements ["true", "vehicle this setPos [9178.48,6907.43,0]; group this setCurrentWaypoint ( waypoints group this select 1 )"];

 

 

This applied to composition init makes the truck to stay on one place and not move. 😟

Share this post


Link to post
Share on other sites
19 hours ago, kibaBG said:

This applied to composition init makes the truck to stay on one place and not move.

I do not see the same behaviour.

I created a vehicle and a Gamelogic, placed addwaypoints code from your post into gameLogic, then changed the code as per my post.

I then saved it as a composition and deleted the original.

Wherever I place the composition the truck will perform its three waypoints and when it reaches the last one will be teleported to the first and begin its waypoints again from that wp.

TruckWP composition

 

 

Not quite sure what you mean by "composition init"? A composition does not have an init.

Share this post


Link to post
Share on other sites

A very simple fix is to use JEBUS

 

You can spawn a unit use editor placed waypoint at the last waypoint you can delete unit and JEBUS will respawn the vehicle and all the waypoints as many times you want it to spawn back in the mission 

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

×