Muzzle Flash
Muzzle flash is a feature that goes inside the features code block.
It would look like this:
"features": [
{
"type": "MuzzleFlash",
"effects": [
]
}
]As the name implies, this feature allows you to add a muzzle flash to the gun. Useful for adding custom effects, like a plasma blue flash, or even just a bigger flash, perhaps for a powerful sniper rifle.
This is the alternate way of adding a muzzle flash for the gun if you want to make it conditional. For a basic, non-conditional flash, see: Effects Overview
A more complete example:
{
"type": "MuzzleFlash",
"effects": [
{
"phase": "firing",
"name": "muzzle_flash_big"
}
],
"condition": {
"allOf": [
{
"isUsingDefaultMuzzle": true
},
{
"doesNotHaveAttachmentGroup": "ar_suppressors"
}
]
}
}For this example, the muzzle flash consists of "effects" and "condition".
Inside "effects" you specify which effect you want. Here, the code uses an effect called “muzzle_flash_big”.
Inside "condition" there are actually two conditions, both of which active under “allOf”. When conditions are listed under “allOf” this means each condition needs to be true for the mechanic to activate.
First condition is "isUsingDefaultMuzzle" which is set to true.
This condition allows the gun to account for whether the gun uses the ‘muzzleflash’ bone in the Blockbench gun model.
Second condition is "doesNotHaveAttachmentGroup" set to look for “ar_suppressors”.
This condition allows for the gun to account for whether gun doesn’t have the “ar_suppressors” attachment group.
Together, the conditions allow the gun to have the “muzzle_flash_big” effect if the an attachment from the attachment group “ar_suppressors” isn’t installed, and also if the gun if the gun uses the ‘muzzleflash’ bone. Suppressors in base VPB have their own muzzleflash bones, which means when it’s attached, the gun should use the suppressor’s muzzleflash bone, not the gun’s muzzleflash bone.
If you’re making a basic plasma gun, like the kind you’d see in a sci-fi pack or the Doom pack, where attachments aren’t a concern, you can simplify the code like this:
{
"type": "MuzzleFlash",
"effects": [
{
"phase": "firing",
"name": "ggo_blue_flash"
}
]
}To see how to create custom effects, including colored muzzle flashes, tracers, and animated sprites, visit: Effects Overview