Jump to content
Archosaurus

Find leader of group and addWaypoint onto group leader?

Recommended Posts

Hello. 

 

I've run into a huge problem and I need your help, forums. I've tried everything, and there just isn't a satisfactory way to do this.

 

Let me underlay the scenario:

 

 

 

 

I have one group of INDFOR attacking a BLUFOR position. I have a BLUFOR QRF stationed elsewhere. 

 

Once the BLUFOR is aware of the INDFOR, a simple .sqf runs via trigger that sends the QRF to attack the INDFOR.

 

In the .sqf I have:

 

wp1 = QRF_group addwaypoint [getpos Arch, 100]; //Player is named, and I know I can use "position player, 100" as well. That's not the point.
wp1 setwaypointType "MOVE"; 
wp1 setWaypointCombatMode "YELLOW"; 
wp1 setWaypointFormation "WEDGE"; 
wp1 setWaypointSpeed "NORMAL"; 
wp1 setWaypointBehaviour "AWARE"; 
wp1 setWaypointCompletionRadius 10; 
 
and more.  
 
They simply get a waypoint to move roughly onto my position where I was when the script went off. There's nothing wrong with that, it works fine.
 
 
What I want to do is to make a script that checks the LEADER of the current group, NOT the player or a single named unit. The reason being that the named unit can always die before they get there, and then the script will work incorrectly/not work at all.
 
 
I tried referencing the group, which I named in the leader's init, but it didn't work. I tried a marker method by calling the leader, but it didn't work. I've tried so many I can't remember half of them.
 
How exactly would this be done, in the most simple way possible?
 
 
All I need is a script that makes a move waypoint onto a group's leader, even if the old leader has died prior. Thanks.
 
 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

wp1 = QRF_group addwaypoint [getpos leader player, 100];

That'd work fine, I imagine, if I wasn't trying to get it to work with an AI group.

 

When I tried referencing the group that I named, I got an error back. Perhaps I put it in incorrectly.

 

I'll try this and see if it works.

 

wp1 = QRF_group addwaypoint [getpos leader _group, 100];

 

EDIT: Oh wow, it works. The hours of pulling my hair out have finally been made up for. This is simple and nice like I want it, no idea why I missed this approach.

 

Thanks a lot. 

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

×