Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Trying to make an AI hunger and eating system

I want a group of sheep to roam around randomly within the characters proximity, and while they do randomly stop and eat. I have gotten them to move, not fluidly yet but where I am absolutely stuck is making them stop and eat.

I have made an internal system for hunger but no matter how I mess with it I cannot make them stop eating and roam again because hunger replenishment is broken. I assume I am calling things in wrong order or something.alt text

Product Version: UE 4.12
blueprint.jpg (172.9 kB)
roaming.jpg (264.5 kB)
eating.jpg (365.9 kB)
more ▼

asked Jun 14 '16 at 07:57 PM in Blueprint Scripting

avatar image

van Rhyn
3 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Can I suggest another method for doing this?

alt text

eating.png (253.7 kB)
more ▼

answered Jun 14 '16 at 10:42 PM

avatar image

596 28 24 52

avatar image van Rhyn Jun 15 '16 at 07:03 AM

Hey Vaei, thanks for the suggestion. I tried it out but it also doesn't quite seem to work the way I need it to. The hunger float is what seems to continue to be the problem. Hunger properly goes from 1 to 0 to 1 now, however it would be nice if I could make it pause on 1 or 0 for a period of time. The 'Stop Animation' is definitely going to help, though I can't seem to make playing the eating animation wait until movement has stopped. Also Stop doesn't seem to fire on 0, the movement starts up again however the eating animation still plays. Thanks for the help so far, hoping you have some more suggestions.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Of course. You are going into Hunger code on Event Tick. It has nowhere else to go. I suggest adopting Behavior Trees instead of your current approach. Also, watch this series, they implement Behavior Trees, Hunger system and more.

more ▼

answered Jun 15 '16 at 11:42 AM

avatar image

Nick Jackson
492 17 14 107

avatar image van Rhyn Jun 17 '16 at 03:19 AM

Actually I have given that a watch, and although entertaining, I found it very hard to follow. I'm sure it's very comprehensible if given enough time and patience. So now that I've learned a little on my own about what to do and what not to do I might give it another go. Thanks for the suggestion Nick.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question