Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

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

0 Members and 1 Guest are viewing this topic.

Offline mr_book.PXS.Pvt

  • Members
  • *
Hi,
this is the situation: I want to eliminate an AA threat in the form of some soldiers carrying Strelas. These guys don’t necessarily have to be killed, it’s enough if they are stripped off of their weapons and those weapons are destroyed.
And here comes the problem: can a weapon be destroyed? As far as I understand the engine, a “weaponholder” is created for each weapon that is put on the ground. Unfortunately, that weaponholder seems to be indestructible.
Here’s what I tried:
I created a weaponholder: wh=“weaponholder” createvehicle (getpos this); wh addweaponcargo [“strela”, 1].
Then I created a trigger, Radio Alpha, on activation: wh=nearestobject [player, “weaponholder”]; hint format [“%1”, damage wh].
Then I started the preview, manually planted a satchel charge right next to the Strela and blew it off. But, when calling Radio Alpha, the result is: 0. No damage at all! And the Strela can still be picked up, so it really didn’t take any damage.
Now what? Maybe cheating will help? Something like: wh addeventhandler ["firednear", …], so when a satchel goes off near the Strela pile, the whole thing is wh setdamage 1 or deletevehicle wh or whatever. But, honestly, all of that doesn’t sound too good to me.
Any ideas?
Thanks for your time.
mr_book
« 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 »
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"):
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 »