How can I make it so my pawn, when overlapping two actors, takes damage? I would like to accomplish this in my character blueprint. This way when two actors hit my pawn, it takes damage, for example like when a pawn is getting crushed between two actors it will take damage. But if it hits just one actor, no damage is taken.
on hit or overlap, if hit1=false, then set hit1=true, if hit1=true, then set hit2=true
somewhere in event tick: branch(fed by an AND node with both hit1 and hit2 fed into it) under true do multicrush action
How can I do that when there is only one module for “Hit”?
Should I be using a BreakHitResult?
you create a variable called hit1 and hit2, its not built in.
basically, if the player gets hit(or overlapped) set a variable to true, if both of those variables are true the AND node will trigger the branch to true and thats where you do stuff.
This is where I am at:
The tiles have a box collision on them
In the character blueprint, I am using beginoverlap and endoverlap to decipher when the event holds
I don’t know how to link up the collisions to this for being the “hit1” and “hit2” variables that I created
Rather than put a collision on each tile, since each tile already collides as it is, could I just do when the two tiles hit my pawn it destroys? Using what variables, how would I do this? Is it still the same hit1 and hit2 variables that you describe?
MrGrr gave you the right answer, but to clear things up for you, this is how I’d do it:
Warning, the way exposed here is by no means efficient, nor scalable to more platforms without adding boring stuff
(I see that you have, for some reason, Platform1 and Platform2 as different actors, so I will)
Within character BP, we create 2 variables. Is_Hit_By_1 and Is_Hit_By_2. (Use whatever name convention you like more)
Both should be boolean and false by default. Now, on the event graph, something as simple as this will do the job:
Note that the damage function is trivial in my example, as it is meant to show you where you’d put the Damage function
Now for the platforms. Again, this is not the best idea if you plan to add more platforms whatsoever:
I would suggest adding, between the event execution and the cast, a check to know whether or not the actor overlapping the trigger is the player, even if the cast will only not fail if it’s the player the one stepping in /out
And finally, platform 2, which only differs from Platform 1 in the variable it edits, Is Hit By 2 in this time:
Seeing that you struggled with the solution offered by MtGrrI, I tried to be as clear as possible. If you have any doubts, just ask!
Your blueprints make good sense of what I am trying to accomplish. However I cannot “kill” my pawn using damage because I cannot find a place to edit a damage limit on my pawn. Would a good alternative be to trigger some animation upon damage that equals the value on the applyDamage node? Or instead of adding a new animation just making my player go ragdoll: Maybe to simply remove all controls of the player by using setIngnoreMoveInput, SetSimulatePhysics, and SetAllBodiesBelowSimulatePhysics
Also, for the AJUSTAR I just right clicked and added a SetIsHitBy1(2)
For damage related stuff, you might want to check "Damage in UE4 - Unreal Engine"this blog about damage in Unreal 4
Yeah, sorry for the language thing, I forgot to change it before the screenshot!
Yeah. just make sure you are setting the right variable for each platform. But again, not a very scalable solution
For a box collision in a blueprint, how would I set it to destroy anything that it touches? (a pawn, a mesh, an actor)
The best way to ask new questions unreleated to the original one (Even if it is sligtly releated, like in this case) is to create a new question, or to find already answered similar questions, mostly on the docs.
Either way, as stated [here]
you want to use Destroy Actor, target being the actor reference on the event OnBeginOverlap, as seen here:
And on the actor to be destroyed, you can do pretty stuff with it (Adding cosmetics) with the event “Destroyed”