Home » MODDING HQ 1.13 » v1.13 Coding Talk » (New) Common Attachment Framework (new title; was The NAS Receiver)
Re: (New) Common Attachment Framework (new title; was The NAS Receiver)[message #305607] Tue, 05 June 2012 00:43 Go to previous messageGo to next message
Madd_Mugsy

 
Messages:637
Registered:July 2005
Location: Canada
You could also hack the AttachObjectOAS and AttachObjectNAS functions (they're nearly carbon f-cking copies of each other Sad ) to do something like:
1) Check if base item = tripwire and attachment = gun
2) If yes try attach (skill check?). If successful, dump all attachments from gun into inventory.

It'll probably get messy quickly though.


Re: (New) Common Attachment Framework (new title; was The NAS Receiver)[message #305608] Tue, 05 June 2012 01:00 Go to previous messageGo to next message
Flugente

 
Messages:3416
Registered:April 2009
Location: Germany
Hmm. Thats an ugly solution. Still... less xml-work for me Smile


Re: (New) Common Attachment Framework (new title; was The NAS Receiver)[message #305728] Thu, 07 June 2012 22:38 Go to previous messageGo to next message
Wil473

 
Messages:2833
Registered:September 2004
Location: Canada
Performance question: what is the impact of having a bunch of attachments defined via (N)CAF that you know will never be used?

ie. All integral grenade launchers are classed as Attachment Point = "Integral Launcher" and letting the default attachment system fill in the slot so nobody actually see's the short cut in-game.

Is this scheme more/less/same efficient for the game than using the old attachment system and having a 1 to 1 specification of the integral attachment to gun?


Re: (New) Common Attachment Framework (new title; was The NAS Receiver)[message #305731] Fri, 08 June 2012 00:20 Go to previous messageGo to next message
Madd_Mugsy

 
Messages:637
Registered:July 2005
Location: Canada
It should be very minimal. The CAF is much more efficient than the old system. The old system loops through every single base item/attachment pair in the attachments.XML looking for a match. The new one just does a bitwise comparison between the base item's AvailableAttachmentPoint tag the attachment's AttachmentPoint tag. In theory, CAF should be orders of magnitude faster.

In fact, I handle various stock attachments this way, and it works great. I'm currently experimenting with every gun that has a stock getting a default stock attachment via a "Stock" attachment point.


Re: (New) Common Attachment Framework (new title; was The NAS Receiver)[message #317173] Sun, 07 April 2013 19:19 Go to previous messageGo to next message
Wil473

 
Messages:2833
Registered:September 2004
Location: Canada
Thought I should announce, I've hit the 64 bit limit with (N)CAF in my plan to eliminate hundreds of Rod&Spring and ACME Trigger Group attachment defs in Attachments.XML. I'm cannibalizing some of the lesser used attachment points right now.


Re: (New) Common Attachment Framework (new title; was The NAS Receiver)[message #341924 is a reply to message #305731] Sat, 01 August 2015 19:35 Go to previous messageGo to next message
alwaysfirst

 
Messages:11
Registered:January 2009
sorry to bring up with this thread.

I am recent helping people from TBS forum to update their mod IOV. I just find out that AvailableAttachmentPoint seems to be out of use. I can only see very few items in Items.xml having this tag, with the value of 1, 3 and 7. Most of items with this tag, if not all, are vests and rigs. I doubt what this tag means at the moment.

Besides, since the new forum seems not working perfect with codes, I miss some part of this thread.

Anyway, could anyone kindly explain the function of this tag? many thanks!
Re: (New) Common Attachment Framework (new title; was The NAS Receiver)[message #341926 is a reply to message #341924] Sun, 02 August 2015 01:44 Go to previous message
Wil473

 
Messages:2833
Registered:September 2004
Location: Canada
I thought, stock v1.13 had moved most of its attachments out of Attachments.XML to use this feature. If you want to see a very heavy implementation of this feature take a look at one of my projects (AFS/DL-1.13/UC-1.13) or Smeagol's AIMNAS. In my projects most guns have their attachments defined via (N)CAF almost exclusively and I've reworked my bitmap scheme at least twice over the years in a bid to minimize the small number of attachments still using Attachments.XML.

In general, <AttachmentPoint> is used to define which <AvailableAttachmentPoints> an item will attach to. Both are bitmasks.

From my mods, the original pistol Suppressor (item 207) has <AttachmentPoint> = 32768 or binary 1000 0000 0000 0000

The original pistol suppressor fits <AvailableAttachmentPoints>:
 32768 / 0000 1000 0000 0000 0000 "Muzzle - Pistols" - this is used when you want a gun to only fit item 207 and its premium counterpart
 49152 / 0000 1100 0000 0000 0000 "S - Pistols" - this is used when you want a gun to fit both the above two items as well as a Flash Suppressor (bitmask 16384 /0100 0000 0000)
180224 / 0010 1100 0000 0000 0000 "S - Pistol/KCB" - this is used when you want to fit the above two items, Flash Suppressor, and a KCB Bayonet (bitmask 1301072 0010 0000 0000 0000)


Now the names I have above in "" are a convenience for the benefit of the XML Editor where <AvailableAttachmentPoints> are given a name for ease of use. This is in ...\TableData\Lookup\AttachmentPoint.xml


EDIT: one important note, bitmasks add up not just among the ten possible <AvailableAttachmentPoints> per item, but also in-game when items are attached to other items. Again from my mods, many AK style weapons gain access to Western "RIS" attachments via the attachment of the AK Handguard attachment and a non-scope, RSA/SDV (side) scope rail attachment. These attachments contain in their <AvailableAttachmentPoints> the bitmasks for RIS attachments.

Now (N)CAF simply replaces Attachments.XML, don't confuse it New Attachment System (NAS) that defines where and how many of an attachment may be fitted on a gun...


EDIT2: by the way, Windows 10 has a programmer calculator (bitmask to integer and vice-versa), how I missed this from the Windows 8 calculator...

[Updated on: Sun, 02 August 2015 01:58]




More weapon features and upgrade options, via (mis)use of v1.13 for vanilla Arulco, Dedrianna Lives! and Urban Chaos campaigns.


Previous Topic: New Stealth Mechanics
Next Topic: [IDEA] New Magazine System
Goto Forum:
  


Current Time: Tue Oct 23 04:33:01 EEST 2018

Total time taken to generate the page: 0.01396 seconds