//initialise what bay and what type
sleep 5;
_reciever = _this select 0;
_deliverbay = _this select 1;
_acceptsType = _this select 2;
_baypos = getMarkerPos _deliverbay;
_bayx = _baypos select 0;
_bayy = _baypos select 1;
_bayz = _baypos select 2;
//check for delivery every 30s
while {true} do
{
player globalchat format["_acceptsType %1",_acceptsType];
player globalchat format["_deliverbay %1",_deliverbay];
player globalchat format["_baypos %1",_baypos];
player globalchat format["_bayx %1",_bayx];
player globalchat format["_bayy %1",_bayy];
player globalchat format["_bayz %1",_bayz];
//put all accepted objects within 5m of the bay in an array
_goodsInbound = nearestObjects[[_bayx, _bayy, _bayz], _acceptsType, 5];
//errorchecking hints
_total = count _goodsInbound;
_cntsmallInbound = "Fort_Crate_wood" countType _goodsInbound; //count number of items in array
_cntmediumInbound = "CargoCont_Net1_H" countType _goodsInbound;
_cntlargeInbound = "Land_Misc_Cargo1E_EP1" countType _goodsInbound;
player globalchat format["Small: %1 Med: %2 Large: %3, Total: %4, Dude: %5 Worth: %6 ", _cntsmallInbound, _cntmediumInbound, _cntlargeInbound, _total, _reciever, _inboundWorth ];
//ignore below until the list is working - work out worth of total delivered goods
//_inboundWorth = 0;
//_unitWorth = {_x getVariable _goodsWorth;} forEach _goodsInbound;
//{deleteVehicle _x;} forEach _goodsInbound;
sleep 30; //the 30seconds bit
};