cheers mate.
i have looked at kronzy's UPS script. that's one damn great script. taking inspiration for it I am experimenting with using global variables in the main script.
one thing i cant figure out is how to use arrays as an index of information. another beginners mistake probably. how in an array like [X,4,2,Y] do i check the Y value of array index X=2; sorry for the layman way of trying to explain it.
below is the code i am experimenting with (it is incomplete). forgive the loose structure. i am just trying to get my head around how to get the two way communication going.
main.swf is // command centre AI. a vehicle on ground acts as a command hq. it orhcestrates group interaction, sends reinforcements, provides support. if it is destroyed it will respawn in a few minutes leaving its team under great disadvantage.
// initial proof of concept. 1 script thats on a vehicle. 1 script that runs on 2 squads of ai.
// the 2 squads are added to a array on the vehicle.
// when ai detect enemy they report in to vehicle. vehicle sends other ai to detecting ai position.
if !(isserver) exitwith {};
TWI_totalgroups = 0; //number of groups
TWI_reportin = [0,0,0,0,0,0]; // group array index, x,z,enemyx,enemyz,need help?
private ["_hq","_totalgroups","_groupinfo","_enemyspotted","_waypoints","_loop","_cycle"];
_hq = this select 0;
_totalgroups = 0;
_groupinfo = [0,0,0,1]; // group index. x,a,strength. redundant right now.
_enemyspotted = [0,0,0]; //enemy index, x,z coords. later will add other details. redundant
_waypoints = [];
_loop = true;
// place squads into arrays.
while {_loop == true} do
{
sleep 1;
if (TWI_totalgroups > _totalgroups) then {_totalunits = TWI_totalgroups};
// cycle through squads every 10 seconds to see if they are in emergency.
sleep 10;
for [{_cycle =0}, {_cycle <= _totalunits} , {_cycle=_cycle+1}] do
{ private ["_arrayindex","_needhelp"];
_arrayindex = TWI_reportin select 0;
_needhelp = // need a way to reference select 5 of arraindex?
};
};
each groupai.sqf script updates TWI_totalgroups by one when first run.
plus each groupai.sqf being under fire/spotting enemy updates TWI_reporting accordingly.
it probably is a very clumsy attempt at a solution but it is a beginning that might just work.