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

Tails (teardown)

From Creatures Wiki
Jump to navigation Jump to search
Tails
This article is a teardown of an existing CAOS script.
Game Version Creatures 3/Docking Station
Filename(s) Tails.agents
Classifier 2 15 4602
Dependencies
Images tails.c16
Sounds chwp.wav
Catalogue Tags
Agents Tails.agents
Other none

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

Tails is a simple critter agent made for Creatures 3 and Docking Station by AquaShee and Daan.

Scripts[edit]

Inject[edit]

  • Injects a simple critter using 29 images starting at image #1
  • CORE is used to alter some aspects of the bounding box for Tails
  • VOIC is used to allow Tails to use SEZZ
  • Tails tries to install in a DS location but has a C3 location as a fallback option.
  • OV00 is set to 4
  • The tick is set to 1.

Push script[edit]

  • Stimulates with the stimulus I have pushed critter
  • Uses SEZZ to make Tails say 'hi hi'
  • Targets the speech bubble factory, if it exists, make a speech bubble saying "Hey! Don't push me!"
  • Return to doing stuff to Tails
  • Bounce away!
    • In a LOOP, check VELX to see if Tails is going left (less than 0) or right (greater than 0) and use the appropriate images to show this, and then add to ov00
    • Until ov00 is greater than 50 or the room type is fresh or salt water or there is an obstacle above Tails
  • Set accg to 0.1, this will make Tails drift slowly
  • Set ov00 to 0
  • Set Tails' bounciness to 0
    • In a LOOP, check VELX to see if Tails is going left (less than 0) or right (greater than 0) and use the appropriate images to show this, and then add to ov00
    • Until ov00 is greater than 50 or the room type is fresh or salt water or there is an obstacle below Tails
  • Set ACCG to make Tails fall gently to the ground.

Pull script[edit]

  • Stimulates with the stimulus I have pushed critter
  • Uses SEZZ to make Tails say 'ho ho'
  • Targets the speech bubble factory, if it exists, make a speech bubble saying "Hey! Don't pull my tail!"
  • Return to doing stuff to Tails
  • Bounce away!
    • In a LOOP, check VELX to see if Tails is going left (less than 0) or right (greater than 0) and use the appropriate images to show this, and then add to ov00
    • Until ov00 is greater than 50 or the room type is fresh or salt water or there is an obstacle above Tails
  • Set accg to 0.1, this will make Tails drift slowly
  • Set ov00 to 0
  • Set ov99 to 0
  • Set Tails' bounciness to 0
    • In a LOOP, check VELX to see if Tails is going left (less than 0) or right (greater than 0) and use the appropriate images to show this, and then add to ov00
    • Until ov00 is greater than 50 or the room type is fresh or salt water or there is an obstacle below Tails
  • Set ACCG to make Tails fall gently to the ground.

Timer script[edit]

  • Swim when in water
    • Go to subroutine swim
  • If not in water, set gravity to 0.5 and then randomly choose between the subroutines 'say', 'fly' or 'walk'.
    • Subroutine swim:
      • Become weightless
      • Loop swimming left or right images
      • If there's an obstacle close above Tails, randomly change your direction.
      • Continue looping this swimming images and checking for obstacles stuff until Tails is no longer in a room that is fresh or salt water.
      • If Tails is no longer in water, Tails should randomly change his velocity and then go to the fly subroutine.
    • Fly subroutine:
      • Become weightless and perfectly bouncy.
      • Set ov00 to 0
      • Loop flying left or right images, and add to ov00.
      • Continue to loop until ov00 is greater than 100 or Tails is in fresh or salt water or there's a nearby obstacle above Tails.
      • Get a small amount of gravity and begin drifting
      • Set ov00 to 0 and ov99 to 0.
      • Become perfectly unbouncy.
      • Loop going left images or going right images until touchdown or splash landing in fresh or salt water.
      • Get a larger amount of gravity.
    • Walk subroutine:
      • Randomly TTAR any toy Tails is touching and then randomly decide to activate it or not. Tails should say 'yabba dabba doo' and then make the speech bubble factory say "Toys are fun.", then returning TARG to Tails.
      • Randomly TTAR any vendor Tails is touching and then randomly decide to activate it or not. Tails should say 'yabba dabba doo' and then make the speech bubble factory say "What does this dispenser vend?", then returning TARG to Tails.
      • Randomly choose to walk left or right, and use the appropriate images for doing so, and use REPS and REPE to do this once or twice.
    • Say subroutine:
      • Use SEZZ to say 'yabba dabba doo'
      • Use a temporary variable to randomly choose between getting the speech bubble factory to say 'Sonic, where are you?' or 'Norns are cool!', 'Catch me if you can!' or 'I want to fly high!'.
      • Return TARG to Tails.

Eat script[edit]

  • Make the 'chwp' noise
  • Stimulate the object that ate Tails with 'I have eaten critter' stimulus
  • Make Tails SEZZ 'aw', and then get the speech bubble factory to say 'Help! I'm being eaten!' and return the TARG to Tails.
  • Make the creature that ate Tails DROP Tails
  • Tails, make a break for it! Make Tails weightless and perfectly bouncy, set ov00 to 0 and give Tails some random velocity.
    • In a loop, if Tails is going left, make it look like Tails is going left. If Tails is going right, make Tails look like he's going right. Add a little to ov00.
    • Make the loop continue until ov00 is greater than 50 or Tails is in salt or fresh water or has an overhead obstacle close to him.
  • Make Tails drift slowly downwards, and reset ov00 and ov99 to 0, and make Tails perfectly unbouncy.
    • In a loop, if Tails is moving left, use animations to suit, and if Tails is going right, use animations to suit.
    • Until there's an obstacle below him or he's in salt or fresh water
  • Give Tails more gravity.


Remove script[edit]

Notes[edit]

Source code[edit]

*creates a Tails Critter!*
new: simp 2 15 4602 "tails" 29 1 4500
attr 199
bhvr 51
perm 60
accg 0.5
fric 10
elas 0
CORE 0 35 0 50
voic 0 0 0
setv va00 game "CreatorX"
setv va01 game "CreatorY"
doif va00 eq 0 and va01 eq 0
	setv va00 5687
	setv va01 3670
endi
mvsf va00 va01
setv ov00 4
tick 1
endm

*push script*
scrp 2 15 4602 1
	stim writ from 86 1
	sezz "hi hi"
	rtar 1 2 10
	doif targ ne null
		mesg wrt+ targ 126 "Hey! Don't push me!" ownr 0
	endi
	targ ownr
	accg 0
	elas 100
	setv ov00 0
	velo rand -5 5 rand -2 -2
	loop
		doif velx lt 0
			base 18
			anim [0 0 1 1]
			over
		else
			base 16
			anim [0 0 1 1]
			over
		endi
		addv ov00 rand 1 10
	untl ov00 gt 50 or rtyp room ownr eq 9 or rtyp room ownr eq 8 or obst _up_ lt 50

	accg 0.1
	setv ov00 0
	elas 0
	loop
		doif velx lt 0
			base 18
			anim [0 0 1 1]
			over
		else
			base 16
			anim [0 0 1 1]
			over
		endi
	untl obst down lt 5 or rtyp room ownr eq 9 or rtyp room ownr eq 8
	accg 0.5
endm

*pull script*
scrp 2 15 4602 2
	stim writ from 86 1
	sezz "ho ho"
	rtar 1 2 10
	doif targ ne null
		mesg wrt+ targ 126 "Hey! Don't pull my tail!" ownr 0
	endi
	targ ownr
	accg 0
	elas 100
	setv ov00 0
	velo rand -5 5 rand -2 -2
	loop
		doif velx lt 0
			base 18
			anim [0 0 1 1]
			over
		else
			base 16
			anim [0 0 1 1]
			over
		endi
		addv ov00 rand 1 10
	untl ov00 gt 50 or rtyp room ownr eq 9 or rtyp room ownr eq 8 or obst _up_ lt 50

	accg 0.1
	setv ov00 0
	setv ov99 0
	elas 0
	loop
		doif velx lt 0
			base 18
			anim [0 0 1 1]
			over
		else
			base 16
			anim [0 0 1 1]
			over
		endi
	untl obst down lt 5 or rtyp room ownr eq 9 or rtyp room ownr eq 8

	accg 0.5
endm

*timer script*
scrp 2 15 4602 9
*swim when in water
	doif rtyp room ownr eq 8 or rtyp room ownr eq 9
		gsub swim
	else
		accg 0.5
		setv va00 rand 0 50
		doif va00 eq 1
			gsub say
		elif va00 eq 2
			velo rand -5 5 rand -5 -1
			gsub fly
		endi
		setv va00 0
		gsub walk
	endi

	subr swim
		accg 0
		loop
			doif velx lt 0
				base 24
				anim [0 0 1 1 2 2 3 3]
				over
			else
				base 20
				anim [0 0 1 1 2 2 3 3]
				over
			endi
			doif obst _up_ lt 40
				velo rand -2 2 rand 1 1
			else
				velo rand -2 2 rand -3 1
			endi
		untl rtyp room ownr ne 8 and rtyp room ownr ne 9
		velo rand -5 5 rand -1 -1
		gsub fly
	retn


	subr fly
		accg 0
		elas 100
		setv ov00 0
		loop
			doif velx lt 0
				base 18
				anim [0 0 1 1]
				over
			else
				base 16
				anim [0 0 1 1]
				over
			endi
			addv ov00 rand 1 10
		untl ov00 gt 100 or rtyp room ownr eq 9 or rtyp room ownr eq 8 or obst _up_ lt 50
		accg 0.1
		setv ov00 0
		setv ov99 0
		elas 0
		loop
			doif velx lt 0
				base 18
				anim [0 0 1 1]
				over
			else
				base 16
				anim [0 0 1 1]
				over
			endi
		untl obst down lt 5 or rtyp room ownr eq 9 or rtyp room ownr eq 8
		accg 0.5
	retn
	subr walk
		doif rand 5 0 eq 0
			ttar 2 21 0
			doif targ ne null
				mesg writ targ rand 1 0
				targ ownr
				sezz "yabba dabba doo"
				rtar 1 2 10
				doif targ ne null
					mesg wrt+ targ 126 "Toys are fun." ownr 0
				endi
			endi
			targ ownr
		endi
		doif rand 10 0 eq 0
			ttar 2 23 0
			doif targ ne null
				mesg writ targ 0
				targ ownr
				sezz "yabba dabba doo"
				rtar 1 2 10
				doif targ ne null
					mesg wrt+ targ 126 "What does this dispenser vend?" ownr 0
				endi
			endi
			targ ownr
		endi
		setv va00 rand 1 0
		doif va00 eq 1
			setv va01 -5
		else
			setv va01 5
		endi
		reps rand 1 2
			setv velx va01
			doif velx lt 0
				base 8
				anim [0 1 2 3 4 5 6 7]
				over
			else
				base 0
				anim [0 1 2 3 4 5 6 7]
				over
			endi
		repe
	retn
	subr say
		sezz "yabba dabba doo"
		setv va99 rand 0 3
		doif va99 eq 0
			rtar 1 2 10
			doif targ ne null
				mesg wrt+ targ 126 "Sonic, where are you?" ownr 0
			endi
		elif va99 eq 1
			rtar 1 2 10
			doif targ ne null
				mesg wrt+ targ 126 "Norns are cool!" ownr 0
			endi
		elif va99 eq 2
			rtar 1 2 10
			doif targ ne null
				mesg wrt+ targ 126 "Catch me if you can!" ownr 0
			endi
		elif va99 eq 3
			rtar 1 2 10
			doif targ ne null
				mesg wrt+ targ 126 "I want to fly high!" ownr 0
			endi
		endi
		targ ownr
	retn
endm

scrp 2 15 4602 12
	snde "chwp"
	stim writ from 80 1
	sezz "aw"
	rtar 1 2 10
	doif targ ne null
		mesg wrt+ targ 126 "Help! I'm being eaten!" ownr 0
	endi
	targ ownr
	targ from
	drop
	targ ownr
	accg 0
	elas 100
	setv ov00 0
	velo rand -5 5 rand -5 -5
	loop
		doif velx lt 0
			base 18
			anim [0 0 1 1]
			over
		else
			base 16
			anim [0 0 1 1]
			over
		endi
		addv ov00 rand 1 10
	untl ov00 gt 50 or rtyp room ownr eq 9 or rtyp room ownr eq 8 or obst _up_ lt 50

	accg 0.1
	setv ov00 0
	setv ov99 0
	elas 0
	loop
		doif velx lt 0
			base 18
			anim [0 0 1 1]
			over
		else
			base 16
			anim [0 0 1 1]
			over
		endi
	untl obst down lt 5 or rtyp room ownr eq 9 or rtyp room ownr eq 8
	accg 0.5

endm
**

rscr
enum 2 15 4602
	kill targ
next
scrx 2 15 4602 9
scrx 2 15 4602 1
scrx 2 15 4602 2
scrx 2 15 4602 12