Home   Help Search Login Register  

Author Topic: Killing people is easy, but how to kill a weapon? (SOLVED)  (Read 2959 times)

0 Members and 1 Guest are viewing this topic.

Offline mr_book.PXS.Pvt

  • Members
  • *
« Last Edit: 01 Sep 2011, 22:00:49 by mr_book.PXS.Pvt »

Offline robertoHrvat

  • Members
  • *
    • Area 51 modification
Re: Killing people is easy, but how to kill a weapon?
« Reply #1 on: 30 Aug 2011, 11:55:28 »
There is command "RemoveAllWeapons NameOfSoldier" I dont know if works in arma2, if not here must be a somthing like for deleting weapon. So when SC going off soldier die and weapon is crashed (deleted-destroyed).
RobertoHrvat

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Killing people is easy, but how to kill a weapon?
« Reply #2 on: 30 Aug 2011, 12:38:16 »
@mr_book.PXS.Pvt:
Weapons aren't objects like other objects in the game so you can't really do anything to them.

Weaponholder is basically a invisible ammobox so it might accept eventhandlers, you just have to test the firedNear thing..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Killing people is easy, but how to kill a weapon?
« Reply #3 on: 30 Aug 2011, 12:45:32 »
Hm! Complex.

Can be made easier though. A gamey workaround is to place all of the weapons into an ammo crate, and then blow that one up, since that you can do no problems. I wouldn't recommend going into any firednears or whatever, that might be terribly complex - especially as it's a little uncertain as to how exactly the weaponholders that are created when an AI places a weapon on the ground work (as opposed to the ones you create yourself).

It all depends on the scenario, really. Is the AI carrying the launchers, and you're forcing them to drop them and then destroying them? Or are you sneaking in and destroying them before they're even picked up? The second one is pretty easy: just make sure the launchers are inside an ammo crate instead of laying about, and boom. The first one you could solve for instance by having a super-short blackout, during which the player "disables" all the launchers one way or another (just removemagazine the launcher ammo, for instance) - or heck, even do it as an action attached to each AI that just removes their magazine. If you can do it with dropped weaponholders too, go right ahead.

Since yes, destroying weaponholders doesn't seem to actually work :) Thus -> workaround time!

Depends on the scenario, as mentioned.

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline mr_book.PXS.Pvt

  • Members
  • *
Re: Killing people is easy, but how to kill a weapon?
« Reply #4 on: 30 Aug 2011, 15:05:28 »
Code: [Select]
_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
« Last Edit: 01 Sep 2011, 22:01:05 by mr_book.PXS.Pvt »