Jump to content
Sign in to follow this  
wombat50

setDir for a formation of soldiers

Recommended Posts

Hi,

I have a formation of soldiers, lined up two abreast, with maybe 100 total.

I want them to march across a bridge which they do fine using this in a trigger which covers the formation of soldiers. It puts them all in a walking animation. Set to trigger once, for anybody and in the ACT. field:

{_x playMove "AmovPercMwlkSlowWrflDf"}foreach thislist;

I would like the formation to continue and follow bends in the road. As it is whatever direction they are facing initially they will continue in that direction indefinitely. I tried waypoints but since they are in animation state they ignore them?

So I have made another trigger which they enter and hopefully will change their direction.

Set to trigger repeatedly, for anybody and ACT field is:

{_x setDir 130}foreach thislist;

The trigger works for the first pair abreast but the rest of the formation continues on the original direction.

I have looked here and searched elsewhere for a solution. Tried some other code but to no avail.

Thanks.

Share this post


Link to post
Share on other sites

Give the leader waypoints but place the way points very close together. Then they will follow the curve of the road.

They tend to walk in a near straight line from one way point to the next. For example place way points 200 meters apart and see where the soldiers go.

.

Share this post


Link to post
Share on other sites

Thanks for the reply Joe.

I am familiar with what you have said. But in this case I wish the formation of soldiers to cross a bridge which never seems to work with waypoints.

I have put all the members of the formation in an animation state and they do nicely crossing the bridge. In my testing in an animation state they ignore any waypoints.

When using waypoints to direct a large group their behavior can be erratic where in the animation state they maintain a good tight formation.

Maybe it is not possible to make a formation in a walk animation change direction? However, the trigger I used in the first post does work as it should but only for the first two soldiers abreast. The rest continue in the initial direction. As the trigger is set to repeatedly I don't understand why it doesn't keep working.

Short clip how it looks ingame. You can see the first two soldiers change direction but none of the others do.

https://www.youtube.com/watch?v=oCWghIZ0FtI

This video is soldiers in a group using waypoints

https://www.youtube.com/watch?v=QwEDKvdInrk

Thanks again

Edited by wombat50

Share this post


Link to post
Share on other sites

Continuing on your original idea to use a trigger for this, the idea seems to work. Setting the direction of an unit while that unit is in a walking animation will change his direction. The problem you have is that you have a small trigger, I assume, and the trigger will activate the moment an unit enters the trigger area.

Because of this, 'thislist' returns only the people in the trigger area, which are the first two people.

What you have to do is either put a delay on the trigger, or use a trigger that covers all units, maybe with a delay as well.

I will get back on this when I get home.

Kind regards,

Sanchez

Share this post


Link to post
Share on other sites

Syntax for setDir:

object setDir heading

If I could use a variable or description for "object" so when an "object" enters the trigger it obeys the command.

I can pass the command on a group but the group performs the command all at the same time.

What I would like is for each object to change direction only when entering the trigger zone.

I have messed with making the trigger larger but using foreach thislist makes them change direction immediately instead of at the trigger.

Thanks for the help and patience!

Share this post


Link to post
Share on other sites

I got it working with the code in the first post.

I had the spacing of the soldiers too close and the trigger was too big so I made it only 1 meter deep.

If more than 2 soldiers abreast were in the trigger the remaining would not follow the command to change direction.

Share this post


Link to post
Share on other sites

Good to hear that you've got it working.

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  

×