Download

Program NPC behavior

Hi. How to program NPC’s behavior? I want them to do different things at different time and each of my NPC have their schedule.
Could you please help? What should I do?
Many thanks, hope it is an interesting thread to many of us.

Basically the same basics as programming enemy AI. https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=0ahUKEwjWvJ6MkebLAhWGw4MKHTEIACgQtwIIMDAC&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkQ8i9Sxw33g&usg=AFQjCNFBcbcWGBGCqYReI5UUV1gwojehtg&sig2=mwqFaI_e9kK5qwiuygzEEQ

It doesnt even give me an idea on how to program a complex behavior.

How write a blueprint/script so

  1. Everyone is going to some direction at 8am.
  2. Some character, e.g Dageron goes to bathroom, plays teeth brush animations for 30 seconds and then goes to X?

Your talking about writing a scheduler. There isn’t anything specific to UE4 for doing this, your free to write it how you want. There is no built in system for this.

Okay. I want to write it easily. Could you please explain how?

Could use a Behavior Tree, if you want a lot of complex things.

I’ve got an NPC with a very simple schedule, though, and it’s handled in his personal AI Controller. I put down a bunch of target points on the map, and when the AI Controller starts running it makes a reference for every one pf them and sorts through them one at a time. When one is sorted and selected, the NPC walks to said target point and plays an animation, ponders the mysteries of life for a few seconds, and then walks to the next point and so on in an endless loop.

In theory, making a schedule shouldn’t be any different from making an enemy’s average routine, e.g. wandering or patrolling, investigating suspicious activity, chasing and attacking, etc.

@LetoDeath

Sorry, I can’t explain how easily to make a good one. It’s programming.

As a quick and dirty, use the Timer Node and set the task to perform at the time you want. But, that’s not a full system, that you can make changes to, put a stop on etc.