Welcome to the Creatures Wiki! Log in and join the community.

Reindeer (teardown)

From Creatures Wiki
Jump to navigation Jump to search
Reindeer
This article is a teardown of an existing CAOS script.
Game Version Creatures 3
Filename(s)
Classifier 2 15 30
Dependencies
Images reindeer.c16
Sounds
Catalogue Tags reindeer.catalogue
Agents none
Other none

This is a teardown page explaining the details and inner workings of this agent. For general information, see Reindeer (C3)

The Reindeer is a simple critter agent created by Mark Ashton for Creatures 3, as part of the Advent Pack. The sprite is based on the original sprites for the C1 Reindeer, and only has a timer script which controls the reindeer's leaps in the Norn Terrarium or in other locations if needed. To directly see the code and files, Revelation, Zeus or Jagent can be used to decompile the agent file.

Scripts[edit]

Inject[edit]

  • Six reindeer are injected
  • Sets the ATTR to 192 (the reindeer will collide with things and follow the laws of physics)
  • Moves the reindeer all to one spot in the C3 Norn terrarium.
  • They are relatively low elasticity, fairly high but not perfect friction, and have a high specific gravity - 9.81.
  • They each have a tick of 1: their timer script will be triggered every 1/20th of a second.
  • They have a permeability of 99.

Timer (9)[edit]

  • Commands are activated instantly
  • If the reindeer is not falling
    • Check if your x-position is greater than 3000.
      • If so, repeat the following 6 times:
        • set a random velocity of between -10 and -20 in the X-direction, which will cause the reindeer to move to the player's left, and a random velocity of -10 to -20 in the Y-direction, which will cause the reindeer to jump up.
        • animate the reindeer using the poses of walking left
        • wait until the animation is OVER
        • Wait a little longer: between 3-7 ticks (approx. 1/3rd of a second)
      • Close the 6-repeats
    • Check the X-position again: see if it's less than 1500:
      • If so, repeat the following 6 times:
        • set a random velocity of between 10 and 20 in the X-direction, which will cause the reindeer to move to the player's right, and a random velocity of -10 to -20 in the Y-direction, which will cause the reindeer to jump up.
        • animate the reindeer using the poses of walking right
        • wait until the animation is OVER
        • Wait a little longer: between 3-7 ticks (approx. 1/3rd of a second)
      • Close the 6-repeats
    • If the X-position is somewhere else
      • Wait a little: between 3-7 ticks (approx. 1/3rd of a second)
      • Spring once: Set a random velocity of between 20 and -20 in the X-direction (could go either way) and a random velocity of -5 and -20 in the Y-direction (still jumping up)
      • Check the x-velocity:
        • If the X-velocity is greater than 0
        • animate the right-walking poses
        • Else, if the X-velocity is less than 0
        • animate the left-walking poses
        • Close the X-velocity check
      • End the script-long X-position check
    • End the 'if I'm falling' check
  • Wait until the animation is over (from the 'somewhere else' contingency plan)
  • end the timer script.

Remove[edit]

  • Removes all instances of the reindeer.