How to Make Entity Choose Between Flying and Walking

Started by SilentStarling on

Topic category: Advanced modding

Active 2 years ago
Joined Jan 2021
Points:
602

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 9
How to Make Entity Choose Between Flying and Walking

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.

Active 1 year ago
Joined Aug 2022
Points:
303

User statistics:

  • Modifications: 1
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
make it choose, first by…
Wed, 10/26/2022 - 17:08

make it choose, first by making a flying entity and a ground entity. When it touches the ground it changes into that form, and backwards if it falls i guess.