What is the node or logic for calling the Apply Damage node in a loop? Thanks in advance
Could you clarify? Because it sounds as if were looking for the Loop
node. Do you want to make the damage tick - be applied, let’s say, 5 x per second? A loop node will not help you here.
Sorry if I expressed myself wrongly, I mean that when my character is in contact with capsule collision always receive damage
This is still unclear. What does always mean? I assume you mean continually - is that so? How often then?
It’s not a good idea to base on a framerate since different end user machines would apply varying amount of damage. The most standard way is to use a Timer
, if you fire it 30x per second, it will be pretty much indistinguishable from continues damage. You could even apply if once per second and interpolate the result.
yes i mean continually, but i will try to set a 30-second timer like you said.
Once again Thank You
I am currently working on a 2D platformer, but I encountered a problem. I created the HealtBar logic, but when my character has zero life, the Destroy Actor node doesn’t kick in, I don’t know why. Do you have any suggestions on this?
- it’s not safe to rely on == with floats. Try:
Ideally, also check it it’s below zero.
-
I am a bit confused by the script, though. You seem to keep health in a character but attempt to destroy the BP you’re showing.
-
also, you’re casting the Controller to Pawn (?), which makes no sense and will never work - the cast probably fails - could you double check?
-
if this script is already in the Actor we want to destroy once its health goes below the threshold, there’s no need to cast, just call the function directly
-
and lastly, you call it on Begin Play - how is this supposed to count health if it only happens once, when the actor is spawned. Did you mean to hook it to a node that triggers when damage is received?
So yeah, lots of things are going on that I do not understand. Under regular circumstances, the player character would have something along the lines of implemented:
I am ignoring the Damage Type
pre-processor which should be probably involved in all this. It might be too early for this.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.