Wandering Animal

Type: Animal Brain
Level: 3 star
Pages: 2
Description: The default brain for most animals (squirrel, desert cottontail etc). The animal is scared of the Player and will run away. Animal is not hostile and does not attack.

Kode

page 1 @Wander

  1. WHEN [countdown timer][2][hold time][4][loop] DO [move][at speed][0.15
  2. WHEN [countdown timer][2][loop] DO [numvar:turn direction][equals][random number][1][to][2][as integer]
  3. WHEN [moving]
  4. …WHEN [duration timer][2][loop]
  5. …/…WHEN [numvar:turn direction][equal to][1] DO [turn][in direction][right][slowly]
  6. …/…WHEN [numvar:turn direction][equal to][2] DO [turn][in direction][left][slowly]
  7. WHEN [bump] DO [turn][away from][it][quickly]
  8. WHEN [detect][player] DO [switch page][page: @ Flee from Player]

page 2 @ Flee from Player

  1. WHEN [page entered] DO [jump]
  2. WHEN [duration timer][1] DO [play sound][sound:Animal Squirrel Call]
  3. WHEN [detect][Player] DO [move][away from][it]
  4. WHEN [no longer][detect][player] DO [switch page][@Wander]

Alterations

Reduce the jump height
I feel the jump is too high to be natural. Change line 1 on page 2
WHEN [page entered] DO [jump][jump height][divided by][2]

Friendly animal
Instead of having the animal run away, they could approach the player. Change page 2 line 3 to this
WHEN [detect][player] DO [move][toward][it]

If you don’t want the animal following the player continuously then add

WHEN [detect][player] DO [move][toward][it]
…WHEN [distance to][it][less than][2] DO [boolvar:follow][equals][true]
WHEN [boolvar:follow]
…WHEN [countdown timer][5] DO [boolvar: follow][equls][false] // change the length of time you want the animal to follow here
…/…WHEN DO [switch page][3]

page 3

WHEN DO [move][away from][player]
WHEN [not][detect][player] DO [switch page][page: @Wander]

Friendly then hostile if attacked
Change as above then add
WHEN [hit by attack] DO [push brain][brain:Hostile Creature]

 

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: