What if you want the crate to be deleted when no player is near? I copied Horner's script and added a little to it but cant work out how to add the code that will delete the crate if no player within 500m.
My aim is to have a heli pilot whose role is to transport or resupply troops with sling loaded crates but without having 50 crates spawned during a mission (e.g. - Invade and Annex).
init of crate:
null = [this] execVM "crateRespawn.sqf"; ["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;
crateRespawn.sqf
private ["_crate","_type","_pos","_newCrate"];
_crate = _this select 0;
_type = typeOf _crate;
_pos = getPos _crate;
waituntil {
sleep 1;
(!Alive _crate) || (_crate distance _pos > 1000);
};
_newCrate = _type createVehicle _pos;
[_newCrate] execVM "crateRespawn.sqf", ["AmmoboxInit",[_newCrate,true]] call BIS_fnc_arsenal;
};
I don't think this would work in MP aswell. Im still learning
Edit: Sorry about the Arma 3 question in a Arma 2 thread