I've been using Unity Visual Script (previously Bolt) for around five years now, and I'm still constantly at a loss while trying to find tutorials. So, I thought I would show off some of the (most likely wrong) ways I've done things while building my games with VS and hopefully you all can figure out something better through this. Today, I'm going to take you through how I made breakable buildings in Nuclear Lizard Island Rampage.
We're going to go through the script that makes the common house smashable, starting with getting smacked.
The house has a regular mesh collider to make sure things don't just bounce through it, but it also has a mesh collider toggled to be a trigger. I made this a little bit sloppy, and each different thing that can cause damage to a building has a different tag, which leads to a branch list like the one on the left in the above picture.
Each branch checks for a different tag, like the Attack tag that is attached to the lizards arm. So, if the lizard takes a swing at the house and makes contact with the damage trigger, this fires.
After it checks the tag, there is a cool down block in the flow to keep the script from firing multiple times per strike. If that isn't there, each punch could count as multiple collisions and take the health of the building lower than I'd like, but with it there, the house can't take slap damage for another 0.5 seconds.
After the cool down is a little audio clip so the player can hear that they hit the building. You could also do this with an Audio Source attached to the building, but I wanted to quickly slap this script on a lot of things and not take the time hooking up extra things to their prefabs. After that, we set the buildings health after the strike by getting the current health (an object specific variable integer) and subtracting the force of the lizards punch. This one is a Saved Variable because the player can upgrade their lizard and make the punch force stronger, but for something like explosion damage, it can just be a flat integer.

Collecting the input from all the separate ways a building can take damage, we come to the Death Check. If the builds health is not lower than zero, we branch down and temperamentally set the Renderer Material to a material I made called Damage, which is just a bright, blank white. Then it sets it back to the buildings regular material after 0.1 seconds. Effectively, the building will flash white when struck, giving a nice bit of visual feedback.
Again, I didn't want to be hooking up a lot each time I attached this to a new building. So, on the right side of this image you can see another part of the script that fires once the prefab is loaded into the scene. It creates a new Object Variable called Texture, grabs the regular material attached to the prefab building, and that's what the script will reference at the end of the white flash to get the house looking back to normal.
If the building health is 0 or lower, then we move on through that cool down seen on the left. Again, using the cool down to this script can't fire multiple times. I don't want it to spawn multiple ruins.
Next, I Instantiate a broken copy of the house (saved as an object variable called Broke) exactly where the current copy of the house is, grabbing the position and location so I can place these all around the scene and the ruin will always show up in the right place. There is also an Empty object stored as an object variable called Civi_Spawn attached to the house right in front of the door, and when the building breaks it spawns a little person (Variable Civ) to run away from the ruin.
Since there is a brief collision between the parts of the broken house with Ridgidbodies and the existing house, the ruins often "blow up" when they're spawned in, which I like. So, I left it. If I wanted to avoid this, I could have created a partent prefab that controls both the house and broken house instead of attaching everything directly to the house. Again, more work.
Next there is a little area where we raise the players score, which is saved a Scene Variable because I wanted it to be accessed by multiple scripts in the scene, but I wanted it to get wiped at the end of each round. Each building has is own score saved as an integer as the Building_Score that gets added to the main score upon destruction. After that, on the right hand side, there is a Custom Event block that sends the message "Points Added" to an object in the scene that I call the Dungeon Master. This is an object that holds at lot of different scripts and controls a lot of things. When it recieves the message "PointsAdded" it will update the points section of the UI to reflect the variable Current_Score so the player can see that they've got points for smashing up the house.
Then there is a very brief delay to make sure everything else in the script has had a chance to fire, all the messages got sent, audio played, etc, and then the house is destroyed. Since the Destruction script is attached to the house, this means that nothing in the script will function anymore after this block has fired, but it shouldn't have to. At this point, the house should have taken damaged, given some visual and audio feedback, raised the players score, and then replaced itself with a wrecked copy. If you want to see it in action, check out the Nuclear Lizard Island Rampage trailer.
Anyway, thanks for reading. If you liked this and want more remember, I work on tips. Maybe buy the game or just throw me something on Ko-Fi and I can justify making some more Visual Script write ups.