Is there a way to cast HUDs dynamic material instance parameter for MaxTimeCast from Blurprints?

I’ve got a dynamic material instance set up in my HUD that displays a spell meter; functionally, the exact opposite of a cooldown bar - it fills up once a spell is ready to cast. I’ve got it more or less working, with emphasis on the less. Here’s my material setup:

I’d like to be able to change the parameter MaxCastTime on the fly. Even though its a poor naming convention, it is essentially the “full” or ready to cast state, and since cast times will change, it needs to as well.

Right now, it works. sort of. When casting a spell with a 1 second cool down, it works as intended. When casting a spell with a 2 second cooldown, it will remain static for the first second, and begin to diminish for the remaining second.

Is there any way to cast from the Character blueprint, to the huds dynamic material instance parameter for MaxCastTime? Here’s a video example of what I am talking about if I am being unclear: - YouTube

The first spell has a 1 second cooldown, while the second has a 4 second cool down. I tied the event that decrements the spell timer.

Just to be clear

  • TimeToCast = time remaining until cast is active
  • CastTime = delay after one cast is done (ie 4 seconds in second case)
  • MaxCastTime = ???

correct?

In this case I belieave you only need the percent filled value inside the Material. (ranging from 0.0 to 1.0 = empty to full)… Since the width of the bar is constant for all the spells.

So in the blue print, after in each tick, calculate CastFilledAmount = (CastTime-TimeToCast)/CastTime
Then you test the value of CastFilledAmount against 1.0 and set Cooling Down to FALSE. So you wont need the everything to the right of Setting Cooling Down to TRUE.

Inside the material expose FilledAmount scalar parameter (you will set this to CastFilledAmount). You wont need to divide it or clamp it since its already calculated and is in the rane 0.0 to 1.0.

And use MaterialParamter Collection to change the material parameters from blueprint:

Refer this:

Sorry if I misunderstood your requirement.