Jump to content
Sign in to follow this  
avibird 1

Can you synchronize ingame first aide modules to AI recruiting units

Recommended Posts

Is it possible to synchronize the the ingame first aide: simulation,action and battlefield clearance modules to a point of reference for AI recruiting of units ie flagpole,barracks ect. Avibird

Share this post


Link to post
Share on other sites

Nobody has any input if this is possible to make this work within the game. Is this a dead end! Do I need to look towards a MOD's to add a first aide function to the AI that are recruited within the game world:confused:

Share this post


Link to post
Share on other sites

afaik, you can have several instances of FA modules in one mission at the same time.

but it doesnt seem that adding a unit to a editor placed FA module some time in a mission works.

however you can run a loop, like every 10 seconds or use pubvarEH and create a new set of FA modules, gather the synched objects to the original ones with synchronizedObjects and remove them from the old modules or just delete the old modules, and then add the gathered units (+ spawned units) to the new modules using synchronizeObjectsAdd

I imagine the steps would be something like this, untested.

_editorPlaced_modules = [fa1,fa2,fa3];  // name of editor placed modules.
_types = [];
{_types = _types + [(typeOf _x)]} foreach _editorPlaced_modules;  // gather the type to be used in recreation later on.

// global array wich we will monitor for changes, and when detected run the recreation.
new_units_to_synch = [];

while {true} do {
waitUntil {sleep 5; (count new_units_to_synch) != 0};  // wait until count is not 0 (units have been added), check every 5 seconds.
_typeNr = 0;
{
	_objects = synchronizedObjects _x;   // gather units synched.
	deleteVehicle _x;  // delete old module.
	_newModule = (_types select _typeNr) createVehicle [0,0,0];  // create new module.
	_newModule synchronizeObjectsAdd (_objects + new_units_to_synch);  // synch the new units and old units to new module.

	_editorPlaced_modules set [_typeNr, _newModule];  // change the old array to replace with new modules.
	_typeNr = _typeNr + 1;  // increase the type count for next module creation in line.
} foreach _editorPlaced_modules;
new_units_to_synch = [];  // clean the array, ready for next. use pubvar maybe.
};

ofc there could also be just a simple command to add units to already existing FA modules, though i didnt look for that, the FA module thread here on BI forums might have the answer most likely..

edit: maybe only newly created units can be synched to already existing FA modules.

so it will perhaps work on newly created unitrs if added imediatley after spawning.

Edited by Demonized

Share this post


Link to post
Share on other sites

AFAIK BIS modules mostly just uses synchronization during initialising so synchronizing later won't do anything. You will need to look inside the module and how it works to determine what to do. Even then, depending on how the module is scripted, it might no be possible - at least now without creating a modified version of the module.

Share this post


Link to post
Share on other sites

Demonized I was trying to use this with your code you helped me with for AI recruiting. No luck only works with AI units that are placed down in the editor.

BY the way your code works great! I have multiple recruiting points for different units at different bases around the map. Did you ever get time to look at recruiting vehicles with this code? Avibird.

Edited by AVIBIRD 1

Share this post


Link to post
Share on other sites
I have multiple recruiting points for different units at different bases around the map. Did you ever get time to look at recruiting vehicles with this code? Avibird.

ill look into that now, should be doable.

Share this post


Link to post
Share on other sites

it might be that the med modules run only once (when they are created, whatever units are synchronized to them are added at this time only) so, if you want the ai that are spawned in to have the med modules synchronized to them - you have to spawn new med modules and synchronize them to these units, so create a new set of modules and synchronize them to a group, and do this for each group.

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  

×