Jump to content
Sign in to follow this  
Coldfire

AI respawn and load into player chopper.

Recommended Posts

Alrighty I've looked around and I can't seem to find an answer to this specific scenario:

Awhile back I found a script with a demo mission that would cause an AI group to respawn after the entire group was killed, then follow through with the waypoints they were given from the start. Unfortunately I A) can't find the the script again, and B) I seem to recall it working based on markers instead of waypoints. (Though I'm not 100% sure on that)

The reason I ask is I have a mission I'm trying to make for me and a few friends to play, based around flying in wave after wave of troops into a hot LZ. The players would be flying the choppers, the AI controlling the troops on the ground. You see where using markers here could be a problem, as all the ways I know to get AI into a chopper are based on waypoints being used by both. I suppose it'd be possible with triggers and scripts but that is WAY over my head on how to accomplish.

The question I ask is this: Is it possible to have a AI infantry group respawn when they are all dead, then wait at the spawn area for a chopper to come pick them up?

Sorry if this has been posted before but my search through this forum, as well as my Google-fu, has failed to turn up any answers.

Share this post


Link to post
Share on other sites

edit: changed it - made it simpler - if you have a helicopter flying in a wide circle over the spawn point it will pick up and drop off a new team everytime all the units in the group die.

example mission, shoot all the units dropped off from the heli and more will get inserted into the LZ (heli is set to 'allowDammage false' - might need to spawn a new heli everytime for this to look realistic:

https://dl.dropbox.com/u/37698503/RespawnCycle.Takistan.zip

respwn.sqf

//you need a functions module on the map; infantry leaders init:
//nul = [group this,heliName] execVM "respwn.sqf";

private ["_grpRspwn","_ldr","_grp","_cab"];
waitUntil {!isNil "bis_fnc_init"};
_grp = _this select 0;
 _cab = _this select 1;

waitUntil {count units _grp  == 0};

_grpRspwn = [getMarkerPos "spwPos", WEST, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >>"Infantry" >>"US_DeltaForceTeam")] call BIS_fnc_spawnGroup;
   {_x setskill 0.5} forEach units _grpRspwn;
            _ldr = leader _grpRspwn;

waitUntil {(_ldr distance _cab) <=200};//named heli will have to fly within 200m of the group waiting at the spawn position for this type of getin to work.
{_x assignAsCargo _cab; [_x] orderGetIn true;} forEach units _grpRspwn;
[group _ldr, heli1] execVM "respwn.sqf";

heli1 waypoint init where you want the reinforcements dropped off:

{unassignVehicle _x; [_x] orderGetIn false;} foreach assignedCargo (vehicle this);

Edited by Mattar_Tharkari
code errors

Share this post


Link to post
Share on other sites

Ok... tried that and I can't seem to puzzle out what goes where. I should have mentioned that advanced editing is fairly new to me and I have to rely a LOT on guides and wizards to puzzle out what set of code belongs where and how it relates to each other.

As far as I can guess, what is supposed to happen there is a script will run to set up the respawns and such, and a in-game initialization is supposed to kick them out of the chopper? If that is the case, the script does not seem to register once I've added it to the mission file, and a fair bit of the code does not seem to be recognized by the game.

I'm sorry to seem so noobish here, but would it be too much if I asked for a bit of explanation? I'm not exactly an expert code monkey here a lot of this doesn't make sense to me without context.

*EDIT* I figured out a couple of the problems of my own (relized belatedly it wanted a .sqf file, not a .sqs), but the script still doesn't seem to work.

Edited by Coldfire

Share this post


Link to post
Share on other sites

Updated it and included example mission - if you really want them picked up and dropped off - this is a very simple way of doing it - heli will circle until new group is spawned.

Don't add any of this to the mission.sqm !!!!

Share this post


Link to post
Share on other sites
Updated it and included example mission - if you really want them picked up and dropped off - this is a very simple way of doing it - heli will circle until new group is spawned.

Don't add any of this to the mission.sqm !!!!

Yup that works. Still working out the details on how I'll use it but you've been a huge help, thanks!

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  

×