I have a bush that you can light it on fire.
After that I have a script for checking if the player is in the collision box while the fire is activated.
Problem is that, when I exit the box while the fire is still on, and I re-enter the collision box, the health doesn’t decrease, I need to get the bool values of enable input and activate, branch them to see if both of them are 1 or true, and after that, deplete the health, but I have no clue how to compare the bool values from them.
I’m trying to convert the script to using the damage functions such as ApplyDamage but I’m still in need to check both values for positives.
Another, thing. Can I somehow change the increment values only BP wise, because if I double click the increment value set it to 0.1 it changes on all of my BP. I wan’t to have various damage values for different BP.
This fixed my decrement/increment problem, thank you.
I don’t use ticks, as I’ve heard they can be FPS restricted.
I just need a way to compare if the activate fire, and overlap box are true at the same time.
Helpful answer btw.
It’s probably better to have all the inputs in the same blueprint, like the PlayerController class, instead of having the input events directly on the bush. From there, you either grab a reference for the bush with GetAllActorsOfClass or GetAllActorsWithTag to set a bool variable in the bush.
On the bush itself, it’s just a question of setting the bools and proceed to the health decreasing code. As an alternative, you can also use a looping timer for the decreasing health
To do an increment of your own size:
Also, the Timeline loop seems odd, when finished, you always just restart the timeline again, is this correct? I don’t think that Stop calls the Finished function on timelines so you should be okay there anyway.
Use variables in your code. For e.g., you might want to have a IsOnFire bool variable and a DamagePerSecond float variable in your trigger. On activation / deactivation just set the IsOnFire bool variable in the trigger
Then in the tick function of the trigger, grab all the overlapping actors and send damage events (if IsOnFire is true). The damage you send per tick would be DamagePerSecond multipled by the DeltaTime you get from the Tick event
If you want to customize the damage per instance, make the DamagePerSecond variable public (by clicking the eye icon next to the variable name in the list)
I’ve just started with blueprints yesterday and quite honestly I got lost halfway through your answer, guess I have to get a bit more practice
Ok then. from your blueprint just replace the Enable and Disable Input with a new bool variable. On your input events, branch to check that bool, and then if true, activate or deactivate it.
Also, select the Z and X key events and in the Details tab, make sure Consume Input is checked. I think it might work that way.
Edit: this is just to turn the light on. But the radius to turn on the fire isn’t the same as the radius to burn the player is it? So, I think you have to add another trigger, a smaller one, to start and stop the timeline
Hope I’ve been clearer
Just made this before you replied.
Don’t know whats wrong with it, health doesn’t deplete.
This fixed my problem, now when I reenter the health depletes again, but the fire doesn’t need to be on to burn me. Ahh the magic of coding, fix something to break something else
Fixed it completely, thank you very much.
Yes, you have to check if it’s active when the player steps on it. Here’s my solution with 2 triggers and a timer, one to activate the fire, and another to burn the player, in case anyone needs it too