Welcome to the Creatures Wiki! Log in and join the community.
Spotted Spurge (teardown)
Jump to navigation
Jump to search
Spotted Spurge | ||
---|---|---|
This article is a teardown of an existing CAOS script. | ||
Game Version | Creatures 3/Docking Station | |
Filename(s) | SpottedSpurge.agents | |
Classifier | 2 23 15407, 2 3 15407, 2 4 15407 | |
Dependencies | ||
Images | spottedspurge.c16 | |
Sounds | ||
Catalogue Tags | ||
Agents | SpottedSpurge.agents | |
Other | none |
This is a teardown page explaining the details and inner workings of this agent. For general information, see Spotted Spurge
The Spotted Spurge is a simple plant agent (and accompanying simple dispenser agent) made for Creatures 3 and Docking Station by Jesseth and CosmicSynthetics.
Contents
Scripts[edit]
Inject[edit]
- Inject a simple dispenser, using 17 images from the spottedspurge.c16 file, starting at sprite #0.
- Try to inject it into a DS-compatible location, then if that's not possible, try to inject it into a C3-compatible location.
Dispenser push script[edit]
- Stimulate whatever pushed it with stimulus 90
- Animate
- instantaneously install a random amount of 1 or 2 seeds
Dispenser pull script[edit]
- Stimulate whatever pulled it with stimulus 90
- Animate
- instantaneously install a random amount of 1 or 2 seeds
Dispenser hit script[edit]
- Stimulate whatever hit it with stimulus 92
- Animate
- instantaneously install a random amount of 1 or 2 seeds
Seed pickup script[edit]
- Blank script.
Seed eat script[edit]
- Make a noise
- Stimulate whatever ate it with stimulus 77
- give the from 0.001 of Heavy metals.
- return the targ to the ownr
- kill the seed.
Seed timer script[edit]
- Stop the timer script if the seed is falling. (Stopping the script will not stop it forever, it will try again at the next time the tick is triggered.)
- Stop the timer script if the seed is being carried (by the hand, a creature, or in a lift).
- If the seed is not on a soil-type floor, the seed should die.
- Instantaneously set two temporary variables to POSL and POST, and count how many other spotted spurge plants the seed can see, using a third temporary variable.
- If there’s more than 10 spotted spurge plants, the seed will die.
- If all of the above checks are false, then the seed will wait for 200 ticks, and then:
- Instantaneously use two temporary variables to remember POSL and POSY, set a third temporary variable to be randomly 0 or 1.
- If that coin flip variable is 0, set a fourth temporary variable to be 0 and subtract 27 from the POSL temporary variable.
- Or else, if the coin flip variable is 1, set a fourth temporary variable to be 15 and subtract 19 from the POSL temporary variable.
- Install a new spotted spurge plant, and set its growth object variable to 0.
- Instantaneously use two temporary variables to remember POSL and POSY, set a third temporary variable to be randomly 0 or 1.
- Remove the seed and end the script.
Plant push script[edit]
- Stimulates the from with ‘played with friendly plant’ at a strength of 1.
Plant pull script[edit]
- Stimulates the from with ‘played with friendly plant’ at a strength of 1.
Plant hit script[edit]
- Stimulates the from with ‘played with friendly plant’ at a strength of 1.
Source code[edit]
************************* ***Install*** ************************* inst new: simp 2 23 15407 "spottedspurge" 17 0 2000 attr 199 bhvr 11 perm 75 elas 40 accg 15 aero 10 fric 100 *** Check the engine and move it into the world * Which game engine is it? doif gnam eq "Docking Station" * Which creator did it use? * "CreatorX" and "CreatorY" are set when the creator button is pushed. setv va00 game "CreatorX" setv va01 game "CreatorY" doif va00 eq 0 and va01 eq 0 * DS safe, just in case setv va00 6110 setv va01 9200 endi doif tmvt va00 va01 eq 1 mvto va00 va01 else mvsf va00 va01 endi elif gnam eq "Creatures 3" doif tmvt 5671 3599 eq 1 mvto 5671 3599 else mvsf 5671 3599 endi endi velo 10 5 **************************** ***Dispenser Scripts*** **************************** *pushed scrp 2 23 15407 1 stim writ from 90 1 anim [0 0 1 1 0 0 2 2 0] inst setv va01 posx setv va02 posy reps rand 1 2 new: simp 2 3 15407 "spottedspurge" 17 rand 3 4 rand 1000 4500 attr 195 bhvr 48 perm 80 elas 10 accg 5 aero 2 fric 100 mvsf va01 va02 velo rand -10 10 rand -10 10 emit 7 .02 tick rand 10 30 repe endm *pulled scrp 2 23 15407 2 stim writ from 90 1 anim [0 0 1 1 0 0 2 2 0] inst setv va01 posx setv va02 posy reps rand 1 2 new: simp 2 3 15407 "spottedspurge" 17 rand 3 4 rand 1000 4500 attr 195 bhvr 48 perm 80 elas 10 accg 5 aero 2 fric 100 mvsf va01 va02 velo rand -10 10 rand -10 10 emit 7 .02 tick rand 10 30 repe endm *hit *in this case it still vends but they know in their minds that they hit it scrp 2 23 15407 3 stim writ from 92 1 anim [0 0 1 1 0 0 2 2 0] inst setv va01 posx setv va02 posy reps rand 1 2 new: simp 2 3 15407 "spottedspurge" 17 rand 3 4 rand 1000 4500 attr 195 bhvr 48 perm 80 elas 10 accg 5 aero 2 fric 100 mvsf va01 va02 velo rand -10 10 rand -10 10 emit 7 .02 tick rand 10 30 repe endm **************************** ***Seed Scripts*** **************************** *pickup seeds script which does nothing here, but is important to have scrp 2 3 15407 4 endm *eaten scrp 2 3 15407 12 snde "chwp" stim writ from 77 1 targ from chem 66 .001 targ ownr kill ownr endm *timer script scrp 2 3 15407 9 *if still falling stop doif fall eq 1 stop endi *if being carried stop doif carr ne null stop endi *if not on a soil floor die doif rtyp room targ lt 5 or rtyp room targ gt 7 wait 500 kill ownr endi *otherwise should be ok to grow inst setv va00 posl setv va01 post *count how many others you can see rnge 250 setv va99 0 esee 2 4 15407 addv va99 1 next *if there's more than 10 then don't grow doif va99 ge 10 kill ownr else wait 200 inst setv va00 posl setv va01 posy setv va50 rand 0 1 doif va50 = 0 setv va51 0 subv va00 27 elif va50 = 1 setv va51 15 subv va00 19 endi new: simp 2 4 15407 "spottedspurge" 17 rand 5 6 rand 1000 4500 attr 192 perm 60 accg 5 fric 100 elas 0 mvsf va00 va01 emit 15 .03 tick rand 100 400 ***ov00 is growth setv ov00 0 endi kill ownr endm ****************************** ***Plant Scripts*** ****************************** *pushed a friendly plant scrp 2 4 15407 1 stim writ from 84 1 endm *pulled a friendly plant scrp 2 4 15407 2 stim writ from 84 1 endm *hit a friendly plant scrp 2 4 15407 3 stim writ from 84 1 endm ***ov00 is growth **0 Growing **1 Dying *this is where the dying happens v scrp 2 4 15407 9 doif pose ge 10 *add some water to the room when dying altr room targ 3 0.4 *add some nutrients to the room when dying altr room targ 4 0.4 targ ownr kill ownr endi * these are the flowering image frames that represent the seeding period of life doif pose ge 4 and pose lt 9 gsub seed endi doif ov00 eq 0 gsub grow endi doif ov00 eq 1 gsub dead endi *if they're not too old, go up a stage or two to make growth and frame a little random subr grow doif pose lt 10 wait 50 setv va00 pose addv va00 rand 1 2 pose va00 endi retn *die already!!! This was the worst to figure out by far goddamn. *finding a nice pose range where they could have the above growth style and still die.. subr dead doif pose ge 10 setv va00 pose addv va00 1 pose va00 endi retn subr seed doif pose ge 4 and pose lt 9 ***make 1 to 2 seeds setv va01 posx setv va02 posy reps rand 1 2 new: simp 2 3 15407 "SpottedSpurge" 17 rand 3 4 rand 1000 4500 attr 195 bhvr 48 perm 30 elas 5 accg 1 aero 1 fric 80 mvsf va01 va02 ***make it fly away a bit so to spread the plant around velo rand -5 5 -5 emit 7 .01 tick rand 200 400 repe ***target the plant targ ownr ***increase pose to age plant forward towards death setv va00 pose addv va00 rand 1 2 pose va00 endi retn endm *remove script *first part kills all agents second part takes out scripts rscr enum 2 3 15407 kill targ next enum 2 4 15407 kill targ next enum 2 23 15407 kill targ next scrx 2 23 15407 1 scrx 2 23 15407 2 scrx 2 23 15407 3 scrx 2 3 15407 12 scrx 2 3 15407 4 scrx 2 3 15407 9 scrx 2 4 15407 1 scrx 2 4 15407 2 scrx 2 4 15407 3 scrx 2 4 15407 9