FireTimer doen`t change output (Turret fires at constant rate)

Hello, people!

Still fighting against ceaseless projectile spawning. I tried to change “FireRate” variable in BP and cpp and in game details, but my turret still fires like a laser!

Could you at least tell me how to debug the line below?

GetWorld()->GetTimerManager().SetTimer(FireRateTimerHandle, this, &APawnTurret::CheckFireCondition, FireRate, true);
(in lecturer`s Git code it is identical), but I want to know its output.

UE_LOG doent want to take a value from "FireRateTimerHandle", tried: .ToString(), than %f/%i, but compiler doesnt want to finish.


P.S. I somehow randomly highlight words, sorry for that, don`t know how to fix it.

What output are you trying to get from that?

What FireRate do you have in the blueprint?

Thanks for attention.

  1. Any output, I want to understand changing happening inside, I mean how often the timer changes.

  2. The same value. I even wrote BlueprintReadOnly, but it is still firing endlessly.

  1. FTimerHandle is just the handle for the timer, it has basically nothing on it. Think of it as a key for the timer manager, the functions you want are on that
    FTimerManager | Unreal Engine Documentation
    where you would pass in your handle e.g.
     float ActualRate = GetWorld()->GetTimerManager()->GetTimerRate(FireRateTimerHandle);
    
  2. BlueprintReadOnly/Write is for the blueprint graph. Removing that wouldn’t have affected anything since you aren’t using it in blueprint code. Visible/Edit are responsible for showing it in the editor.

Hi @Ivan_Bakaev
You have CheckFireCondition() included in your Tick() function which means that turret fires every game’s tick. Remove it from here and it should solve the issue.

2 Likes

Well I’m blind I guess :sweat_smile:

Haha, happens to every one! :slight_smile:

Sounds logically) As far as I get home I’ll check)

Thanks! A new idea is always welcome.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.