Page 1 of 1

Bouncing Plums 2.0

PostPosted: Sun Apr 28, 2013 8:41 am
by Laura
This patch plant allows juicy, bouncy plums to grow anywhere, even underwater.

Update - Bouncing Plums 2.0: Now with two extra growing stages for a more realistic fruit, as well as a few minor tweaks.

As always, any feedback and comments are welcome. I hope everyone enjoys this new update! Once again, a special mention goes out to Mea for the use of her plum sprites, as well as her generic growth sprites which feature in this new version. :D

Re: Bouncing Plums

PostPosted: Sun Apr 28, 2013 9:00 pm
by malkin
Thanks for the update - they look amazing in my game! (Though I've had to supply my norns with earmuffs! :lol: )

Re: Bouncing Plums

PostPosted: Mon Apr 29, 2013 4:12 am
by Laura
Sorry, I like bouncy things! :lol: I recommend only growing them in small patches, or turning down the volume in order to combat any noise pollution... >.>

As requested by Malkin, here is both the code and PRAY file for the Bouncing Plums:

Code: Select all
*install invisible flag agent:
new: simp 1 205 22929 "blnk" 0 0 9000
***This is the script that the patch core will trigger when it's time to spawn a fruit:
setv name "spawn_script" 1000

*sprite image file and frame when the plant is fully grown:
sets name "sprite_file" "bouncingplumsv2"
setv name "sprite_pose" 2

*classifiers:
setv name "prod_fmly" 2
setv name "prod_gnus" 8
setv name "prod_spcs" 14852

***set va00 to targ, enumerate all the instances of the patch core agent, send a message to that patch core agent that script 1000 is being targetted:
seta va00 targ
enum 1 1 22929
   mesg wrt+ targ 1000 va00 0 0
next

*spawn:
scrp 1 205 22929 1000
   inst

*create fruit:
***changed 7 to 9 in order to import all images
   new: simp 2 8 14852 "bouncingplumsv2" 9 0 name "patch_plane"
   mira rand 0 1

*fruit properties:
*** attr 80 = plum blossoms invisible to creatures so they won't be eaten, and don't want them to suffer physics just yet.
   attr 80
   bhvr 48
   accg 3
   perm 60
   fric 100
   elas 80
   aero 1

*move to co-ords sent by the core patch agent:
   mvto _p1_ _p2_

   setv name "patch_id" mame "patch_id"
   tick rand mame "tickfrom" mame "tickto"

*default tick:
   doif tick eq 0
      tick 300
   endi
endm

*timer:
scrp 2 8 14852 9
***Age it every Tick
   addv ov00 1
***if it's not fully grown, grow it to the next stage:
***(only on tick 2,4,6)
   doif ov00 le 9
      doif ov00 eq 1
      elif ov00 eq 3
      elif ov00 eq 5
      elif ov00 eq 7
      elif ov00 eq 9
      else
         setv va00 pose
         addv va00 1
         pose va00
      endi
***if it's older then 22 ticks, let it rot
***more frames are used, fully rotten frames are now 6 and 8
   elif ov00 gt 22
      doif pose eq 6
         kill targ
      endi
      doif pose eq 8
         kill targ
      endi
      setv va00 pose
      addv va00 1
      pose va00
**if it's fully grown and has been sitting on the plant for 10 turns, it should fall off the patch:
   elif ov00 eq 14
      doif attr eq 67
         setv name "patch_id" 0
         attr 195
         stop
      endi
***if it is fully grown, make sure creatures can see/grab it:
   elif ov00 eq 11
      doif attr eq 80
         attr 67
         emit 6 0.01
      endi
      stop
   endi
endm

*simplified collision:
scrp 2 8 14852 6
   lock
***bouncing noise when the fruit collides.   
   sndc "smit"
endm

*pickup:
scrp 2 8 14852 4
   inst
***if it's attr is still 67, you (or a creature) are picking it directly off the plant nd need to set it so it doesn't act attached to the patch anymore.
   doif attr = 67
      attr 195
      stim writ from 18 1

*clear the patch_id variable so a new one can spawn:
      setv name "patch_id" 0
   endi
endm

*drop:
scrp 2 8 14852 5
   doif pose lt 15
      stim writ from 19 1
   endi
endm

*eat:
scrp 2 8 14852 12
***pose 2 is the frame of the full plum sprite file in "bouncingplumsv2.c16" and I want the creature to take a bite.
***due to more frames being used upon creation, 4 is now the fully grown plum. changed
   doif pose eq 4
      sndc "chwp"
      stim writ from 78 1
***pose 5 is the frame of the half-eaten plum sprite file in "bouncingplumsv2.c16" and I'm telling the engine that creature has taken a bite.
***same as above. more frames, 7 is now half-eaten. changed
      pose 7
   elif pose eq 7
      sndc "chwp"
      stim writ from 78 1
      wait 10
**the plum has now been completely eaten = kill ownr.      
      kill ownr
   endi
endm

*remove:
rscr
enum 1 205 22929
   kill targ
next
enum 2 8 14852
   kill targ
next
scrx 2 8 14852 4
scrx 2 8 14852 5
scrx 2 8 14852 6
scrx 2 8 14852 9
scrx 2 8 14852 12


Code: Select all
"en-GB"

group DSGB

"Bouncing Plums 2.0"

"Agent Animation File" "bouncingplumsv2.c16"

"Agent Animation Gallery" "bouncingplumsv2"

"Agent Animation String" "4"

"Agent Description" "Juicy plums, with added bounce and now extra growing stages for a more realistic fruit."

"Dependency 1" "bouncingplumsv2.c16"
"Dependency 2" "smit.wav"
"Dependency 3" "chwp.wav"
"Dependency 4" "bouncingplumsv2.catalogue"

"Agent Author" "Laura"
"GB_Category" 1

"Remove script" "enum 1 205 22929 kill targ next enum 2 8 14852 kill targ next scrx 2 8 14852 4 scrx 2 8 14852 5 scrx 2 8 14852 6 scrx 2 8 14852 9 scrx 2 8 14852 12"

"Script Count" 1
"Script 1" @ "bouncingplumsv2.cos"

"Agent Type" 0
"Dependency Count" 4

"Dependency Category 1" 2
"Dependency Category 2" 1
"Dependency Category 3" 1
"Dependency Category 4" 7

"Agent Sprite First Image" 4

inline FILE "bouncingplumsv2.c16" "bouncingplumsv2.c16"
inline FILE "smit.wav" "smit.wav"
inline FILE "chwp.wav" "chwp.wav"
inline FILE "bouncingplumsv2.catalogue" "bouncingplumsv2.catalogue"

Re: Bouncing Plums

PostPosted: Mon Apr 29, 2013 5:08 pm
by malkin
Thank you, Laura! I'm sure this will be really helpful for budding developers out there! :D

Re: Bouncing Plums 2.0

PostPosted: Sun May 12, 2013 10:15 am
by Laura
Due to a problem with the eating script, the Bouncing Plums have undergone a few changes:

- Your creatures should now be able to eat the plums with no problems (thank you to C-Rex for reporting this issue)!
- The bouncing noise has been replaced with something quieter.
- They grow more slowly and rot a bit faster.


A mention also goes out to Ham5ter for his ever-helpful beta testing! There should be no further issues, but please let me know if you happen to stumble across any. :)

Re: Bouncing Plums 2.0

PostPosted: Mon Dec 08, 2014 6:40 pm
by malkin
Version 3.0 is now available at Creatures Caves!

http://creaturescaves.com/downloads.php ... s&view=910

Now it no longer clashes with the Hardman Pack Chili Peppers.