Welcome to the Creatures Wiki! Log in and join the community.
Balloon Pigeon (teardown)
Jump to navigation
Jump to search
Balloon Pigeon | ||
---|---|---|
This article is a teardown of an existing CAOS script. | ||
Game Version | Creatures 3/Docking Station | |
Filename(s) | SkyswimmerPack.agents | |
Classifier | 2 23 18709, 2 15 18709, 2 18 18709, 2 10 18710 | |
Dependencies | ||
Images | skyswimmer_pidgeon.c16 | |
Sounds | chwp.wav, reat.wav | |
Catalogue Tags | none | |
Agents | SkyswimmerPack.agents | |
Other | none |
This is a teardown page explaining the details and inner workings of this agent. For general information, see Balloon Pigeon
The Balloon Pigeon is a compound dispenser agent (and simple critter agent) made for Creatures 3 and Docking Station by Risen Angel.
Contents
- 1 Parts
- 2 Scripts
- 2.1 Inject
- 2.2 Dispenser Activate 1 (Push)
- 2.3 Dispenser Activate 2 (Pull)
- 2.4 Dispenser Timer Script (9)
- 2.5 Dispenser Special Script (1000)
- 2.6 Dispenser Special Script (1001)
- 2.7 Pigeon Activate 1 (Push)
- 2.8 Pigeon Timer Script (9)
- 2.9 Pigeon critter eat script (12)
- 2.10 Pigeon detritus pickup script (4)
- 2.11 Pigeon detritus drop script (5)
- 2.12 Pigeon detritus collision script (6)
- 2.13 Pigeon detritus timer script (9)
- 2.14 Pigeon detritus eat script (12)
- 2.15 Pigeon egg timer script (9)
- 2.16 Pigeon egg eat script (12)
- 2.17 Remove script
- 3 Notes
- 4 Source code
Parts[edit]
Scripts[edit]
Inject[edit]
- Install a compound dispenser, using 5 sprites starting at position 42 in the file "skyswimmer_pidgeon.c16".
- Sets OV00 (amount of pigeons to produce) to 0
- Creates all of the agent parts
- Moves safely (MVSF) to either "Creator X" and "Creator Y", or 2348 435 if Creator X and Creator Y don't exist.
Dispenser Activate 1 (Push)[edit]
Dispenser Activate 2 (Pull)[edit]
Dispenser Timer Script (9)[edit]
- Sets a temporary variable, va00, to 0
- Counts balloon pigeon critters, and adds them to va00.
- Counts balloon pigeon eggs, and adds them to va00.
- Sets a new temporary variable, va01, to ov00 (amount of pigeons to produce).
- Adds 1 to va01.
- If the amount of existing pigeons and pigeon eggs is smaller than va01, install a new pigeon.
Dispenser Special Script (1000)[edit]
If OV00 (amount of pigeons to produce) is less than 9, add 1 to ov00. Or else, (it is not less than 9), set OV00 to 0. Make part 1 take pose ov00.
Dispenser Special Script (1001)[edit]
If OV00 (amount of pigeons to produce) is greater than 0, subtract 1 from ov00. Or else, (it is not greater than 0), set OV00 to 9. Make part 1 take pose ov00.
Pigeon Activate 1 (Push)[edit]
- Stim writ the pushing creature with the appropriate stimulus.
- Stop movement.
- If OV02 (horizontal direction) is -1, animate in a certain way, or else, if OV02 is 1, animate in a different way.
Pigeon Timer Script (9)[edit]
- Add 1 to OV00 (age)
- If OV00 is greater than a random number between 1000 and 1200, go to the subroutine die_.
- If the room type is water
- In a LOOP, try to go directly upwards, add 1 to a temporary variable, then, if ov02 (horizontal direction) is -1, animate in a certain way, or else, if ov02 is 1, animate in a different way, until the room type is not water or the temporary variable is greater than or equal to 300.
- If the temporary variable is greater than or equal to 300, go to the subroutine die_.
- Else, reset the temporary variable to 0.
- End the check on the temporary variable count.
- End the room type check.
- If OV00 (age) is greater than 100 and a random coin flip is 1, prepare to lay an egg. Set the rnge to 1000, count up the pigeons and pigeon eggs in that range.
- End the 'I see less than 5 others' check
- End the 'age and coin flip' check.
- Go to the subroutine rndm.
- If a random number between 0 and 10 is 1, go to the subroutine cdir (change direction).
- If ov02 is -1, go to the rtrn (right turn) subroutine, then set ov02 to 1, and ov04 randomly between 1 and 2. Else, if ov02 is 1, go to the ltrn (left turn) subroutine, then set ov02 to -1 and ov04 randomly between -2 and -1.
- else, check if a random number between 0 and 5 is 1 - if so,
- If ov03 is -1, set ov05 (vertical velocity) to -0.5. Else, if ov03 is 1, set ov05 to 0.5.
- If ov02 (horizontal direction) is -1, set ov04 (horizontal velocity) randomly between -2 and -1. Else, if ov02 is 1, set ov04 randomly between 1 and 2.
- If a random number between 0 and 10 is 1, go to the subroutine cdir (change direction).
- Go to the subroutine obst.
- If there's an obstacle less than 10 pixels away to the left and ov02 (horizontal velocity) is -1, go to the rtrn (right turn) subroutine.
- change velocity, and animate.
- set ov02 to 1
- set ov04 randomly between 1 and 2.
- Else, if there's an obstacle to the right and ov02 is 1, go to the ltrn (left turn) subroutine.
- Change velocity and animate.
- set ov02 to -1
- set ov04 randomly between -2 and -1.
- If there's an obstacle above the pigeon (less than 20 pixels away) and ov03 (vertical direction) is -1, set ov03 to 1 and ov05 to 0.5. Else, if there's an obstacle below the pigeon, less than 50 pixels away, and ov03 is 1, change ov03 to -1 and ov05 to -0.5.
- If there's an obstacle less than 10 pixels away to the left and ov02 (horizontal velocity) is -1, go to the rtrn (right turn) subroutine.
- Go to the subroutine move.
- Set the velocity to ov04 and ov05. If ov02 is -2, animate in a certain way, or else, animate in another way.
- End of rndm subroutine.
Pigeon critter eat script (12)[edit]
- Play a sound.
- Stim the creature that ate the pigeon with 'I have eaten animal' with a strength of 2.
- Remove the critter.
Pigeon detritus pickup script (4)[edit]
- Take pose 0.
Pigeon detritus drop script (5)[edit]
- Animate in a loop eternally.
Pigeon detritus collision script (6)[edit]
- Take a pose determined by ov00.
Pigeon detritus timer script (9)[edit]
- If you're not falling and your pose isn't equal to ov00, take pose ov00.
- Add 1 to ov01.
- If ov01 is greater than a random number between 200 and 300, and if ov00 is 4, animate in one way. Else, if ov00 is 8, animate in another way.
- If the detritus is within a room, ALTR some room cellular automata to give a small amount of heat, atmospheric water and soil nutrients.
- Remove the detritus.
Pigeon detritus eat script (12)[edit]
- Play a noise.
- Stim the creature that ate the pigeon detritus with 'I have eaten detritus' with a strength of 1.
- Remove the detritus.
Pigeon egg timer script (9)[edit]
- If ov01 is 0, add 1 to ov00.
- If ov00 is greater than a random number between 500 and 600, install a pigeon. Set the pose of the egg to 1, then set ov01 to 1.
- Else, (if ov00 is not greater than a random number between 500 and 600), add 1 to ov02.
- If ov02 is greater than 50, and the egg is within a room, add some soil nutrients to the room and remove the egg.
Pigeon egg eat script (12)[edit]
- Play a noise.
- Stim the creature that ate the pigeon egg with 'I have eaten animal' with a strength of 1.
- Set ov01 to 1.
- Set the pose to 1.
Remove script[edit]
- Removes all instances of the dispensers, pigeons, pigeon eggs, and pigeon detritus.
- Removes all scripts associated with the agent.
Notes[edit]
- This agent pre-dates the Creatures Development Standards, and could be aligned with the standards by adding a pull and a hit script for the pigeons, and a hit script for the vendor.
Source code[edit]
inst new: comp 2 23 18709 "skyswimmer_pidgeon" 5 42 1000 attr 198 accg 5 aero 0 perm 100 elas 0 fric 100 *ov00 = amount of pigeons to produce setv ov00 0 pat: dull 1 "skyswimmer_pidgeon" 47 9 43 1 pat: butt 2 "skyswimmer_pidgeon" 57 1 37 42 1 [] 1000 1 pat: butt 3 "skyswimmer_pidgeon" 58 1 38 56 1 [] 1001 2 setv va00 game "CreatorX" setv va01 game "CreatorY" doif va00 <> 0 and va01 <> 0 mvsf va00 va01 else mvsf 2348 435 endi endm scrp 2 23 18709 1 tick 10 clac 1 endm scrp 2 23 18709 2 tick 0 clac 0 endm scrp 2 23 18709 9 setv va00 0 enum 2 15 18709 addv va00 1 next enum 2 18 18709 addv va00 1 next setv va01 ov00 addv va01 1 doif va00 < va01 setv va02 posl setv va03 post anim [0 1 2 3 4] over inst new: simp 2 15 18709 "skyswimmer_pidgeon" 28 0 2000 attr 199 bhvr 49 accg 0 aero 0 perm 30 elas 0 fric 60 *ov00 = lifespan setv ov00 0 *ov02 = horizontal direction setv ov02 rand 0 1 doif ov02 = 0 setv ov02 -1 endi *ov03 = vertical direction setv ov03 rand 0 1 doif ov03 = 0 setv ov03 -1 endi *ov04 = horizontal velocity setv ov04 0 *ov05 = vertical velocity setv ov05 0 tick 2 frat 2 mvsf va02 va03 velo rand -10 10 -10 targ ownr anim [4 3 2 1 0] over endi endm scrp 2 23 18709 1000 doif ov00 < 9 addv ov00 1 else setv ov00 0 endi part 1 pose ov00 endm scrp 2 23 18709 1001 doif ov00 > 0 subv ov00 1 else setv ov00 9 endi part 1 pose ov00 endm scrp 2 15 18709 1 stim writ from 86 1 velo 0 0 doif ov02 = -1 anim [21 16 17 18 19 20] over elif ov02 = 1 anim [27 22 23 24 25 26] over endi endm scrp 2 15 18709 9 *Age some addv ov00 1 *If too old, fall from the sky and die doif ov00 > rand 1000 1200 gsub die_ endi doif rtyp room ownr = 8 or rtyp room ownr = 9 loop velo 0 -10 addv va99 1 doif ov02 = -1 anim [21 16 17 18 19 20] over elif ov02 = 1 anim [27 22 23 24 25 26] over endi untl rtyp room ownr <> 8 and rtyp room ownr <> 9 or va99 >= 300 doif va99 >= 300 gsub die_ else setv va99 0 endi endi doif ov00 > 100 and rand 0 1 = 1 rnge 1000 setv va00 0 esee 2 15 18709 addv va00 1 next esee 2 18 18709 addv va00 1 next doif va00 < 5 gsub laye endi endi gsub rndm subr rndm doif rand 0 10 = 1 gsub cdir else doif rand 0 5 = 1 loop setv ov03 rand -1 1 untl ov03 <> 0 endi doif ov03 = -1 setv ov05 -0.5 elif ov03 = 1 setv ov05 0.5 endi doif ov02 = -1 setv ov04 rand -2 -1 elif ov02 = 1 setv ov04 rand 1 2 endi endi gsub obst gsub move retn *Laying an egg subr laye loop setv vely 3 doif ov02 = -1 anim [20 19 18 17 16 21] elif ov02 = 1 anim [26 25 24 23 22 27] endi over untl rtyp room ownr = 8 or rtyp room ownr = 9 or obst down < 10 doif rtyp room ownr = 8 or rtyp room ownr = 9 stop else doif ov02 = -1 anim [10 11 12 11 10] elif ov02 = 1 anim [13 14 15 14 13] endi over setv va00 posx setv va01 posy setv va02 plne addv va02 1 inst new: simp 2 18 18709 "skyswimmer_pidgeon" 2 40 va02 attr 194 bhvr 48 accg 3 aero 0 perm 100 elas 0 fric 45 *ov00 = hatching countdown setv ov00 0 *ov01 = hatched flag setv ov01 0 tick 1 mvsf va00 va01 targ ownr endi retn *Death subr die_ *The way the bird is currently facing detirmines the way the corpse faces doif ov02 = -1 setv va30 4 elif ov02 = 1 setv va30 8 endi *Create the corpse setv va00 posl setv va01 post setv va02 plne inst new: simp 2 10 18710 "skyswimmer_pidgeon" 12 28 va02 attr 194 bhvr 48 accg 5 aero 0 perm 30 elas 0 fric 50 setv ov00 va30 tick 1 mvsf va00 va01 anim [0 1 2 3 255] targ ownr kill ownr retn subr obst doif obst left < 10 and ov02 = -1 gsub rtrn setv ov02 1 setv ov04 rand 1 2 elif obst rght < 10 and ov02 = 1 gsub ltrn setv ov02 -1 setv ov04 rand -2 -1 endi doif obst _up_ < 20 and ov03 = -1 setv ov03 1 setv ov05 0.5 elif obst down < 50 and ov03 = 1 setv ov03 -1 setv ov05 -0.5 endi retn *Changing direction subr cdir doif ov02 = -1 gsub rtrn setv ov02 1 setv ov04 rand 1 2 elif ov02 = 1 gsub ltrn setv ov02 -1 setv ov04 rand -2 -1 endi retn *Turning right subr rtrn *Change velocity velo 2 0 *animation anim [1 8 9 6 5] over retn *Turning left subr ltrn *Change velocity velo -2 0 *Animation anim [6 9 8 1 0] over retn *Movement subr move velo ov04 ov05 doif ov02 = -1 anim [0 1 2 3] over else anim [4 5 6 7] over endi retn endm scrp 2 15 18709 12 snde "chwp" stim writ from 80 2 kill ownr endm scrp 2 10 18710 4 pose 0 endm scrp 2 10 18710 5 anim [0 1 2 3 255] endm scrp 2 10 18710 6 pose ov00 endm scrp 2 10 18710 9 doif fall ne 1 and pose <> ov00 pose ov00 endi addv ov01 1 doif ov01 > rand 200 300 doif ov00 = 4 anim [4 5 6 7] elif ov00 = 8 anim [8 9 10 11] endi over doif room ownr <> -1 altr room targ 2 0.01 altr room targ 3 0.01 altr room targ 4 0.01 endi kill ownr endi endm scrp 2 10 18710 12 snde "reat" stim writ from 81 1 kill targ endm scrp 2 18 18709 9 doif ov01 = 0 addv ov00 1 doif ov00 > rand 500 600 setv va00 posl subv va00 21 setv va01 post subv va01 34 inst new: simp 2 15 18709 "skyswimmer_pidgeon" 28 0 2000 attr 199 bhvr 49 accg 0 aero 0 perm 30 elas 0 fric 60 *ov00 = lifespan setv ov00 0 *ov02 = horizontal direction setv ov02 rand 0 1 doif ov02 = 0 setv ov02 -1 endi *ov03 = vertical direction setv ov03 rand 0 1 doif ov03 = 0 setv ov03 -1 endi *ov04 = horizontal velocity setv ov04 0 *ov05 = vertical velocity setv ov05 0 tick 2 frat 2 doif tmvt va00 va01 = 1 mvto va00 va01 else kill targ endi targ ownr pose 1 setv ov01 1 endi else addv ov02 1 doif ov02 > 50 doif room ownr ne -1 altr room targ 4 0.01 endi kill ownr endi endi endm scrp 2 18 18709 12 snde "chwp" stim writ from 80 1 setv ov01 1 pose 1 endm rscr enum 2 23 18709 kill targ next enum 2 15 18709 kill targ next enum 2 18 18709 kill targ next enum 2 10 18710 kill targ next scrx 2 23 18709 1 scrx 2 23 18709 2 scrx 2 23 18709 9 scrx 2 23 18709 1000 scrx 2 23 18709 1001 scrx 2 15 18709 1 scrx 2 15 18709 9 scrx 2 15 18709 12 scrx 2 18 18709 9 scrx 2 18 18709 12 scrx 2 10 18710 4 scrx 2 10 18710 5 scrx 2 10 18710 6 scrx 2 10 18710 9 scrx 2 10 18710 12