|
|
|
Re: Too many items for an attachment?[message #351766 is a reply to message #351763]
|
Mon, 25 December 2017 05:46
|
|
Deleted. |
|
Messages:2657
Registered:December 2012 Location: Russian Federation |
|
|
edmortimer wrote on Mon, 25 December 2017 08:17Quote:
You can define attachment point for Rifle Sling, it should work well.
I have not read up on that system yet. Can you point me to a description of how the system works and what the attachment tags are? After this release of AV I plan on re-working the attachment system to this newer one, but as of now I don't have a clue on how to implement it.
You simply define attachment point which is actually a bitmask, for example possible attachment points in VR (it's just a list for convenience, you don't need to define it anywhere):
Toggle Spoiler<AttachmentPoint>0</AttachmentPoint>
<AttachmentPoint>1</AttachmentPoint> <!-- Small Molle -->
<AttachmentPoint>2</AttachmentPoint> <!-- Medium Molle -->
<AttachmentPoint>3</AttachmentPoint> <!-- All Molle -->
<AttachmentPoint>4</AttachmentPoint> <!-- Laser - Small -->
<AttachmentPoint>8</AttachmentPoint> <!-- Laser - LAM -->
<AttachmentPoint>16</AttachmentPoint> <!-- Laser - Rifle Lam -->
<AttachmentPoint>32</AttachmentPoint> <!-- Laser - Old Aimpoint -->
<AttachmentPoint>64</AttachmentPoint> <!-- UB - Bayonet -->
<AttachmentPoint>128</AttachmentPoint> <!-- UB - AK Bayonet -->
<AttachmentPoint>256</AttachmentPoint> <!-- Muzzle - Pistol Suppressor -->
<AttachmentPoint>512</AttachmentPoint> <!-- Muzzle - SMG Suppressor -->
<AttachmentPoint>1024</AttachmentPoint> <!-- Muzzle - AR Suppressor -->
<AttachmentPoint>2048</AttachmentPoint> <!-- Muzzle - Sniper Suppressor -->
<AttachmentPoint>4096</AttachmentPoint> <!-- Muzzle - Flash Suppressor -->
<AttachmentPoint>8192</AttachmentPoint> <!-- Muzzle - Muzzle Brake -->
<AttachmentPoint>16384</AttachmentPoint> <!-- Muzzle - Rifle Grenade -->
<AttachmentPoint>32768</AttachmentPoint> <!-- Muzzle - Gun Barrel Extender -->
<AttachmentPoint>65536</AttachmentPoint> <!-- Muzzle - Duckbill -->
<AttachmentPoint>131072</AttachmentPoint> <!-- Muzzle - Choke -->
<AttachmentPoint>262144</AttachmentPoint> <!-- Sights - Match Sights -->
<AttachmentPoint>524288</AttachmentPoint> <!-- Sights - Aperture Sights -->
<AttachmentPoint>1048576</AttachmentPoint> <!-- Sights - Reflex -->
<AttachmentPoint>2097152</AttachmentPoint> <!-- Sights - Holo/ISM-V-IR -->
<AttachmentPoint>4194304</AttachmentPoint> <!-- Sights - Night/Termal Sight -->
<AttachmentPoint>8388608</AttachmentPoint> <!-- Sights - AK Night Sight -->
<AttachmentPoint>16777216</AttachmentPoint> <!-- Sights - Kobra -->
<AttachmentPoint>33554432</AttachmentPoint> <!-- UB - Bipod -->
<AttachmentPoint>67108864</AttachmentPoint> <!-- UB - Heavy Bipod -->
<AttachmentPoint>134217728</AttachmentPoint> <!-- UB - Foregrip -->
<AttachmentPoint>268435456</AttachmentPoint> <!-- UB - Grippod/GripLight -->
<AttachmentPoint>536870912</AttachmentPoint> <!-- UB - Shotgun -->
<AttachmentPoint>1073741824</AttachmentPoint> <!-- Adapter - 7.62x39 WP Drum -->
<AttachmentPoint>2147483648</AttachmentPoint> <!-- Adapter - 5.56x45 C-Mag -->
<AttachmentPoint>4294967296</AttachmentPoint> <!-- Adapter - 9x19 C-Mag -->
<AttachmentPoint>8589934592</AttachmentPoint> <!-- Internal - Trigger Group -->
<AttachmentPoint>17179869184</AttachmentPoint> <!-- Internal - Match Trigger -->
<AttachmentPoint>34359738368</AttachmentPoint> <!-- Internal - Rod and Spring -->
<AttachmentPoint>68719476736</AttachmentPoint> <!-- Stock - Folding -->
<AttachmentPoint>137438953472</AttachmentPoint> <!-- Stock - Retractable, Shock -->
<AttachmentPoint>274877906944</AttachmentPoint> <!-- Laser - AK Corsac -->
<AttachmentPoint>549755813888</AttachmentPoint> <!-- Rifle Sling -->
<AttachmentPoint>1099511627776</AttachmentPoint> <!-- Scopes - Small 2x -->
<AttachmentPoint>2199023255552</AttachmentPoint> <!-- Scopes - Rifle 3.5x -->
<AttachmentPoint>4398046511104</AttachmentPoint> <!-- Scopes - Acog 4x -->
<AttachmentPoint>8796093022208</AttachmentPoint> <!-- Scopes - Battle 7x -->
<AttachmentPoint>17592186044416</AttachmentPoint> <!-- Scopes - Sniper 10x -->
<AttachmentPoint>35184372088832</AttachmentPoint> <!-- Scopes - PSO-1 -->
<AttachmentPoint>70368744177664</AttachmentPoint> <!-- Scopes - PSO-3 -->
<AttachmentPoint>140737488355328</AttachmentPoint> <!-- Scopes - ZF-42 -->
<AttachmentPoint>281474976710656</AttachmentPoint> <!-- Scopes - No.32 -->
<AttachmentPoint>562949953421312</AttachmentPoint> <!-- Scopes - PEM -->
<AttachmentPoint>1125899906842624</AttachmentPoint> <!-- Scopes - PU -->
<AttachmentPoint>2251799813685248</AttachmentPoint> <!-- Armour Helmet - Face -->
<AttachmentPoint>4503599627370496</AttachmentPoint> <!-- Armour Helmet - Cover -->
<AttachmentPoint>9007199254740992</AttachmentPoint> <!-- Armour Vest - Plates -->
<AttachmentPoint>18014398509481984</AttachmentPoint> <!-- Armour Vest - Camo Shirt -->
<AttachmentPoint>36028797018963968</AttachmentPoint> <!-- Armour Leggings - Protectors -->
<AttachmentPoint>72057594037927936</AttachmentPoint> <!-- Armour Leggings - Camo -->
<AttachmentPoint>144115188075855872</AttachmentPoint> <!-- Explosives - Detonator -->
<AttachmentPoint>288230376151711744</AttachmentPoint> <!-- Misc - Batteries -->
<AttachmentPoint>576460752303423488</AttachmentPoint> <!-- UB Launcher - M203PI -->
<AttachmentPoint>1152921504606846976</AttachmentPoint> <!-- UB Launcher - GP-30 -->
<AttachmentPoint>2305843009213693952</AttachmentPoint> <!-- UB Launcher - AG-36 -->
<AttachmentPoint>4611686018427387904</AttachmentPoint> <!-- UB Launcher - HK-79 -->
<AttachmentPoint>9223372036854775808</AttachmentPoint> <!-- UB Launcher - EGLM -->
Add this point to Items.xml:
Toggle Spoiler<ITEM>
<uiIndex>1525</uiIndex>
<szItemName>Rifle Sling</szItemName>
<szLongItemName>Rifle Sling</szLongItemName>
<szItemDesc>This simple sling prevents you from losing your gun in the heat of combat.</szItemDesc>
<szBRName>Rifle Sling</szBRName>
<szBRDesc>Don't waste time putting your rifle back into your inventory. With this you can just drop your rifle and grab your trusted sidearm.</szBRDesc>
<usItemClass>268435456</usItemClass>
<AttachmentClass>524288</AttachmentClass>
<nasAttachmentClass>256</nasAttachmentClass>
<nasLayoutClass>1</nasLayoutClass>
<AttachmentPoint>549755813888</AttachmentPoint> <!-- Rifle Sling -->
<ubGraphicType>2</ubGraphicType>
<ubGraphicNum>218</ubGraphicNum>
<ubWeight>2</ubWeight>
<ubPerPocket>4</ubPerPocket>
<ItemSize>16</ItemSize>
<usPrice>80</usPrice>
<ubCoolness>3</ubCoolness>
<Sinks>1</Sinks>
<Attachment>1</Attachment>
<BR_NewInventory>5</BR_NewInventory>
<BR_UsedInventory>2</BR_UsedInventory>
<usOverheatingCooldownFactor>100.0</usOverheatingCooldownFactor>
<STAND_MODIFIERS />
<CROUCH_MODIFIERS />
<PRONE_MODIFIERS />
</ITEM>
Then define available attachment point for the weapon you want your sling to attach to:
Toggle Spoiler<ITEM>
<uiIndex>17</uiIndex>
<szItemName>SKS</szItemName>
<szLongItemName>SKS</szLongItemName>
<szItemDesc>This extremely common semi-automatic carbine weapon has seen action in almost every Communist country in the world. This 7.62x39mm carbine was mass produced numbering 15,000,000 to this day. Great for hunting everything from animals to man.</szItemDesc>
<szBRName>SKS</szBRName>
<szBRDesc>The Simonov self-loading SKS automatic rifle has a simple design and is easy to operate. Developed during WWII, it was later distributed to most Warsaw Pact members. Its only weak spot: it's a little heavy for its cartridge.</szBRDesc>
<usItemClass>2</usItemClass>
<nasLayoutClass>1</nasLayoutClass>
<AvailableAttachmentPoint>4</AvailableAttachmentPoint> <!-- Laser - Small -->
<AvailableAttachmentPoint>128</AvailableAttachmentPoint> <!-- UB - AK Bayonet -->
<AvailableAttachmentPoint>1024</AvailableAttachmentPoint> <!-- Muzzle - AR Suppressor -->
<AvailableAttachmentPoint>4096</AvailableAttachmentPoint> <!-- Muzzle - Flash Suppressor -->
<AvailableAttachmentPoint>549755813888</AvailableAttachmentPoint> <!-- Rifle Sling -->
<ubClassIndex>17</ubClassIndex>
<ubCursor>3</ubCursor>
<ubGraphicNum>17</ubGraphicNum>
<ubWeight>39</ubWeight>
<ItemSize>8</ItemSize>
<usPrice>870</usPrice>
<ubCoolness>4</ubCoolness>
<bReliability>2</bReliability>
<bRepairEase>-1</bRepairEase>
<Damageable>1</Damageable>
<Repairable>1</Repairable>
<WaterDamages>0</WaterDamages>
<Metal>1</Metal>
<Sinks>1</Sinks>
<ShowStatus>1</ShowStatus>
<TwoHanded>1</TwoHanded>
<BR_NewInventory>0</BR_NewInventory>
<BR_UsedInventory>1</BR_UsedInventory>
<BR_ROF>24</BR_ROF>
<usOverheatingCooldownFactor>100.0</usOverheatingCooldownFactor>
<DamageChance>10</DamageChance>
<DirtIncreaseFactor>24.0</DirtIncreaseFactor>
<STAND_MODIFIERS />
<CROUCH_MODIFIERS />
<PRONE_MODIFIERS />
</ITEM>
That's all, as far as I know.
You can also add these points to lookup table if you plan to use XML Editor:
AttachmentPoint.xml:
Toggle Spoiler<?xml version="1.0" encoding="utf-8"?>
<JA2Data>
<AttachmentPoint>
<id>0</id>
<name>None</name>
</AttachmentPoint>
<AttachmentPoint>
<id>1</id>
<name>Small Molle</name>
</AttachmentPoint>
<AttachmentPoint>
<id>2</id>
<name>Medium Molle</name>
</AttachmentPoint>
<AttachmentPoint>
<id>3</id>
<name>All Molle</name>
</AttachmentPoint>
<AttachmentPoint>
<id>4</id>
<name>Laser - Small</name>
</AttachmentPoint>
<AttachmentPoint>
<id>8</id>
<name>Laser - LAM</name>
</AttachmentPoint>
<AttachmentPoint>
<id>16</id>
<name>Laser - Rifle Lam</name>
</AttachmentPoint>
<AttachmentPoint>
<id>32</id>
<name>Laser - Old Aimpoint</name>
</AttachmentPoint>
<AttachmentPoint>
<id>64</id>
<name>Muzzle - Bayonet</name>
</AttachmentPoint>
<AttachmentPoint>
<id>128</id>
<name>Muzzle - AK Bayonet</name>
</AttachmentPoint>
<AttachmentPoint>
<id>256</id>
<name>Muzzle - Pistol Suppressor</name>
</AttachmentPoint>
<AttachmentPoint>
<id>512</id>
<name>Muzzle - SMG Suppressor</name>
</AttachmentPoint>
<AttachmentPoint>
<id>768</id>
<name>Muzzle - Pistol/SMG Suppressor</name>
</AttachmentPoint>
<AttachmentPoint>
<id>1024</id>
<name>Muzzle - AR Suppressor</name>
</AttachmentPoint>
<AttachmentPoint>
<id>2048</id>
<name>Muzzle - Sniper Suppressor</name>
</AttachmentPoint>
<AttachmentPoint>
<id>4096</id>
<name>Muzzle - Flash Suppressor</name>
</AttachmentPoint>
<AttachmentPoint>
<id>8192</id>
<name>Muzzle - Muzzle Brake</name>
</AttachmentPoint>
<AttachmentPoint>
<id>16384</id>
<name>Muzzle - Rifle Grenade</name>
</AttachmentPoint>
<AttachmentPoint>
<id>32768</id>
<name>Muzzle - Gun Barrel Extender</name>
</AttachmentPoint>
<AttachmentPoint>
<id>65536</id>
<name>Muzzle - Duckbill</name>
</AttachmentPoint>
<AttachmentPoint>
<id>131072</id>
<name>Muzzle - Choke</name>
</AttachmentPoint>
<AttachmentPoint>
<id>262144</id>
<name>Sights - Match Sights</name>
</AttachmentPoint>
<AttachmentPoint>
<id>524288</id>
<name>Sights - Aperture Sights</name>
</AttachmentPoint>
<AttachmentPoint>
<id>1048576</id>
<name>Sights - Reflex</name>
</AttachmentPoint>
<AttachmentPoint>
<id>2097152</id>
<name>Sights - Holo/ISM-V-IR</name>
</AttachmentPoint>
<AttachmentPoint>
<id>4194304</id>
<name>Sights - Night/Termal Sight</name>
</AttachmentPoint>
<AttachmentPoint>
<id>8388608</id>
<name>Sights - AK Night Sight</name>
</AttachmentPoint>
<AttachmentPoint>
<id>16777216</id>
<name>Sights - Kobra</name>
</AttachmentPoint>
<AttachmentPoint>
<id>33554432</id>
<name>UB - Bipod</name>
</AttachmentPoint>
<AttachmentPoint>
<id>67108864</id>
<name>UB - Heavy Bipod</name>
</AttachmentPoint>
<AttachmentPoint>
<id>134217728</id>
<name>UB - Foregrip</name>
</AttachmentPoint>
<AttachmentPoint>
<id>268435456</id>
<name>UB - Grippod/GripLight</name>
</AttachmentPoint>
<AttachmentPoint>
<id>536870912</id>
<name>UB - Shotgun</name>
</AttachmentPoint>
<AttachmentPoint>
<id>1073741824</id>
<name>Adapter - 7.62x39 WP Drum</name>
</AttachmentPoint>
<AttachmentPoint>
<id>2147483648</id>
<name>Adapter - 5.56x45 C-Mag</name>
</AttachmentPoint>
<AttachmentPoint>
<id>4294967296</id>
<name>Adapter - 9x19mm C-Mag</name>
</AttachmentPoint>
<AttachmentPoint>
<id>8589934592</id>
<name>Internal - Trigger Group</name>
</AttachmentPoint>
<AttachmentPoint>
<id>17179869184</id>
<name>Internal - Match Trigger</name>
</AttachmentPoint>
<AttachmentPoint>
<id>34359738368</id>
<name>Internal - Rod and Spring</name>
</AttachmentPoint>
<AttachmentPoint>
<id>68719476736</id>
<name>Stock - Folding</name>
</AttachmentPoint>
<AttachmentPoint>
<id>137438953472</id>
<name>Stock - Retractable, Shock</name>
</AttachmentPoint>
<AttachmentPoint>
<id>274877906944</id>
<name>Laser - AK Corsac</name>
</AttachmentPoint>
<AttachmentPoint>
<id>549755813888</id>
<name>Rifle Sling</name>
</AttachmentPoint>
<AttachmentPoint>
<id>1099511627776</id>
<name>Scopes - Small 2x</name>
</AttachmentPoint>
<AttachmentPoint>
<id>2199023255552</id>
<name>Scopes - Rifle 3.5x</name>
</AttachmentPoint>
<AttachmentPoint>
<id>4398046511104</id>
<name>Scopes - Acog 4x</name>
</AttachmentPoint>
<AttachmentPoint>
<id>8796093022208</id>
<name>Scopes - Battle 7x</name>
</AttachmentPoint>
<AttachmentPoint>
<id>17592186044416</id>
<name>Scopes - Sniper 10x</name>
</AttachmentPoint>
<AttachmentPoint>
<id>35184372088832</id>
<name>Scopes - PSO-1</name>
</AttachmentPoint>
<AttachmentPoint>
<id>70368744177664</id>
<name>Scopes - PSO-3</name>
</AttachmentPoint>
<AttachmentPoint>
<id>140737488355328</id>
<name>Scopes - ZF-42</name>
</AttachmentPoint>
<AttachmentPoint>
<id>281474976710656</id>
<name>Scopes - No.32</name>
</AttachmentPoint>
<AttachmentPoint>
<id>562949953421312</id>
<name>Scopes - PEM</name>
</AttachmentPoint>
<AttachmentPoint>
<id>1125899906842624</id>
<name>Scopes - PU</name>
</AttachmentPoint>
<AttachmentPoint>
<id>2251799813685248</id>
<name>Armour Helmet - Face</name>
</AttachmentPoint>
<AttachmentPoint>
<id>4503599627370496</id>
<name>Armour Helmet - Cover</name>
</AttachmentPoint>
<AttachmentPoint>
<id>9007199254740992</id>
<name>Armour Vest - Plates</name>
</AttachmentPoint>
<AttachmentPoint>
<id>18014398509481984</id>
<name>Armour Vest - Camo Shirt</name>
</AttachmentPoint>
<AttachmentPoint>
<id>36028797018963968</id>
<name>Armour Leggings - Protectors</name>
</AttachmentPoint>
<AttachmentPoint>
<id>72057594037927936</id>
<name>Armour Leggings - Camo</name>
</AttachmentPoint>
<AttachmentPoint>
<id>144115188075855872</id>
<name>Explosives - Detonator</name>
</AttachmentPoint>
<AttachmentPoint>
<id>288230376151711744</id>
<name>Misc - Batteries</name>
</AttachmentPoint>
<AttachmentPoint>
<id>576460752303423488</id>
<name>UB Launcher - M203PI</name>
</AttachmentPoint>
<AttachmentPoint>
<id>1152921504606846976</id>
<name>UB Launcher - GP-30</name>
</AttachmentPoint>
<AttachmentPoint>
<id>2305843009213693952</id>
<name>UB Launcher - AG-36</name>
</AttachmentPoint>
<AttachmentPoint>
<id>4611686018427387904</id>
<name>UB Launcher - HK-79</name>
</AttachmentPoint>
<AttachmentPoint>
<id>9223372036854775808</id>
<name>UB Launcher - EGLM</name>
</AttachmentPoint>
<AttachmentPoint>
<id>18446744073709551615</id>
<name>***Upper Limit***</name>
</AttachmentPoint>
<AttachmentPoint>
<id>36009022600196</id>
<name>* AK Main</name>
</AttachmentPoint>
<AttachmentPoint>
<id>167772288</id>
<name>* AK UB</name>
</AttachmentPoint>
<AttachmentPoint>
<id>17042464838728</id>
<name>* AR Main</name>
</AttachmentPoint>
</JA2Data>
You can combine as many available attachment point tags in items.xml entry as you like as they are only combined as a bitmask. Since the value is stored in int64, there can be no more than 64 bits that represent different attachment points, but you can combine several bits together for convenience.
You also don't need to define attachment point for each item, instead you can use it like in real life - if weapon has a rail, any attachment that fits this rail type can be attached here, something like this was implemented in AFS, also SDO mod uses attachment point system.
Also, this code
is just a comment, you can ignore it.
[Updated on: Mon, 25 December 2017 05:52]
Left this community.Report message to a moderator
|
|
|
|
|
|
|
Re: Too many items for an attachment?[message #361405 is a reply to message #361404]
|
Tue, 29 September 2020 17:31
|
|
Kurt |
|
Messages:420
Registered:March 2004 |
|
|
Sorry to barge in, but in my own (limited) experience editing Attachments.xml in 8796, and without restarting the game, I sometimes had some newly added attachment refuse to work indeed.
In those cases I quit the game to check my Attachments.xml for errors, usually find none, and lo and behold, when going back to the game the attachment now works - I changed nothing.
My point is that the game mostly accepts new/modified entries in item-related XML files in mid-game, but you sometimes have to insist a little. I didn't manage to detect a pattern (I can make two additions, one works, the other not), all I know is it eventually works.
I'd suggest to quit JA2, restart it and try again.
(Sacrificing a black goat can help, but isn't mandatory)
Report message to a moderator
|
Master Sergeant
|
|
|
|
|
Re: Too many items for an attachment?[message #361410 is a reply to message #361408]
|
Wed, 30 September 2020 18:38
|
|
Kurt |
|
Messages:420
Registered:March 2004 |
|
|
edmortimer wrote on Wed, 30 September 2020 16:38Did you put the <AttachmentPoint> tag on the ZF-42, as well as the <AvailableAttachmentPoint> on the weapon?
Interesting, I went a different way with my new attachments (all working), apparently the old way:
Edit "Attachments.xml", and add
<ATTACHMENT>
<attachmentIndex>1180</attachmentIndex>
<itemIndex>1075</itemIndex>
<APCost>20</APCost>
</ATTACHMENT>
(where 1180 is the ZF-42 Scope, and 1075 the MG3.)
Attachment points appear all on their own, and as I said above, either it works right from the start, or it just needs a little insisting.
Report message to a moderator
|
Master Sergeant
|
|
|
|
|
|
|
|
|
|