Jump to content
Sign in to follow this  
arthur666

kick crewmen from group if they get out of vehicle?

Recommended Posts

One thing that could make my armor engagements better would be preventing crewmen on foot from slowing down the whole platoon.

I have a mission where a platoon of T-90s has to cover alot of ground to flank an enemy position. The problem is, one tank will get damaged, the crew will bail, and slow down my whole group. Is there any way to make them leave the group and maybe try to run back to friendly territory?

Share this post


Link to post
Share on other sites

You may want to use event handlers.

In the init line of the tank enter:

this addEventHandler ["getout", {temp = _this execVM "getout.sqf"}];

getout.sqf:

_vehicle = _this select 0;
_unit = _this select 2;

_unit joinSilent grpNull; 
_unit doMove [color="Red"]<enter position of friendly base here>[/color];

I did not test it in the game so it might not work as is. In either case, I hope it explains the general idea.

Edited by dupa
Correction of a mistake: "killed" => "getout"

Share this post


Link to post
Share on other sites

I couldn't get that to work. I changed the getout.sqf to this

_vehicle = _this select 0;
_unit = _this select 2;

_unit join base; 

"base" is the name of a group set on HOLD that I put in the area I want the crewmembers to join and run to.

Still doesn't work. What am I missing?

Share this post


Link to post
Share on other sites

Your code seems to be correct. You should make sure that the variables "_unit" and "_base" contain the values they are supposed to contain.

Add the following line above the join command and run the mission:

player sidechat format ["unit:%1, base: %2", _unit, base];

"unit" should look something like: B 1-1-A:1

"base" should look something like: B 1-1-A

Share this post


Link to post
Share on other sites

Ok. I shot another tank in my group, the crew gets out, "UNIT:0 1-2-D:3 , BASE:0 1-1-l" is what I see. Do I need to name the unit? If so, where?

when you say:

make sure "_unit" and "_base" contain the values they are supposed to contain.

... I'm not quite sure what you mean. Sorry, I not very good at this.

Share this post


Link to post
Share on other sites

Ok, some mistakes here :

the "join" command works this way

[b][[/b]_unit[b]][/b] join name_of_group

So, if "base" is the name of the group that the unit must join ("base=group this" in the init line of the group leader), modify the script this way :

_unit = _this select 2;
[_unit] joinSilent grpNull; 
_unit doMove getpos leader base;
waituntil {unitready _unit};
[_unit] joinsilent base;

If the group "base" may move in between (before the _unit reaches the leader of base), you'll have to use insert such a line :

while {_unit distance leader base > 10} do {_unit doMove getpos leader base;sleep 10;};

Share this post


Link to post
Share on other sites

Hey thanks! That seems to work.

Now I'll just make 2 .sqf files, one called westgetout and one called eastgetout (so crewmen run to the proper base) and set up my large armor battle with the proper init line code in every tank on the map. I'll probably use this with most any mission of mine that has more than one or two tanks involved.

Much better.

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  

×