Compatible Attachments
Now that we have all of our assets and json files in place for creating attachments, the final thing to do is to make guns accept these attachments.
Guns accept attachments in two ways:
-
Defining compatible attachments
-
Defining compatible attachment groups
Example gun json with compatible attachment code:
"compatibleAttachmentGroups": [
],
"compatibleAttachments": [
]Both methods are useful in different ways.
When you create an attachment, you assign it an attachment group. Then, when you go to the gun json and assign a compatible attachment group—anytime you create a new attachment, if you assign it the same group, you don’t need to go back into the gun json and make it accept the attachment directly, because it accepts the group the attachment is in.
When you use attachment groups from the base mod, you ensure that your attachments can also go on the base mod’s guns.
Sometimes, manually assigning attachments is still useful. You can use either however you see fit.
Default Attachments
You can also assign default attachments for a gun.
"defaultAttachments": [
]This means that when the player obtains the gun, attachments defined here will automatically installed on the gun.
An complete example in a gun using compatible attachments, attachment groups, and default attachments:
{
"name": "ba_whitefang465",
"type": "Gun",
"maxAmmoCapacity": 30,
"compatibleAmmo": [
"ammocreative",
"ammo556"
],
"damage": 5,
"fireSound": "ba_whitefang465",
"fireModes": [
"AUTOMATIC"
],
"rpm": 700,
"gunRecoilInitialAmplitude": 0.2,
"shakeRecoilAmplitude": 0.35,
"shakeRecoilSpeed": 2,
"viewRecoilAmplitude": 1.2,
"sustainedRecoil": {
"posZCap": 0.16,
"posZIncrement": 0.06,
"pitchIncrement": 0,
"posYIncrement": 0
},
"compatibleAttachmentGroups": [
"ar_muzzle",
"ar_sightsandscopes",
"underbarrel"
],
"compatibleAttachments": [
"cantedrail"
],
"defaultAttachments": [
"ba_whitefang_scope",
"ba_whitefang_grip",
"ba_whitefang_suppressor"
],
"features": [
{
"type": "MuzzleFlash",
"effects": [
{
"phase": "firing",
"name": "muzzle_flash_big"
}
],
"condition": {
"allOf": [
{
"isUsingDefaultMuzzle": true
},
{
"doesNotHaveAttachmentGroup": "ar_suppressors"
}
]
}
},
{
"type": "PartVisibility",
"parts": [
{
"name": "flipped",
"visible": true,
"condition": {
"hasAttachmentGroup": "ar_sightsandscopes"
}
},
{
"name": "fsflipped",
"visible": true,
"condition": {
"hasAttachmentGroup": "ar_sightsandscopes"
}
},
{
"name": "rearsight",
"visible": false,
"condition": {
"hasAttachmentGroup": "ar_sightsandscopes"
}
},
{
"name": "frontsight",
"visible": false,
"condition": {
"hasAttachmentGroup": "ar_sightsandscopes"
}
}
]
},
{
"type": "Aiming",
"zoom": 0.3,
"condition": {
"doesNotHaveAttachmentGroup": "ar_sightsandscopes"
}
},
{
"type": "FireMode",
"fireModes": [
{
"name": "automatic",
"displayName": "label.pointblank.fireMode.automatic",
"type": "AUTOMATIC",
"rpm": 650,
"damage": 5,
"shakeRecoilAmplitude": 0.35,
"shakeRecoilSpeed": 2.0,
"shakeRecoilDuration": 350,
"enableFireModeAnimations": [
{
"name": "animation.model.switch",
"duration": 470
}
]
},
{
"name": "single",
"displayName": "label.pointblank.fireMode.single",
"type": "SINGLE",
"rpm": 650,
"damage": 5,
"shakeRecoilAmplitude": 0.35,
"shakeRecoilSpeed": 2.0,
"shakeRecoilDuration": 350,
"enableFireModeAnimations": [
{
"name": "animation.model.switch",
"duration": 470
}
]
}
]
},
{
"type": "Sound",
"fireSounds": [
{
"sound": "ba_whitefang465_suppressed",
"volume": 1,
"condition": {
"hasAttachmentGroup": "ar_suppressors"
}
}
]
}
],
"phasedReloads": [
{
"phase": "RELOADING",
"condition": "reloadIterationIndex > 1",
"duration": 1830,
"animation": "animation.model.reload"
},
{
"phase": "RELOADING",
"duration": 1830,
"condition": "reloadIterationIndex == 1",
"animation": "animation.model.reloadoneleft"
},
{
"phase": "RELOADING",
"condition": "reloadIterationIndex == 0",
"duration": 2470,
"animation": "animation.model.reloadempty"
}
],
"effects": [
{
"phase": "hit_scan_acquired",
"name": "tracer"
}
],
"inspectAnimations": [
{
"name": "animation.model.inspect",
"duration": 6980,
"condition": "ammoCount > 1"
},
{
"name": "animation.model.inspectempty",
"duration": 6880,
"condition": "ammoCount == 0"
},
{
"name": "animation.model.inspectoneleft",
"duration": 6980,
"condition": "ammoCount == 1"
}
],
"idleAnimations": [
{
"name": "animation.model.idle",
"duration": 100,
"condition": "ammoCount > 0"
},
{
"name": "animation.model.idleempty",
"duration": 100,
"condition": "ammoCount == 0"
}
],
"drawAnimations": [
{
"name": "animation.model.draw",
"duration": 720,
"condition": "ammoCount > 0"
},
{
"name": "animation.model.drawempty",
"duration": 720,
"condition": "ammoCount == 0"
}
]
}Attachment Groups
There are many attachment groups in the base mod. Some of which are useful for putting together sets of attachments for ease of use, and others are more useful for being named in conditions in different places:
Some of the more common attachment groups:
"ar_muzzle"
"ar_sightsandscopes"
"underbarrel"
"sights_group"
"m16_sightsandscopes"
"snipers_sights"
"smg_muzzle"
"hg_sights"If you open up other existing content packs and dig inside their gun jsons, you may discover more attachment groups. You’re also free to copy attachment groups from other attachments or guns that you know already work.
Complete red dot sight attachment from the official Blue Archive pack, featuring useful attachment groups:
{
"name": "ba_arius_aimpoint",
"type": "Attachment",
"category": "scope",
"groups": [
"sights_group",
"ar_sightsandscopes",
"m16_sightsandscopes",
"deagle_sights",
"snipers_sights",
"sl8_sights",
"sub_sight"
],
"features": [
{
"type": "Aiming",
"zoom": 0.35
},
{
"type": "Reticle",
"texture": "textures/item/reticledot_new.png",
"parallax": true,
"maxAngularOffset": 5
}
]
}Of course, you may also spontaneously create attachment groups, as mentioned in Attachments 2.
{
"name" : "vmw_m4sopmod_receiver",
"type": "Attachment",
"category": "receiver",
"groups": [
"m4_receiver"
]
}{
"name" : "vmw_mk18_handguard",
"type": "Attachment",
"category": "handguard",
"groups": [
"m4_handguard"
]
}{
"name": "vmw_m4a1",
"type": "Gun",
"maxAmmoCapacity": 30,
"compatibleAmmo": [
"ammocreative",
"ammo556"
],
"damage": 5,
"fireSound": "m4a1",
"fireModes": [
"AUTOMATIC"
],
"rpm": 800,
"gunRecoilInitialAmplitude": 0.2,
"shakeRecoilAmplitude": 0.35,
"shakeRecoilSpeed": 2,
"viewRecoilAmplitude": 1.2,
"sustainedRecoil": {
"posZCap": 0.12,
"posZIncrement": 0.04
},
"compatibleAttachmentGroups": [
"ar_muzzle",
"ar_sightsandscopes",
"underbarrel",
"m4_stock",
"m4_handguard",
"m4_receiver"
],
"compatibleAttachments": [
"cantedrail"
],
"defaultAttachments": [
"vmw_m4_stock"
],
"features": [
],
"phasedReloads": [
],
"effects": [
],
"inspectAnimations": [
],
"idleAnimations": [
],
"drawAnimations": [
]
}