Wow,
fast responders all over the place, huh? Well, thank you very much!
Regarding the scenario, it’s supposed to be like, a team of operators goes in, kills the enemy AA soldiers (who carry one Strela each), then takes the Strelas off of the bodies and blows them up right there and then. No carrying ‘em around or bringing ‘em back to base or such.
To avoid unnecessary stupidity, the whole thing should be a no-AI/humans only multiplayer scenario.
Would have been nice had it worked with weaponholders, but when there’s eventhandlers or other overly complex stuff involved, I’d rather put an ammocrate somewhere, so we can cram all Strelas in there and then blow them up. No trickery.
Ok! I’ll try this and then we’ll see.
Again, thank you, and have a nice day.
mr_book
Edit:
Ok, here's what goes and what doesn't:
Eventhandlers don't. Weaponholders don't. Ammocrates do.
It's a pity that the original plan didn't come together and I'm forced to use a crate, but, well, I can live with that.
So, here's the script for the crate ([crate] execvm "crate.sqf"):
_box = _this select 0;
_strela = false;
while {damage _box<1} do
{
_gwc = getweaponcargo _box;
_weapons = _gwc select 0;
_amounts = _gwc select 1;
_a = 0;
for "_z" from 1 to count _weapons do
{
_weapon = tolower (_weapons select _a);
_amount = _amounts select _a;
if (not _strela and _weapon=="strela" and _amount==3) exitwith
{
leader group player sidechat "Ok! Ready to blow. Clear the area!";
_strela = true;
};
if (_strela and _weapon=="strela" and _amount<3) exitwith
{
leader group player sidechat "Hold it! One Strela went missing.";
_strela = false;
};
_a = _a+1;
};
sleep 0.1;
};
if (damage _box==1 and _strela) exitwith
{
task_1 setTaskState "succeeded";
task_1_s = true;
publicvariable "task_1_s";
leader group player sidechat "That's done. Moving to next objective.";
};
if (damage _box==1 and not _strela) exitwith
{
task_1 setTaskState "failed";
task_1_f = true;
publicvariable "task_1_f";
leader group player sidechat "Whoops! We blew the box up without the Strelas. Fail!";
};
Works nice in the demo mission, and hopefully will in the real mission as well.
Thanks again everybody, and good night.
mr_book