Behaviour tree tick timer

Hi guys,

Im creating an AI enemy that runs away from the player constantly and if the player fails to kill it within a certain amount of seconds it kills itself and the play doesnt receive loot.

26132-behaviourtreerunner.png

I created 2 services and in the AI_ReduceTimer I want to subtract 1 second of the remaining time. Now I thought I was able to increase the “tick every 0.40s 0.60s” to like 1 second so that it only gets called every second. This however doesnt work…

Does anybody know how I can make sure that single service(AI_ReduceTimer) only gets called every 1 second, while AI_RunAway(which calculates the position the AI should flee to) is called a lot more.

Thanks in regards,

Falko

Hi Falko,

Thank you for your report. I have attempted to reproduce this in my own project in 4.6.1, but I am not having much luck. I set up two basic services that will simply count down, but made them set to different tick intervals (One ever second, the other every half second). They print a string each time they are called. There is some deviation due to the settings, but otherwise I am getting a 1-to-2 ratio.

Can you tell me which version of UE4 you are using? Can you give me more details of what in the the service’s event graph? Any additional details to how you are reproducing this may help.

Thanks!

Hey ,

I have recently updated to 4.6.1 also yet it still seems to go wrong.
My services are setup this way in the behaviourtree:

AI_RunAway

  • Interval: 10.0
  • Random Deviation: 0.0
  • Function calculates a certain position where my ai should flee to

AI_ReduceTimer

  • Interval: 10.0
  • Random Deviation: 0.0
  • Function should reduce the amount of secondsremaining(float) and when its 0 it removes the AI

However when I put the AI down and I start the game, within 1 sec I receive multiple strings in my screen(coming from the functions) and than the AI is already removed(since the function is called multiple times)

if im correct the tick function should only call the AI_ReduceTimer once every 10sec now correct ?

Can this have something to do with it:

if (HasAnyFlags(RF_ClassDefaultObject) == false)
{
static ConstructorHelpers::FClassFinder<AAI_VoodooEnemy> PlayerPawnBPClass(TEXT(“/Game/Blueprints/AIBlueprints/AllBlueprints/AIVoodoo”));
if (PlayerPawnBPClass.Class != NULL)
{
EnemyClass = PlayerPawnBPClass.Class;
}
}
}

which I use in the AI_Controller

It doesn’t seem to be related.

I was able to reproduce this error somewhat, but it is not consistent with my set up. Some times my countdown works fine and other times it prints the countdown immediately, then finishes.

There is a bug here and I am still looking into a 100% reproduction, but it may help me if you post a screenshot of the contents of your services so that I can recreate them exactly. I will keep trying to find the cause and will update you if I get a consistent repro.