Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
rick rawlings

Getting units to join a group if alive

Recommended Posts

1. So I have a convoy with three different cars. As we are travelling along, we get ambushed and the lead car gets taken out with an RPG. At this point I force everyone out of the cars to fight with this:

unAssignVehicle ed3; 
ed3 action ["EJECT", car3];
bob4 action ["EJECT", car3]; 
unAssignVehicle bob5; 
bob5 action ["EJECT", car3]; 
bob6 action ["EJECT", car3]; 
bob7 action ["EJECT", car3];  
bob2 doTarget pad; 
bob2 fire ["SmokeShellMuzzle","SmokeShellMuzzle","Smokeshellred"];  
bob3 fire ["SmokeShellMuzzle","SmokeShellMuzzle","Smokeshellpurple"];
h = true;
hint "script is done";

This works pretty well. Meanwhile, ed0 and ed1 are in the lead car which is toast. Occasionally however, the opfor is a poor shot and doesn't kill car1 on the first shot. This leads ed0 and ed1 to get out and since you can be standing directly next to a vehicle when it explodes and not die, they aren't killed on the second shot either. So for the next 4 minutes, they are just standing around during a raging firefight looking totally, immersively blowing, computer generatedly stupid.

What I would like them to do is join ed3's group and go somewhere. So I tried this:

unAssignVehicle ed3; 
ed3 action ["EJECT", car3];
bob4 action ["EJECT", car3]; 
unAssignVehicle bob5; 
bob5 action ["EJECT", car3]; 
bob6 action ["EJECT", car3]; 
bob7 action ["EJECT", car3];  
ed0 join ed3;
ed1 join ed3;
bob2 doTarget pad; 
bob2 fire ["SmokeShellMuzzle","SmokeShellMuzzle","Smokeshellred"];  
bob3 fire ["SmokeShellMuzzle","SmokeShellMuzzle","Smokeshellpurple"];
h = true;
hint "script is done";

The problem is, since they usually die, the script hangs on their dead bodies not being able to join ed3. So I figured I probably need to do something like this:

...  
if (alive ed0) then {ed0 join ed3} else {}; 
...

but that syntax doesn't seem to work. What would be the correct way to get this to work?

2. In the script above, I have bob2 target the invisible helipad "pad" before firing the smoke grenade but he always just throws it any old damn place regardless. Can you have a unit pop smoke at a specific place?

3. Once ed0 and ed1 join ed3, I want

edgroup = group ed3

to

edgroup doMove getMarkerPos "flee1"

but they never really go anywhere. ed3 will if I doMove him by himself, but how do you get the group to go?

Can any one solveThese forEach thisMe?

Thanks!

RR

Share this post


Link to post
Share on other sites

I'm not sure and can't test right now.

if (alive ed0) then {[ed0] join ed3} else {};

to move them it may be this

edgroup = group ed3
{_x doMove getMarkerPos "flee1"} foreach units edgroup

Edited by F2k Sel

Share this post


Link to post
Share on other sites
I'm not sure and can't test right now.

if (alive ed0) then {[ed0] join ed3} else {};

to move them it may be this

edgroup = group ed3
{_x doMove getMarkerPos "flee1"} foreach units edgroup

F2k Sel addRating 5000

Thanks! That seems to work. Almost everyone dies in the crossfire but

1. The script doesn't terminate early (I get my hint) and

2. When ed3 was alive, the last I saw of him he was headed off towards "flee1" (I put a big red circle over his head to make him easy to see!

Anybody know anything about having AI aim a smoke grenade?

Thanks again!

RR

Share this post


Link to post
Share on other sites
Sign in to follow this  

×