Home » MODDING HQ 1.13 » v1.13 Coding Talk » (New) Common Attachment Framework (new title; was The NAS Receiver)
(New) Common Attachment Framework (new title; was The NAS Receiver)[message #303876] Wed, 25 April 2012 01:27 Go to previous message
Madd_Mugsy

 
Messages:634
Registered:July 2005
Location: Canada
So messing around with the XML Editor, one of the things that drives me nuts, and I'm sure must really drive Wil473 and Smeagol insane, is the crazy amount of work that's required to add and maintain attachment consistency across an increasing number of guns and other items.

So I have a quick solution: The NAS Receiver. Common Attachment Framework.

Basically, we add 3 UINT64/128 tags to items.xml:
- nasReceiver AvailableAttachmentPoint
- nasAcceptedReceiver AttachmentPoint
- nasAttachReceiverAPCost AttachToPointAPCost

We can use these in a similar fashion (ie: bitwise operations) to the nasAttachmentClass tag, and simply set the nasReceiver AvailableAttachmentPoint tag on the weapon/base item, and the nasAcceptedReceiver AttachmentPoint tag on the attachment. Then we can set a common AP cost across all base items with nasAttachReceiverAPCost AttachToPointAPCost.

For example:

Say we have the basic Laser Sight attachment. This thing can be attached to every gun in the game. But what a pain in the ass to have to link it to EVERY gun in the game. And it's so much worse in AIMNAS or AFS, where the number of weapons is much, much higher. *Whew* I get tired just thinking about it.

First we need to do some once only setup legwork.

We need to define a list of possible receivers. For this example, I'll keep it simple, but with enough meat so you get the idea:

0    None
1    Pistol Small
2    Pistol Medium
4    Pistol Large
8    Revolver
16   Large Revolver
32   Machine pistol
63   Any Handgun
64   Submachinegun
128  Shotgun
256  Rifle
512  Assault Rifle
1024 Sniper Rifle
2048 Light Machinegun
4095 Any Gun


Now we could add on things like GLs, Rail systems and AK receivers, and so on. But I'll leave that to your imagination for now...

Next we set all the nasReceiver AvailableAttachmentPoint tags on our guns in the XML Editor (using edit mode in the grid, so we can do it quickly).

Now back to our Laser Sight. We set the nasAcceptedReceiver AttachmentPoint tag to 4095 = Any gun. And we're done. We can also go ahead and delete that massive list of entries in Attachments.xml now to make the game go faster. (It would work with Launchables.xml as well)

Any thoughts, comments or concerns? I can probably get this implemented in the next day or two.

Report message to a moderator

First Sergeant

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


Current Time: Fri Jan 10 10:37:39 GMT+2 2025

Total time taken to generate the page: 0.02529 seconds