
Originally Posted by
Gilson
I've come to a complete loss; I have little to no scripting experience in any medium, however myself and a couple of people have managed to mangle this together:
One or two bad things there - you can't wait in a vehicle init.
I have tested this - seems to work perfectly:
Unit init:
Code:
removeAllWeapons this; this setCaptive true; nul = [this] execVM "WeaponCaptive.sqf";
Code:
private ["_unit"];
_unit = _this select 0;
while {true} do {
if (primaryWeapon _unit != "") then {
_unit setCaptive false;
} else {
_unit setCaptive true;
};
sleep 1;
};
for testing:
Add a weapon to a unit with a radio trigger:
Code:
{unitName addMagazine "30Rnd_556x45_Stanag"} forEach [1,2,3]; unitName addWeapon "M4A1";
Place a weapon on the ground that you can pick up then drop (put this in the init of a traffic cone) you can also make a unit pick up this with the 6 key menu:
Code:
wpnhld1 = "WeaponHolder" createVehicle (position player); wpnhld1 addWeaponCargoGlobal ["M4A1",1]; wpnhld1 addMagazineCargoGlobal ["30Rnd_556x45_Stanag",5];