OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Cheetah on 25 Sep 2007, 20:16:55

Title: Holster script (ACCEPTED)
Post by: Cheetah on 25 Sep 2007, 20:16:55
General information

Looking for a method to enable the player to conceal weapons? Look no further, with this method - consisting of three script files, you will be able to do just that!

Check the readme and demo mission for more information.

Update: version 1.01 released!

Update: version 1.02 released!

Update: version 1.03 released!
Title: Re: Holster script
Post by: Spooner on 25 Sep 2007, 22:03:51
I'm glad you didn't allow AK-74 swallowing with this script, since you limited it to hiding pistols. Hmm, though it would have been fun to create a spray of vomit particles ;P

Instead of having an array of pistol classes, check that the weapon inherits from PistolCore, using the method I explained in another thread (http://www.ofpec.com/forum/index.php?topic=30301.msg207726#msg207726). This will allow the script to holster any pistol from any addon.
Title: Re: Holster script
Post by: johnnyboy on 26 Sep 2007, 06:11:12
Hi Cheetah.  Cool script.  This will be useful.

I think I solved the issue of having to select the weapon again before you can fire, by adding SelectWeapon command to this line of code:

Code: [Select]
if ((isHolster select 2) != 0) then { _unit addWeapon _saveWeapon; _unit selectWeapon _saveWeapon; };

Try it out.
Title: Re: Holster script
Post by: Cheetah on 26 Sep 2007, 08:51:33
Hey johnnyboy, sounds good!

Going to start rescripting it now to prevent the use of multiple scriptfiles. Should make it even easier to use  ::)
Title: Re: Holster script
Post by: Cheetah on 27 Sep 2007, 00:32:01
Alright, new version attached.

Only one file required to make it work now. Other info is in the readme.

@Spooner,

Next up: checking if the config file can be used to get pistol classes.

EDIT: can't find a way to use the config file.. so it is ready for release.
Title: Re: Holster script (ACCEPTED)
Post by: Spooner on 28 Sep 2007, 22:36:39
Couldn't make it easier than this - just use something like:
Code: [Select]
_gun = "M9";
if ([_gun] call isPistol) then...

This is the function:
Code: [Select]
isPistol =
{
_unknownWeaponClass = _this select 0;

_unknownConfig = configFile >> "CfgWeapons" >> _unknownWeaponClass;
_pistolConfig = configFile >> "CfgWeapons" >> "PistolCore";

_isPistol = false;
while {isClass _unknownConfig} do
{
    if (_unknownConfig == _pistolConfig) exitWith
    {
        _isPistol = true;
    };

    _unknownConfig = inheritsFrom _unknownConfig;
};

_isPistol; // Return.
};
Title: Re: Holster script (ACCEPTED)
Post by: Cheetah on 28 Sep 2007, 23:50:52
Updated to v1.02

Fixed a bug and added the config file pistol check (thanks Spooner!) - see readme, download in first post.
Title: Re: Holster script (ACCEPTED)
Post by: Mandoble on 28 Sep 2007, 23:59:32
ED updated with new version  ;)
Title: Re: Holster script (ACCEPTED)
Post by: Cheetah on 04 Oct 2007, 19:07:42
Updated to 1.03.

Improved demo mission and added info to the readme and script header.
Title: Re: Holster script (ACCEPTED)
Post by: Blanco on 06 Oct 2007, 13:39:17
Nice script but in some situations there's a little problem. (that can be solved with a timer or so)
Unholster the weapon, kill one soldier, holster the weapon before the second soldeir can see you and you will be captive again.

Anyway, nice script  :)
Title: Re: Holster script (ACCEPTED)
Post by: Cheetah on 07 Oct 2007, 22:29:54
Ahh well, that has more to do with a simple 'show-how-to-implement-it' ;).

There are a lot more and better ways to do it, as you say you can cheat now.
Title: Re: Holster script (ACCEPTED)
Post by: axle900 on 23 Jul 2009, 03:47:43
can some one tell me where to place this so my units can holster their sidearm splease help
Title: Re: Holster script (ACCEPTED)
Post by: Dazakiwi on 13 Dec 2009, 03:21:13
The download link is down, will this script work in Arma2? will it ported to A2?