Jump to content
Sign in to follow this  
[frl]myke

[For free] Proof of concept: weapon attachements

Recommended Posts

Weapon attachements *Proof of concept* - free offer!

Here's the deal: i made a proof of concept to create a weapon attachement system for rifles. Probably it will also work for other weapon types but i made it just for primary weapons.

What's in it: a config template which shows how to expand weapon configs to make the system work. Also basic scripts are included to get an idea on how the system works scriptingwise. Everything comes packed in a pbo aswell as in a unpacked folder, ready to edit.

How does it work in general: attachements are defined as items, like the map or the compass. Therefor they will take a item slot. A single item can be a M203 grenade launcher or a ACOG or Aimpoint attachement. Basicly everything that is attached to a weapon.

The weapon configs are modified in a way so they define what attachements a particular weapon can take. This way it is defined when applying a attachement, to what weaponclass it upgrades and vice versa, when removing a attachement to which weaponclass it degrades.

How can i test it in the editor?

Open ArmA 2 (not tested with OA but should work with OA & A2 together) with the addon loaded.

Place a unit, don't matter what type or side. In the initline, type (copy/paste) this line:

nul = [this] execVM "\GLT_attachement_poc\addInit.sqf"

Go in preview and test it.

Ah yeah, cool. Predefined addweapon/removeweapon scripts. How impressive.

Thats the point: it's not predefined in the scripts. If attachement works is determined by reading the config. Also you must have an attachement in your inventory to make it work.

qAERHbZ5YEc

Here's the final offer: i give this proof of concept away to anyone who is interested in it. Personally, i do lack of time aswell as lack of skills in creating dialogues, which such an addon should definately include.

Whoever makes it, it will be his addon. He may release it as his own work, since the amount of work which has to be done is quite high: research weapons in the game, which attachements are there, in which order can they applied and so on. And then the dialogue.

So if someone takes the work, from my point of view it is only fair he might say it is his own work...which it is, at the very end.

Maybe a note in the readme, something like "based on a proof of concept by [GLT]Myke", thats all.

Ok, thats the deal. Take it or leave it.

Senduit link is active for one week. Let me know if it's expired and you would like to have it.

http://senduit.com/abf147

Share this post


Link to post
Share on other sites

Was thinking about this the other day and why BIS did not implement such a system where ANY weapon could mount a variety of different scopes to save us having tons of classnames.

I take it this script just executes addWeapon for each thing like add M203 etc. Quite a nice idea, would be good for ammo crate selections etc.

Share this post


Link to post
Share on other sites

For those who want to have a quick look at it, here is the config: http://pastebin.com/cNYGWD1p

Here the script which attaches: http://pastebin.com/pZmzdKaK

and here for detaching: http://pastebin.com/tudKjXcx

As said, the scripts are quick and ugly made, more focussed that they work.

@rexehuk

as you can see, it is quite more than just a simple addWeapon.

Share this post


Link to post
Share on other sites
Myke;1676624']@rexehuk

as you can see' date=' it is quite more than just a simple addWeapon.[/quote']

Meh, it's still just addWeapon, but with fancy config reading. :j:

It's still not a really practical solution IMO, then again it's not really a practical feature.

Share this post


Link to post
Share on other sites

FMD, piss on his idea why don't you.

I personally think this is a cracking idea and have a similar thing that works by filtering the weapon displaynames using CBA string functions rather than updating classes.

e.g.:

M4A1 RCO

M4A1 RCO

M4A1 RCO SD

M4A1 RCO SD

M4A1 M203 CCO

M4A1 M203 CCO SD

M4A1 CCO SD

M4A1 Holo

M4A1 M203

M4A1 M203 SD

M4A1 M203 RCO

M4A1 M203 RCO

M4A1 M203 RCO

M4A1 M203 RCO

All start with M4A1 - which means working out the variants and removing duplicates is just a set of string functions. In addition, you can exclude the ACE _CQB variants for those weapons which have them.

It uses the dialog from Kronsky's weapon selector as a base, so it even gives you a picture preview of the weapon you are switching to.

Will have a look at your scripts.

Edited by Victim ZSU

Share this post


Link to post
Share on other sites

well it is just the addweapon, i did this myself actually, also with the Item, loved the idea but then ingame you simply put on the scope and suddenly you got a reloaded gun.

However its, still your magazines and a delay can be added.. my problem however was that if you used it back and forth a few time it was very common you ended up with 2 guns.. and my script was "foolproof" so dropped it.

[GLT]Myke, i am not trying to say you got a bad idea, esp not since I had it myself

however.. this won't "solve" the problem with too many versions of weapons in classnames since its just a way of switching them. Second, there is no need to "solve" that.

What if we want the player to start with a m4 with m203 and we can only do "this addweapon "m4"; this addweapon "item_m203"... it gets longer...

and many use this addweapon thing for a lot of stuff already. However few use it with Items, i also did that, and think thats the way to go. I could detach my scope from my assault rifle, run to the machinegun and mount it.. but yeah i dropped the idea already.

Share this post


Link to post
Share on other sites

I recall a weapon attachment ability in FFUR for OFP. Granted when I used it at the time it wasn't very performance friendly, the game would stall for half a second while it changed the model. But I seem to recall it managing to add attachments while keeping the same ammo count, not reloading the weapon in the process...

Or I could just be dreaming.

Share this post


Link to post
Share on other sites

From the idea i made a similar script with my RFJ_mercenaries back in the ofp day, where i used a similar script to allow switiching between 2 primary weapons. the full mag bug couldnt really be avoided but it worked.

anyway, from a realistic POV, no one would take off acog´s or reddots during combat or in the field, simply because it throws off zeroing and rendering the scope useless.

therefore modern scopes also have a piggyback reddot or can swith inside the optic like the elcan specter.

same goes with grenade launchers and in a similar way with suppressors.

nice gimmick but in my eyes not THAT really applyable.

Share this post


Link to post
Share on other sites
the full mag bug couldnt really be avoided but it worked.

You can avoid the full mag bug, there is a way to do it :)

But it's nothing new and like you wrote, nothing more than a gimmick that you remove some day again.

Xeno

Share this post


Link to post
Share on other sites
Meh, it's still just addWeapon, but with fancy config reading.

You can come up with something better, be my guest. Untill then, this is actually the best offer.

but then ingame you simply put on the scope and suddenly you got a reloaded gun.
anyway, from a realistic POV, no one would take off acog´s or reddots during combat or in the field, simply because it throws off zeroing and rendering the scope useless.

Lads, it is a simple concept to see if it works in general. Sure, you wouldn't start adding/removing items when in a battle. Thats why a possible final version should have a dialogue and not actionmenu entries. This and a anim (like the weaponbox anim) would prevent exploiting the "suddenly full mag" issue, since reloading would be done faster than changing attached items.

And then, i don't know about other armies, but during recruit training i've learned that whenever you got a second, change your mag to a full. So if i have time to change attachements, i surely have the time to insert a full mag. So IMHO there is nothing to fix since this is realistic.

Maybe next time i just write "ACE2" on it and it surely will be praised. :p

j/k

But seriously, instead of just searching bugs (which are surely there) maybe also look for possible solutions.

At least i can say i tried. I can't see any unsolvable bugs that could be exploited if it's done right. Well, but your decision. let it be DOA if you want. It wasn't difficult for me to do so i wont lose much.

:EDITH:

About it being a "gimmick": if you have a weapon with Aimpoint and M203 and you run out of ammo for the rifle and no compatible ammo around. But hey, this dead soldier has a weapon that could at least make use of the M203....if only i could dettach it from my rather useless weapon....that would be a nice "gimmick".

Edited by [FRL]Myke

Share this post


Link to post
Share on other sites

It doesn't solve the biggest issue: For every variant there needs to be a model. That makes ulterior changes impossible.

Even if we could stick 5 attachments to the M4. There is still the section problem. A weapon would have 6 sections at minimum => performance goodbye.

Share this post


Link to post
Share on other sites
It doesn't solve the biggest issue: For every variant there needs to be a model. That makes ulterior changes impossible.

Even if we could stick 5 attachments to the M4. There is still the section problem. A weapon would have 6 sections at minimum => performance goodbye.

I don't see how addWeapon could hit performance. The weapons itself would be modelled like they were done in the past. And even with you example, a weapon can be modelled with just 2 sections: one for the weapon, one for the muzzleflash.

:EDITH:

What if we want the player to start with a m4 with m203 and we can only do "this addweapon "m4"; this addweapon "item_m203"... it gets longer...

Why this? The M4 with mounted M203 is still there and you can add it directly. The system even allows to remove the M203 later if needed without additonal effort. So you're free to add a built-up M4/M203 or a M4 with item M203. At the end it is even more flexible.

Edited by [FRL]Myke

Share this post


Link to post
Share on other sites

Ok, maybe my post wasn't so clear.

Take the M4. There are 5 possible attachment places. Granted, some attachments need to be fixed to special rails. Like the M203 to the bottom rail and the sights preferrably to the sights rail.

Now as a modeller you have your M4 all done. Then you have the "attachments". Lets say a pool of cco, Aimpoint, Eotech, RCO for the sights, for the bottom rail M203, grip, bipod, heatshield. Lets just stay with that.

If i'm not mistaken thats 4x4 possibilities. So 16 M4s that have to be modeled.

Ok, when you're done, you notice a mistake on the lower receiver. A mistake which you'll have to correct on every of those 16 M4s.

My suggestion is: solving that by proxies (i know, engine limitation etc) You'd have one model which you could attach where you want.

Hence you'd have one M4 (=1 section) with up to 5 attachments, 6 even with a suppressor. Hence the 6 or 7 sections. :eek:

I don't think either that you'd change your sights when deployed. I guess you'll need tools for that. So my concern is really the modelling.

Share this post


Link to post
Share on other sites

Aye, you're right. But at the end, it is a modelling issue and will remain the same without the attachement system. And no one say each variant has to be made or several attachements could be merged together, reducing variations.

What you say is surely correct but the problem wouldn't be caused by the attachement system and the problem also could exist on any other weapon addon.

Share this post


Link to post
Share on other sites

Not trying to be disrespectful or anything Myke, but this really isn't anything new. Yes, you have a fairly decent system of using configs to, well, configure it, but at it's core it's still a weapon swap, and even back in OFP we were using this method (just take a look at my Uzi addon or 2nd rifle). And since then it's always had many issues that, while it was neat, made it very impractical.

As Serclaes and others mentioned, what we really need to get something like this to a practical state is extended manipulation of model proxies. But I encourage you to further refine your config system, since it's a good start I suppose. Some constructive criticism: your canUseItems array is kind of redundant since you can just read all of the subclasses of class canAttach.

Share this post


Link to post
Share on other sites
Not trying to be disrespectful or anything Myke, but this really isn't anything new.

Understand, no offence taken. Also i didn't claimed it "new" or "unique" but i didn't see it in more or less regular use so i simply didn't know if and what already has been tried.

Yes, you have a fairly decent system of using configs to, well, configure it, but at it's core it's still a weapon swap, and even back in OFP we were using this method (just take a look at my Uzi addon or 2nd rifle). And since then it's always had many issues that, while it was neat, made it very impractical.

Thanks for the compliment. I also agree that it isn't "state-of-the-art" how it is achieved and i also agree that some kind of prxy system included in ArmA 2 would be probably much better.....well, i don't see it commin. Unless you have official info that i don't know, how likely you think it is that BIS will implement such a system? Modding BIS Games was always a matter to go beyond engine limitations, try to get the best out of it. This is what i could think of, if it's not good enough, just drop it.

your canUseItems array is kind of redundant since you can just read all of the subclasses of class canAttach.

Aye, you're right. Blame it on my laziness because at that point it was easier/quicker for me to just check if item is in a array. As already said: quick and dirty.

Thanks for your feedback, BD. No offence taken at all. :D

And somethin in general: the issues i can think of are rather optical/cosmetical type or a question of prper scripting. I can't see any major issues which could lead to exploits when taken care of.

The benefits of this system:

- it can be applied to default BIS weapons.

- it remains optional, no one is forced to make use of it. You still can change your weapon at a weapon box from say a M4 to a M4/M203.

- it can be used with any available attachement if a respective weapon exists.

Downsides:

- can be used for exploits if it isn't realised properly

- BIS weapons wont fit visually most of the time.

I do not claim this idea as "new" or "exclusive" by any meaning. Was just reading such a request in the Suggestions Forum and this idea came to my mind so i was curious if it would work. It is not the only nor the best way but it is a way that would work. Take it or leave it. If you can do better, well then, what are you waiting for?

:EDITH:

"You" is not addressed to someone specially, just a general "you". ;)

Share this post


Link to post
Share on other sites

Nice stuff, maybe e.g. the medic heal animation could be added before switching the attachments?

On the subject of "better solutions", working with weapon proxies would (for vanilla content) require mlods anyway (?), so it's the best it can get I guess and the way it is it works for me. Thanks for sharing.

Edited by Icewindo

Share this post


Link to post
Share on other sites

You guys do understand that anything that goes off and back on the gun need rezeroing every time, right?:confused:

Share this post


Link to post
Share on other sites

Not exactly... "RIS" aka "Picatinny rails" aka " STANAG 2324" aka "MIL-STD-1913" were made to avoid zeroing the gun every time you change optics. That was the point of the whole concept to be honest...

Edited by Max255[PL]

Share this post


Link to post
Share on other sites

Hmm, would be awesome to have, don't know why BI never added that.....but is it just me or the video simply shows different weapons being switched?

Share this post


Link to post
Share on other sites

No, it's weapons being switched. As I keep saying, currently you can't (atleast nobody has found a away/done it yet) create SOCOM-ish "attachments" that you can put on a rifle. The only way *again, following the above statement in ()* is to create one rifle model, and then several copies of the model using different configurations of the "attachments". Then you use a script, or Myke's method (More advanced I think.) to switch to a model that has the attachments you want/select.

Share this post


Link to post
Share on other sites

Wow.....So MW2 and BC2 all have a model for every gun atachment/combination?

Share this post


Link to post
Share on other sites

i can confirm for bc2, looking through all the files, it's just new models etc, not "attached" stuff..

Share this post


Link to post
Share on other sites

In the sense of realism, I don't see a point in having a feature like this at all.

When you're out in the field, at least in the US Army, sensitive stuff like ACOGs, PEQs, CCOs, and any other attachment(other than vertical grips), are dummy corded to the weapon, to prevent it from being lost if it were to fall off for any reason.

With that being said, its also rather pointless in the fact that just about anything that can be attached needs to be zeroed(even 203s) or confirmed. Yes, I understand the concept/purpose of the rail system, but stuff gets bumped around, or if the shooter fails to put the item in the same exact spot, it can lose its zero. If its not zeroed, you're wasting your time even having it on your weapon, because at distances, even being slightly off can determine whether you hit, or miss.

Besides, What would you really need to attach to your rifle that isn't already on it? You got your PEQ, an optic(ACOG or CCO), a weapon light, and maybe a 203 if you've been issued one. Its not done in the real military because it doesn't serve a purpose. Give a soldier what his Paragraph and line number says he needs, and leave it at that. Name one thing that an infantry soldier needs that isn't on a weapon already, that you would need to add?

I also don't know a single soldier that would want to carry any additional equipment that takes up valuable space, when he could carry ammo,water, batteries, or pogey bait.

Now some humor: For those of you who have been in the US Military, if you had ALL this crap, can you imagine the time on the range you would spend zeroing?!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×