My character has 2 distinct attacks, a tail whip and a butt bash, the tail whip will be used mostly to enemys while the butt bash is mostly for breaking hard objects, as my game will have many generic breakable objects I need a simple way to on the character > is buttbash? > is on breakable objects > deal damage to break object (where the objects has say 1 health and the buttbash does 1 health of damage) I don’t want to have to deal with complex is buttbash> is this object 1 through 1000? > deal damage since this will get very complex and has been what i’ve done on past projects and it consumed way too much time.
So is there a way I can have on my character a set of blueprints to > is buttbash? > is on breakable objects > deal damage to break object.
set up something that can easily be applied to any object at the asset browser level so I can just drag and drop it in and have the game know its a destroyable objects only by my characters buttbash ability?
If someone would be able to print screen a blueprint setup for this that would be great also, and if theres anything complex like some weird math or what ever just explain why its there? so I can learn from it rather just a copy paste done.
Sort of. First I would start out by creating a couple of your own custom “DamageTypes” - one for each type of attack. That can be done by creating a new Blueprint class and expanding the list until you see “DamageType” like I show on the right (below). You’ll find a couple interesting properties in these, such as how much impulse to send to a destructible object - but just know that the name of the blueprint is probably the most useful part for now, and you can extend functionality in these things like anything else in the game later on. Make one for each attack you got.
The reason the name is important is because when you character does an attack and you detect than some random object was hit, the Apply Damage node (and others like it) will accept a DamageType class as an input. (Top left in image). That’s a way of communicating with Mr Clay Pot “Hey foo, you just got butt bashed son”. A tail whip attack can send a different DamageType designed specifically for it instead.
Right - so on the receiving end, the Events which get triggered when damage is applied also have an output pin for DamageType. That would allow you to test the damage type before determining whether or not to branch off into a shattering effect, or maybe even ignore the damage altogether. Make sense? No fancy math required. [Side note: When your enemies take damage this way, you could make the whip damage reduce their health … but maybe the butt bashing causes them to get stunned. Lots of things this technique can be used for when you see it in use].
As for saving time, I would suggest creating a parent blueprint class for all placed objects that can be broken - and catch the damage type handling logic up there. If the damage type = a butt bashing, call a function to handle what happens next. But if the damage type = something else, then call a different function or dont do anything. From that parent you can go create any number of children which act like pots, or crates, or whatever else you want to smash up. But if you ever wanted to come back and change this behavior, you can fix it up in one place instead of having to go modify 100 objects. You were kinda on the right path… I’m sure other folks have their own solutions that would work too, but this way is pretty straight forward.