Results 1 to 8 of 8

Thread: Expert advice needed on how to Detect weapon only if in hand

  1. #1

    Expert advice needed on how to Detect weapon only if in hand

    Anyone know how to detect weapon in group if they have in hand? So group will be set captive true as long as they have weapon on back but will be set to false as soon as they have it in hand.
    I have found a similar one with fire eventhandler but not the same.

    Any help would be highly appreciated.
    Captain Bravo
    One of the serious problems in planning the fight against American doctrine, is that the Americans do not read their manuals, nor do they feel any obligation to follow their doctrine"
    From a Russian General's Notebook

    Join Bravo Company
    A highly trained unit run by an ex cook, a hooker and an old pensioner, so expect the best!
    http://forums.bistudio.com/showthread.php?t=80906

  2. #2
    Warrant Officer Demonized's Avatar
    Join Date
    Nov 16 2010
    Location
    Back from afk 2013
    Posts
    2,614
    if you use a weapon on back script, why not just remove all the weapons and readd them when they "take the weapons from the back".
    then you can check for if count weapons unit == 0 then setcaptive true.
    My scripts:
    Spoiler:

    what to do when posting any kind of code dammit!!

    Any new mission editor or scripter in Arma2 should have read Mr Murrays Editing Guide Deluxe at least once, it still applies for A2 even though it was made for Armed Assault.

  3. #3
    Master Sergeant CaptainBravo's Avatar
    Join Date
    Nov 24 2005
    Location
    USA-UK
    Posts
    730
    Author of the Thread
    Quote Originally Posted by Demonized View Post
    if you use a weapon on back script, why not just remove all the weapons and readd them when they "take the weapons from the back".
    then you can check for if count weapons unit == 0 then setcaptive true.
    Thanks Demonized. I am not using any script as group will be human players who will put weapon on back (via inventory) before entering town. So I am not sure how to script weapon on back script.

  4. #4
    Master Sergeant CaptainBravo's Avatar
    Join Date
    Nov 24 2005
    Location
    USA-UK
    Posts
    730
    Author of the Thread
    Hmm I guess it is tougher than I thought. Anything similar for work around?

  5. #5
    Why not just check their currentMuzzle? That'll tell you the weapon, or weapon mode, they are on or whatever item (bionc, grenade, whatever) they have active. Unarmed will respond with an empty string.

    Or maybe check what animation state they are in, if it's a Rfl one they have a rifle? Not sure how reliable or whatever that is though, but currentWeapon/currentMuzzle should work.
    Last edited by kylania; Feb 16 2012 at 18:37.

  6. #6
    Master Sergeant CaptainBravo's Avatar
    Join Date
    Nov 24 2005
    Location
    USA-UK
    Posts
    730
    Author of the Thread
    Quote Originally Posted by kylania View Post
    Why not just check their currentMuzzle? That'll tell you the weapon, or weapon mode, they are on or whatever item (bionc, grenade, whatever) they have active. Unarmed will respond with an empty string.

    Or maybe check what animation state they are in, if it's a Rfl one they have a rifle? Not sure how reliable or whatever that is though, but currentWeapon/currentMuzzle should work.
    I think both could be a good option. Although I am not sure hoq as I am not a scripter by any imagination

  7. #7
    Put this in an sqf and run it before you need to start detecting:
    PHP Code:

    if (isDedicatedexitWith {};

    _unit _this select 0;

    while {
    currentWeapon _unit == "Throw"} do
    {
        
    sleep 1;
    };

    hint "watch out lads.  He's pulled a shooter";
    _unit setCaptive false
    You could run it with something like:

    0 = [unit1,unit2] execVM "nameofscript.sqf";

    Def works for SP, but untested for MP (should be okay though)
    Hackintosh Windows 7/Mountain Lion. Intel i7-920 @3.8 Ghz.
    Gigabyte GA-EX58-UD5 Rev1. Palit GTX 680 4GB.
    6Gb DDR3 RAM. Corsair 650W PSU.

  8. #8
    Master Sergeant CaptainBravo's Avatar
    Join Date
    Nov 24 2005
    Location
    USA-UK
    Posts
    730
    Author of the Thread
    Quote Originally Posted by Das Attorney View Post
    Put this in an sqf and run it before you need to start detecting:
    PHP Code:

    if (isDedicatedexitWith {};

    _unit _this select 0;

    while {
    currentWeapon _unit == "Throw"} do
    {
        
    sleep 1;
    };

    hint "watch out lads.  He's pulled a shooter";
    _unit setCaptive false
    You could run it with something like:

    0 = [unit1,unit2] execVM "nameofscript.sqf";

    Def works for SP, but untested for MP (should be okay though)
    Thanks Das Attorney for the script. After testing it seems to only work if you go into area with weapons in hand. You will be detected and fired upon. HOwever, if you go with weapon on back then switch to wepon in hand, the script will not detect you. How do you get the other side to detect you as soon as you get your weapon in hand?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •