Wandering Bird

Type: Animal Brain
Level: 3 star
Pages: 1
Description: This brain is designed for flying creatures. It creates a constantly flying bird which is supposed to circle a patrol area. However, the bird generally flies off very high and completely disappears from view within a few seconds, only coming into view occasionally.

Kode

  1. WHEN [once] DO [team][equals][team 4] // not sure why it is set at 4
  2. …WHEN DO [vectorvar: patrol center][equals][position]
    Set up speed variable
  3. WHEN DO [move][with flying][at speed][numvar:speed]
  4. WHEN [countdown timer][5][loop][trigger on start] DO [numvar:speed][equals][random number][0.5][to][2]
  5. …WHEN DO [numvar:turn time][equals][random number][1.5][to][3] // time between turns
  6. WHEN [moving]
  7. …WHEN [duration timer][numvar:turn time][loop]
    Set up random turn direction
  8. …/…WHEN [started to] DO [numvar:turn direction][equals][random number][1][to][2][as integer]
  9. …/…/…WHEN DO [altitude direction][equals][random number][1][to][2][as integer]

    Set up patrolling area

  10. …/…WHEN [(][position][x][plus][100][less than][vectorvar:patrol center][x][)][or][(][position][x][minus][100][greater than][vectorvar:patrol center][x][)]
  11. …/…/…WHEN [duration timer][0.75] DO [turn][toward][vectorvar: Patrol center]
  12. …/…/…/…WHEN DO [numvar: turn direction][equals][0]
  13. …/…WHEN {(][position][z][plus][100][less than][vectorvar:patrol center][z][)][or][(][position][z][minus][100][greater than][vectorvar:patrol center][x][)]
  14. …/…/…WHEN [duration timer][0.75] DO [turn][toward][vectorvar: Patrol center]
  15. …/…/…/…WHEN DO [numvar: turn direction][equals][0]
  16. …/…WHEN [numvar: turn direction][equal to][1] DO [turn][in direction][right][slowly]
  17. …/…WHEN [numvar: turn direction][equal to][2] DO [turn][in direction][left][slowly]
  18. …/…WHEN [numvar: altitude direction][equal to][1]
  19. …/…/…WHEN [duration timer][1] DO [move][with flying][in direction][forward][plus][up][at speed][numvar: speed]
  20. …/…WHEN [numvar: Altitude direction][equal to][2]
  21. …/…/…WHEN {(][raycast hit][direction][down][terrain only][length][10][)][or][position][y][minus][world water level][less than][10]
  22. …/…/…/…WHEN [else]
  23. …/…/…/…/…WHEN [duration timer][1] DO [move][with flying][in direction][forward][plus][down][at speed][numvar:speed]
  24. WHEN [bump] DO [turn][away from it][quickly]

Alterations

Have bird fly at lower altitude
WHEN DO [numvar:height][equals][clamp][min][11][max][15][height] // you can change the numbers to higher (I do not recommend a number lower than 11)
WHEN DO [position][y][equals][numvar:height]

Use this kode for a non flying animal
Remove the [with flying] tiles from lines 3.19 and 23. Change the speed in line 4 as it will be a bit fast (0.1 to 1 is quite good)

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: