Jump to content
Sign in to follow this  
junior_g

Script to repopulate an AI squad?

Recommended Posts

Back in the days of Arma I there was a mission I had that enabled you to repopulate a squad of AI when you lost a few AI guys. The way it worked was that you could go up to a guy in a "base" and select an option from the action menu to "repopulate" the squad.

Anybody know if there is a script like that for Arma II?

Share this post


Link to post
Share on other sites

So I was able to find the mission I was talking about, it is Arma GDCE.

After doing some research into its PBOs I found the basic idea behind the way it works.

I started to translate the stuff from .sqs format into .sqf format, since that is what Arma II uses.

I am still having problems with this though. It is the first actual scripting I'm doing, so maybe some of the more experienced guys out there can point out my mistakes.

I named the members of the squad I want to reinforce via the action menu item. TL1, TL2, TL3 are 3 of them.

I added the action called "reinforce" to an object and it shows up and I am pretty sure it calls the script correctly, because I tried calling it without putting the .sqf in the mission folder and it gave me an error about missing .sqf. It doesn't give me the error, however with the .sqf in the folder. I therefore figure the mistake is in the .sqf.

I assigned the player character the group name in the init field using

SQUAD=group this; squad setgroupid ["SQUAD"];

I created .sqf file called reinforce.sqf which contains the following

\\Reinforces Squad

_a = alive TL1;

if(!_a) then
{
   	deleteVehicle TL1;
createUnit [getMarkerPos "Base1", SQUAD, "", 1.0, "corporal"];
}
_b = alive TL2;

if(!_b) then
{
   	deleteVehicle TL2;
createUnit [getMarkerPos "Base1", SQUAD, "", 1.0, "corporal"];
}
_c = alive TL3;

if(!_c) then
{
   	deleteVehicle TL3; 
createUnit [getMarkerPos "Base1", SQUAD, "", 1.0, "corporal"];
}

My goal with the script is to be able to get a replacement for one of the team members (in this case TL1-3) if I loose one. I have gone through a bunch of scripting command descriptions and examples on the Arma 2 wiki and this is where I ended up.

I go into the game to try it out, kill one of the three, try the reinforce action and nothing happens.

Any help appreciated.

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
Sign in to follow this  

×