Pretty simple print string question.

So I’m not a programmer and have only a little idea on how BPs work, however I am messing around with AI and watching Tesla’s tutorial on pawn sensing I have made a pretty simple blueprint where he detects me and follows me. And I have added the function to print a string that says “Player spotted” when he detects me. However the string just keeps infinitely printing. And I want this to print just once but I want him to continue following me without it printing again and again. I’ll attach some pictures.

Hope you can help me out!


Would try … but I can’t see your attachments. 8-{

I’m sorry. Please try now.

Cheers. :slight_smile:

Okay so as far as I understand … Pawn Sensing is triggered as long as there is something to sense … and it will continue to trigger. That is why you are getting the string repeated the entire . At least this is my understanding of that event.

try the “DoOnce” node and reset it when the AI cannot see the player anymore :wink:

Hi ninja move

qdelpeche is correct. By nature it senses every 0.5, if the sensing is working, then it will run the script again.

Run a sequence and the run a do once.


Okay so I did as you guys said and now he prints it just once so I guess that bit is solved, but then he stops following me after a while and then doesn’t detect me anymore even if I’m right up at his face. :confused:
Do you guys require screenies of some other stuff as well? For now I’ll attach my blueprint.

You shouldn’t put your AI Move To on the DoOnce … only the Print String. 8-}

Awesome. Worked like a charm. So now he prints it once and follows me around. However when I go out of detection and come back, he does detect me and follows again, but doesn’t print “player spotted” once more. Olli said I could reset this. How do I do this? I tried plugging the end to “reset” but that just ended up infinitely printing it once more.

Now you are getting into an issue with UE4

There is now way to properly detect when Sensing stops.

There are many ways around it.

I have implemented one way, but may not work, but give you a hint.

I needed to set sensing at 0.1, and that worked for me.

What I did, is off a sequence, I set a delay up of 2.5 seconds. I then set a bool to say not sensing. If he is still sensing then it resets after 0.1, so no real delay.

Off your event tick, have another sequence, put in a delay of .2 for example, if after .2, he is still not sensing you, you can then reset set the do once.

Way above my level of understanding, but thanks for the step by step explanation. I guess I’ll have to learn the basics of BP first and then I can apply this. :confused:
Thanks for helping out everybody. :slight_smile:

Cheers. :smiley: