AI tank movement problem

Hi all,

Everything was working fine untile I have changed the AI Controller as a part of refacoring lecture. The AI tanks are not moving at all now after the compilation even when my tank moves. The most important part is that I have weird error coms out at te beginning and olny once:

And my code:

But I think that it only appear once and the function has been commented out from tankAiController. What is weird I am not able to see the logs coming from the AI tanks when I was trying to debuge. It’s like the Tick is not working at all. Anyone have an idea what’s going on :)?

Code for AIController

1 Like

The error message is due to the code you wrote

if(!ensure(Barrel)) { return; }

And what logs? You don’t have any logs in the AIController::Tick

I don’t have logs as I removed them. I will add a screenshots and try describe better what the problem is.

I know that the problem matching that line of the code. Problem is that I was desperate so I have copied code from the slides and now it’s exactly the same and problem still appear, but Only once, what is weird - The game works fine, tank is aiming ,barrel moves. only AI tanks are not moving.

There are screens with logs:

Firing works, Everything works, just there are no logs, so it’s like the tank is not ticking at all.

There is also weird problem. When I am trying to open TankPlayerController_BP I have hard Crash o.O…

Been a bug since 4.13+, the PlayerController tick function gets called in the blueprint editor. Meaning if you have any code in your tick function that would call GetPawn() would return a nullptr since it wouldn’t exist in the world yet.

Also your UE_LOG is after the ensure check. Meaning if that failed the UE_LOG wouldn’t execute. So either PlayerTank or ControlledTank is nullptr

Right so it means that I have to use github repo to clone my project to the state before I was moving projectile as it was ticking then. It means that projectile in BP has to be removed before changes then. I will try it soon and let you know if it solves the problem. It’s nice to refer to it somewhere in the lectures as many people like me uses newest version…

No, it just means in order to open the blueprint just add this code which I think ben adds in the next lecture.

void ATankPlayerController::AimTowardsCrosshair()
	if (!GetPawn()) { return; } // e.g. if not possessing

So one of two problems solved as still my tank is not ticking. Seems like I have to live with it…
Just to make sure I have moved Log before ensure and still I have the same problem, Its not printing anything at all.

Do you have your project on github or anywhere else?

yes, I just went really simple way of trying to understand where the problem is. And…

This part has been NONE…!!! I have no idea why and when it has changed and I am really stupid that i haven’t checked it at the first time… Sorry for the trouble and it’s sorted now :confused:


FYI, just thought I would check and this has defaulted to NONE on the AI Controller Class for me too, following refactor


Privacy & Terms