I don’t need the event tick here, so I’m checking every second the Enum state to swap between the niagara I need, is it a good way of doing this?
I feel like I could call the “HeatMode” event only when I need to swap but I don’t know how to do it.
The idea is that the heat mode get swapped every now and then, so the check every second looks like a waste of resources to me.
You need an event dispatcher and then call the event in a function or bp
Hey hello @BlueTitan99 how are you?
The way you’re handling it isn’t bad — sometimes it’s just easier to have a timer check every second and update things accordingly. Just keep in mind that a 1-second delay can be noticeable to the player and might look a bit off.
The best way to handle it is like @name235711 mentioned:
Create an event dispatcher and bind to it on BeginPlay. Then, when the enum changes on the character side, you dispatch the event — this way the swap happens instantly, with no need for a timer or tick.
I’m looking some tutorial for the event dispatcher, and for me it looks like a system that I use to make communications between different blueprints.
In my case all happens inside my character bp, after checking the “heat” I just swap the niagara asset attached to my capsule comp.
What am I missing? Sry I’m still new to unreal and finding the right tutorial sometimes looks rly tedious.
@BlueTitan99, sorry, my bad, I thought the ‘Heat’ variable was in another blueprint.
Where are you changing the variable then?
You could create a function like ‘UpdateHeatParticle,’ and every time you modify the ‘HeatMode’ variable, you call ‘UpdateHeatParticle.’
But maybe I’m misunderstanding. Is the ‘HeatChecks’ function calculating or returning the ‘HeatMode’ based on other variables?
Well imo, if you are setting enum variable to something and after that you are checking if there is a change to set niagara.
You can just make a function with SetHeatState, pass enum there and it does the rest.
I manage the heat like a sort of stamina:
Here the Sliding increment the “heat” variable
Here over time I lose heat
And this is the heat check
Pls be patient I’m trying my best 
Every time you change the value of heat you need to call heat check. You should have a variable to store the heatmode value.
In heat check create a “Local” variable “NewHeatMode”. Run a sequence Node at the beggining of your heat check function.
e.g. Heat Check → Sequence…
On Then 0 run your current logic and Set the NewHeatMode variable.
On Then 1 compare it against the currently applied heat mode value
HeatMode != NewHeatMode : Set HeatMode (NewHeatMode), call Interface/Dispatcher event, exit function, Else… no changes needed exit function
@BlueTitan99
Hey, thanks for the code. Like RevOverDrive said:
The proper way to handle this would be to create a function to set the Heat variable (instead of modifying it directly), and inside that function, after updating the value, call another function to update the heat and swap the effects.
Thank you so much guys I think I got it and maybe learned a lot here too:
First I created a function called when I change my heat:
I added “gain” and “lose” inputs so I can declare how much I’m losing/gaining when I call the function (for every function changing the heat I can manually set these values, not a problem), so I check if i’m losing or gaining heat so that I can clamp the value between 0 and 100, then I call the new other function “heat check”
Here I just did what RevOverDrive told my I think, I started today to learn Interface/Dispatcher and since I’m doing everything inside my CharBP I can just call for the last function (correct me here if I’m wrong).
Just swapping niagara, not a lot to see here.
So thanks to you maybe I learned how to do all this only when I need.