Advertisement

Author Topic: SPON Attachments v0.3.0 (ACCEPTED)  (Read 9932 times)

0 Members and 1 Guest are viewing this topic.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
SPON Attachments v0.3.0 (ACCEPTED)
« on: 14 Nov 2007, 17:53:21 »
SPON Attachments v0.3.0
- Released: 2007-11-17
- Install size: 32k + SPON Core (Core v0.1.2 used in demo)
- 100% scripts
- No addon dependencies
- See attached README.html for full details

Attach and detatch ACOG, M203, Aimpoint, GP-25 and/or suppressors (silencers) on your weapons in-game.

Note that the effect of this script has some overlap with CSL Weapon Switching, but has significant differences that make it worth developing both scripts (his is intended to allow you to carry two primary weapons, but this allows you put any of your weapons into multiple configurations).

Requires that the SPON Core scripts package be installed in the mission (v0.1.2 or higher). Both SPON Attachments and SPON Core are script-based and do not require any addons to be installed on client or server.

Features
    * Allows some weapons to be modified by players in the field. The options available in vanilla ArmA are:
          o ACOG sights (M16A4 M203 ACOG/M16A4 ACOG).
          o Suppressor (silencer) (AKS47-UN/Makarov SD/M9 SD).
          o M203 grenade launcher (M16A2 M203/M16A4 M203 ACOG/M16A4 M203).
          o Both ACOG and M203 (M4 M203 (includes ACOG)/M4A1 M203 ACOG/M16A4 M203 ACOG).
          o GP-25 grenade launcher (AK-74 GP-25).
          o Aimpoint sights (M4 Aimpoint).
          o Both suppressor and Aimpoint (M4A1 QDS CompM4).

    * Records which weapon accessories you have removed, allowing reattachment to the same (or similar) weapon in the future.
    * Due to the fact that the mission-maker configures exactly which weapons can have accessories attached or removed:
          o New weapons from addons can easily be incorporated into this script.
          o Which vanilla ArmA weapons are modificable can be limited, both to prevent modification and to reduce workload (if the weapons aren't available in the mission).
          o There is nothing to stop you defining other types of attachable weapon accessories if you need them.

    * You can script to give player loose attachments or place them "in" non-soldier objects (picked up via action menu).
    * If the player dies (MP) or anyone dies (SP) with loose accessories that aren't on a weapon, then the player (not other players in MP) can pick them up from the corpse.
    * To allow for non-reversable attachment, the mission-designer can define whether an attachment can be detatched once attached. I don't think this is meaningful for vanilla ArmA weapons, but could be useful if using this script with addons in order to to implement field-repairs, e.g. "Attach M240 firing pin to Broken M240", which would leave you with an M240 that couldn't be broken again by the player detatching the "M240 firing pin" again.
    * Although the removal of ACOG wouldn't normally take place in the field, it is implemented since real soldiers are able to use the top edge of the ACOG as an ironsight. Since dual-action ACOGs (that offer magnification or ironsights modes on the same weapon) are available in addons, there is no reason to use this script for this purpose (detatchable ACOGs) unless you specifically wish to avoid using those addons.

Compatibility
    * SP: Yes.
    * SP Teamswitch: Yes.
    * MP: Yes, but there are limitations, below.
    * MP JIP: Yes if AI disabled, but partial if AI enabled (if you re-connect to a soldier who previously had loose attachments, they will have disappeared).

Limitations
    * When removing the ACOG from the M4 M203 (includes ACOG) or M4A1 M203 ACOG, one is left with the plain M4 or M4A1 respectively (without ACOG or M203). This is because there is no M4 or M4A1s with M203s that don't have ACOG weapon in vanilla ArmA.
    * When removing the suppressor from the M4A1 QDS CompM2, one is left with the plain M4A1 (without suppressor or aimpoint). This is because there is no non-suppressed M4A1 Aimpoint weapon in vanilla ArmA.
    * Weapons are reloaded and returned to semi-automatic fire mode, or whatever their default firing mode is, during the process of attaching or detatching accessories.
    * Can't attach/detatch in vehicles (Definitely more effort to implement this than it is worth).
    * You can't tell what attachments you are currently carrying, unless you have a weapon that could have that attachment (and then you still can't determine how many you have).
    * AI can't attach or detatch accessories (or carry them, unless they have been teamswitched to in the past).
    * MP: All accessories that are not on a weapon when a player dies are only retrievable by that player (if he respawns, of course).
    * MP: Can't transfer loose accessories between players.

Known Bugs
    * None

Design Aims
    * Allow the player to make battlefield modifications to weapons.
    * Make up for the fact that in vanilla ArmA, one cannot aim along the top of the ACOG sights, so when using weapons with ACOG one is severely disadvantaged in CQB.

Credits
    * Uses my SPON_getWeaponType and SPON_deepEquals functions, which is included in the package.
    * Testing and useful suggestions by Wolfrug.
    * Significant testing and feedback by members of the Regiment of Grenadier Guards [RGG] squad (http://www.rggsquad.co.uk). Thanks fellas!

Change Log
v0.3.0
- Added
    * Each attachment can be defined as detatchable or non-detatchable. One can always attach them though.
    * Added a second playable soldier in the demo to test team-switching.
    * Lose accessories are now retrievable from corpses (on the local machine).
    * Rather than using addAction directly, the mission-designer can use the addAction.sqf (or SPON_addAction function) to add "Take accessory" actions to non-soldier objects.

- Removed
    * No longer needed Mando getPos or Mando myWeapon.

- Fixed
    * Detatching, re-attaching and then detatching an accessory prevents the correct attachment action being shown for that weapon again.
    * Not compatible with Teamswitch in SP.
    * Sometimes you can fire a weapon other than the one you are holding after attaching or detatching an accessory.
    * Sometimes after you have attached or detatched an accessory, you cannot fire it until you press 'F' to choose a firing mode.

v0.2.0
- Added
    * Gave a lot more attachment options in the demo mission (including M203s, GP-25s and Aimpoints).
    * addAttachment.sqf and takeAttachmentAction.sqf added to allow players to get loose attachments without having to remove them from weapons.

- Modified
    * Previously, if you removed the Aimpoint and M4 suppressor from an M4A1 QDS CompM4, then you couldn't then attach just the the Aimpoint to an M4 (you were considered to have a compound accessory, rather than two separate accessories). Now each accessory is considered entirely separately (the M203/ACOG was the other compound accessory in the original version).

- Removed
    * You no longer always use the modified weapon after you attach/detatch an accessory

- Fixed
    * If there are more than one possible attachments/detatchments for a weapon, then only one of them is shown in an action.
    * If you take off more than one attachment of the same type, then you only have one available to reattach.
    * The weapon class-names in the config are case-dependent.
    * Sometimes it is possible to fire a weapon that is still holstered/slung.

v0.1.0
- First release.

Get SPON Attachments
« Last Edit: 12 Dec 2008, 12:24:38 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline [seven]

  • Members
  • *
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #1 on: 14 Nov 2007, 22:58:19 »
Haven't got around to trying this yet but let me get this straight, it allows the player to use an action to make an "adjustment" to his weapon in game, but that adjustment is really just swapping out one weapon for another.  Essentially the same concept armament.sqf uses, but rather than rearm vehicles it rearms soldiers, correct?

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #2 on: 14 Nov 2007, 23:07:09 »
Yes, it is implemented by replacing weapons, but if the player doesn't know this (or doesn't mind suspending disbelief ;P), it should feel like you are attaching or detaching the accessories.

The big difference to your plane rearmament script is that it remembers which accessories you have removed so you can use them again later. Thus, if you have an M16A4 ACOG and remove the ACOG, then you could put the ACOG back on that M16A4 or you could hold onto it and go and attach the ACOG on an M16A4 M203 to make an M16A4 M203 ACOG. The other effect of this is that if you are given just a plain M16A4 at the start, you won't be able to put an ACOG on it (because you don't have one).
« Last Edit: 14 Nov 2007, 23:13:41 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline michallll

  • Members
  • *
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #3 on: 14 Nov 2007, 23:40:18 »
* When removing the suppressor from the M4A1 QDS CompM2, one is left with the plain M4A1 (without suppressor or aimpoint). This is because there is no non-suppressed M4A1 Aimpoint weapon in vanilla ArmA.

O really  :whistle:?  Hmm I have an M4 Aimpoint and I have Mrs. Vanilla....

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #4 on: 14 Nov 2007, 23:44:46 »
Nope, we have an M4 Aimpoint, not an M4A1 Aimpoint (I was fooled for a while there too!)! I really didn't want to totally change the fire modes by removing the silencer! Still, if you are happy with that switch, the configuration is easy to change (look at the README.html for details).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #5 on: 14 Nov 2007, 23:49:51 »
Cool stuff! Some minor niggles:

1) If you use the "detach/attach" action on your rifle while you've got your pistol selected, it'll select your rifle at the end of the animation, but won't unsling it, leading to the infamous "shoot rifle with the power of thought from your back" phenomenon. ;) The other way around it works fine (pulls out pistol -> animation -> pistol selected).

2) Can't have more than one attachment on hand at any time? I.e., if you remove the silencer (+ aimpoint, why? -> shouldn't it be "M4AIM" as the base class?) from the QDS/CompM4, and then drop the empty M4, pick up a grenadelauncher/ACOG combo, and remove those....then the silencer disappears forever. If it's not -too- much trouble, would it be possible to script in two "inventory slots" for attachments? Since many weapons have at least two (i.e., scope + grenade launcher, silencer + scope etc). Three would be ideal (silencer + scope + grenade launcher). :D

But I get the point with the script: the init.sqf is very enlightening. Wonderfully modular! :-D I am definately going to cook together a wee mission with this script and some addon, methinks...

Good work!

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

Offline michallll

  • Members
  • *
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #6 on: 14 Nov 2007, 23:55:37 »
As far as I know there is no M4A1 unless I am drugged of course :cool2:

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #7 on: 15 Nov 2007, 00:00:14 »
You are quite right about the animations; they suck, both because of BIS and because I didn't labour over them as much as I should have! I think the next version will only allow you to modify the weapon in-hand (thanks [seven] for making that obvious suggestion ;P), which will alleviate some of the issues.

You can actually hold as many detatched attachments (including multiple of the same type) at once as you want and move them about between weapons as much as you like. Attachments only ever get deleted when you die. In your example, the silencer hasn't disappeared, but you only have the option to use the M203/ACOG until you have none of those left. Something I should fix properly in a later version, so you get options to add all possible attachments if you have more than one that could go on the weapon. One related issue is that you can't ever see what attachments you are carrying, but I can't decide if it is worth making one (when most of the time you'll just be toggling the weapon you started with).

On the other hand, I'm loathe to keep things more separate than they are at the moment though (i.e. removing the M203/ACOG and making separate M203 and ACOG "attachments")  since there are limited numbers of options for actually putting the attachments back on weapons.

@michalllllllllllllllllllllllllllllll
Believe me, there is an ironsights M4A1 as well as the M4A1 QDS CompM2 (suppressed/Aimpoint) one. Look at the COMREF or try the demo.
« Last Edit: 15 Nov 2007, 00:40:01 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #8 on: 15 Nov 2007, 09:05:43 »
Well, if I'm understanding the incredibly simple init-system correctly, to get the second request of mine (more modularity, in removing grenade launchers/silencers/scopes separately), all you need to do is

Quote
Something I should fix properly in a later version, so you get options to add all possible attachments if you have more than one that could go on the weapon.

Since then you'd just have to make a bunch of more entries. As an example in a hypothetical situation where we have an M4A1 Aimpoint that can have a silencer attached, as well as a silenced M4A1 without an aimpoint:


Code: [Select]
["M4A1", "M4AIM", "CompM4"],
["M4AIM", "M4A1AIMSD", "QDS"],
["M4A1", "M4A1SD", "QDS"],
["M4A1SD", "M4A1AIMSD", "CompM4"]

That way, when you have the base, empty-classed M4A1, you could pick either the silencer or the Aimpoint to attach, and then when you have the silenced or aimpointed M4A1, you could pick to attach either the silencer or the aimpoint (depending on which you already have attached ^^)

In short, yep. Add functionality to choose which attachment you want to add, and fix the animation issue if possible, and this script suite is teh groove!  :good:

Wolfrug out.


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

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #9 on: 15 Nov 2007, 11:48:32 »
Yep, that config would work up to a point, though there is no such thing as the M4A1AIMSD (The M4A1 has plain iron-sights and the M4A1SD is suppressed with an Aimpoint; BIS are generally very inconsistent with their class naming schemes). The issue is that changing M4A1s to and from M4s is a bit nasty. You could use the same sort of idea to avoid having to remove the M203 and ACOG at the same time from the grenadier weapons (M4GL and M16A4_ACG_GL) too, though you'd probably end up swapping between M16A2s and M16A4s to make that possible (yak!).

I won't be changing the example config used in the demo mission, since I have been careful to only allow changes which affect the weapon accessories rather than the weapons themselves. If people want to alter the config, then that is up to them (it really is easy to do and I'm glad that Wolfrug can see the benefits of this design ;D), though unless you are using addons that offer the "missing link" weapon configurations, this will be a little kludgy for your players. Hell, if you felt the urge, you could even configure it to allow "Attach Plutonium to M9 to make Laser Derringer" (or the almost sensible, "Attach new firing-pin to Broken M16 to make M16"), but I'll leave that up to mission developers ;P

I'll add a script to allow mission developers to give attachments to the player without the player having to remove them from a weapon, so you could do this in the init (which would make someone with a base M4 very happy!):
Code: [Select]
[this, ["M203/ACOG", "Aimpoint"]] execVM "SPON\Attachments\addAttachments.sqf"

This also paves the way to me adding attachments to my shop (SPON Money).
« Last Edit: 15 Nov 2007, 11:52:11 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #10 on: 16 Nov 2007, 19:41:45 »
Update: v0.2.0 (see original post for changelog).

Well, in spite of what I said earlier, I split up the "compound" accessories so that they can be used separately. I also fixed the problem with having more than one of the same accessory type that I claimed worked to Wolfrug a few posts ago (oops, sorry!).

I wasn't able to limit the available actions to just the current weapon because Mando_myWeapon doesn't work perfectly (I blame BIS for not having a currentWeapon command! gah!). Anyway, it is better to show everything rather than sometimes only show the options for the non-current weapon. The animations should work better because I'm no longer using selectWeapon, but that meansyou will end up with the same weapon equipped that you started with (even if that wasn't the one you were modifying).

I'm wondering if, instead of the way it is done now, I shouldn't just have a permanent "Modify weapons" action that opens a dialog with all the weapons, accessories and options in it. A lot of work, though, just to save a couple of actions in a limited number of situations. I don't plan to change it this way in the near future though, so don't hold your breath ;P

Overall, thanks for all the comments and suggestions. They helped me get clear in my mind what I wanted/needed to do with this script (should be complete now, baring bug-fixes or MP improvements).
« Last Edit: 16 Nov 2007, 20:15:31 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #11 on: 16 Nov 2007, 23:13:02 »
EDIT: Oops! I managed to break it again.  :whistle: A couple of things: 1) if you have no pistol in your inventory, you will be locked in the "crouched with pistol" anim until you stand up (upon which the avatar will unsling his rifle). 2) There seems to be some odd behaviour with retaining the attachments.  :confused: Basically, if you deattach, reattach and then deattach again (a couple of times) a single attachment, it'll disappear from your action menu. Don't know if this is the attachment actually -disappearing-, or just a bug with the add/removeaction.   

 :D Great job Spooner, truly! You fixed all the things that needed fixing.  :yes:

One tiny question: IF, just IF I'd suddenly decide I have a ton of free time and the will to delve into your mysterious methods of scripting...would you be terribly upset if I designed some kind of visual representation of the whole attachment-detachment deal? I.e. the dialog you mentioned that would show your "inventory" of attachments + allow you to attach/deattach stuff and whatnot? With pictures and everything  :D Hell - to make it really snazzy one could use the animation that puts the weapon down in front of you on the ground, and then show the actual changes as you make them  ;)

Anyway, great work. Should be usable for quite a number of different things; unjamming weapons, field-stripping weapons, creating working weapons from non-working parts (would require addons, of course), and generally allow for all kinds of modifications depending on what addons are out there.

 :good: Woot!

Wolfrug out.
 
« Last Edit: 16 Nov 2007, 23:47:57 by Wolfrug »
"When 900 years YOU reach, look as good you will not!"

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #12 on: 16 Nov 2007, 23:54:59 »
or I end up holding a weapon that isn't in a firing mode (I have to hit 'F' to make it fire in semi-auto mode). Neither are really good solutions and I'm not sure I know how to work around this *shrugs*. Hopefully I can release a working script very soon though...
« Last Edit: 17 Nov 2007, 02:54:30 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #13 on: 17 Nov 2007, 17:07:08 »
Updated: v0.3.0 (see original post for changelog).

Should have fixed all the animation issues and the other bugs from the last version. Additionally made it compatible with teamswitch and, to a limited extent, MP.

NOTE: This version and future versions require SPON Core to be installed (up to v0.2.0, SPON Core was just included in the demo for the debug log, but you could run SPON Attachments on its own).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Robalo_AS

  • Members
  • *
Re: SPON Attachments (DO NOT SUBMIT)
« Reply #14 on: 21 Jan 2008, 21:57:42 »
Hey Spooner,

Awesome idea to make this possible, when I was playing Crysis and saw the weapon modding feature was thinking that we should have something like that in Arma. Now it's possible, thanks !

I noticed a couple issues, maybe you're already aware of them but here goes.

1. One can exploit this feature to get unlimited ammo by simply modding the weapon when the magazine is almost dry. Your current magazine gets replaced with a full one each time.
2. The animation used forces the player to kneel. That can be a problem sometimes and create frustrations, for instance you are hiding on a rooftop prone and want to attach a silencer.. oops you get up, enemy sees you, stealth broken... mission goes to hell.. :D

Here's the fix that somewhat fixes these issues for me:
Code: [Select]
/*
switch ([_oldWeapon] call SPON_getWeaponType) do
{
case "PISTOL":
{
_move = ANIM_WITH_PISTOL;
};
case "RIFLE":
{
_move = ANIM_WITH_RIFLE;
};
default // Launcher.
{
_move = ANIM_WHEN_UNARMED;
};
};
*/

switch ([_actor] call mando_getpos) do
{
  case 0:
  {
  _move = "WeaponMagazineReloadStand";
  };
  case 1:
  {
  _move = "WeaponMagazineReloadKneel";
  };
  default
  {
  _move = "WeaponMagazineReloadProne";
  };
};

// NO NEED // reload _actor; // force a mag reload
_actor playMove _move;
« Last Edit: 22 Jan 2008, 01:11:56 by Robalo_AS »