How to Make Entity Choose Between Flying and Walking

Started by SilentStarling on Tue, 01/19/2021 - 01:53

Topic category: Advanced modding

Last seen on 16:24, 20. Feb 2021
Joined Jan 2021
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to Make Entity Choose Between Flying and Walking
Tue, 01/19/2021 - 01:53

Sorry if this was repeated anywhere, I tried searching beforehand.

I am trying to make various insects (roaches, crickets, etc) who would both walk and fly. When I tick flying entity in the behavioral tab it makes them hover around and never land. When I give it the fly option and the walking option in the AI when it's not a "flying entity", it doesn't fly at all. I want the entity to choose between whether it's going to walk or fly. I thought I might be able to do this as a walking condition, or a flying condition, in the AI. However I'm having some trouble piecing it together in my head.

-Can I make it switch between walking and flying in a boolean-style if/else statement? Example: (check: is entity flying. If yes, make it walk. If no, make it fly)
-Can I make it do a check like this NOT every tick? Switching from walking to flying every tick would be terrible, could I make it wait a certain number of ticks before checking the condition again? I see there's a "repeat _ times, do ___" type of procedure, would that be what I use for something like this?

Sorry if this doesn't make much sense, my coding knowledge is pretty basic. Let me know if I need to clarify anything.