[Patch Plant] [Patch Plant] Medlar

An organized, ideally complete bank of released Garden Box agents. Find some new life to add to your world, or submit your own! Be sure to read the guidelines before submitting.

[Patch Plant] [Patch Plant] [Patch Plant] Medlar

Postby malkin » Mon Aug 06, 2012 10:34 pm

The fetid Medlar comes from the Toxic Norns' home world. Toxic Norns will find this manky very nutritious, but other creatures may become intoxicated.
Medlarpreview.png (51.04 KiB) Viewed 10133 times
(15.8 KiB) Downloaded 1093 times
Posts: 131
Joined: Sat Feb 11, 2012 3:55 am

Re: Medlar

Postby malkin » Thu Apr 18, 2013 6:32 pm

Just thought I should publish the source code to this, in the hope of helping other developers. :geek: For this one, I had trouble getting my agent to compile correctly.

Code: Select all

*Flag agent, stores information about my patch plant

new: simp 1 205 10853 "blnk" 0 0 9000

*The first thing you're going to do is define the number of your spawn script - script 1000.
*This is the script that the patch core will trigger when it's time to spawn a fruit/bud/whatever.

setv name "spawn_script" 1000

*Now you have to define the file name and image number of the sprite that will represent your plant
*when it is fully grown. This will be used both in placing a fruit/bud and serving as the little
*indicator that shows on the hand when you're placing the patch.

sets name "sprite_file" "medlar"
setv name "sprite_pose" 13

*finally, you need to define the classifiers for your produce

setv name "prod_fmly" 2
setv name "prod_gnus" 9
setv name "prod_spcs" 10853

*Now that you have everything defined, you need to contact the patch core agent (1 1 22929) and let
*it know that you're here-- the patch scripts will take it from there and generate the
*placement windows, let the user choose options, and so on.

seta va00 targ
enum 1 1 22929
   mesg wrt+ targ 1000 va00 0 0

**That's it for your install script!

*Now for your spawn script-- this is 1000 as we defined it in the install script.
scrp 1 205 10853 1000
*If this script is running, it's because the patch core decided it was time for your
*patch to spawn a new bud. It has also sent the coordinates it has decided were proper in
*_p1_ (x) and _p2_ (y)

*So first, create your little fruit to be:
*As of May 2012, patch_plane lets the users choose which plane the fruit will appear on.
   new: simp 2 9 10853 "medlar" 14 0 name "patch_plane"
   attr 80
   bhvr 48
   accg 2
   perm 64
   fric 100
   elas 30
   aero 2
*And move it to the coords sent by the patch agent:
   mvto _p1_ _p2_
*Now, a few new name variables have been defined in your patch flag agent since you last
*left it-- these are settings that have been defined in the options window as well as a
*unique patch ID number that has been generated. You'll need to copy these over to your
*your budding fruit!
*The patch ID is important-- if you don't copy it over, the patch plant won't realize that
*the fruit is there, and it will spawn another one, and continue spawning FOREVER.
   setv name "patch_id" mame "patch_id"
*then there's the ticks as set in the options panel:
   tick rand mame "tickfrom" mame "tickto"
*personally I like to define a default tick too, in case something goes wrong and the tick ends
*up as 0.
   doif tick eq 0
      tick 200

*This is the fruit pickup script, copypasted from Clabs
scrp 2 9 10853 4
*if it hasn't been picked up before, a few things are going to change...
*like it starts actually acting like fruit~
   doif ov00 eq 0
      setv ov00 1
   doif attr eq 67
      attr 195
   perm 60

scrp 2 9 10853 6
   doif carr eq null
      plne 4000

*And the timer....copypasted but greatly edited!
scrp 2 9 10853 9

   doif ov00 eq 0
      doif carr eq null
         doif pose lt 13
            setv va00 pose
            addv va00 1
            pose va00
*changed from 64 to 80
            doif attr eq 80
*this is the turning point at which it becomes edible~
               attr 67
            addv ov99 1

         doif ov99 ge 20
            setv ov99 0
            doif attr eq 67
               attr 195
            setv ov00 1
*if ov00 is 1, it's been picked or fallen, and thus stops growing and starts rotting.
   doif ov00 eq 1
*We're going to set its patch id to 0 now.. this detaches it from the patch itself
*So that it doesn't count toward the number that can grow on the bush
      setv name "patch_id" 0
      addv ov99 1
      doif ov99 ge 50
         doif carr eq null and room targ <> -1
            altr room targ 4 0.01
            altr room targ 3 0.01
            kill ownr

*eat script!
scrp 2 9 10853 12

   setv va00 posl
   setv va01 post

   stim writ from 78 1
   stim writ from 82 1

   wait 10
   snde "eat1"
   kill ownr

enum 1 205 10853
   kill targ
enum 2 9 10853
   kill targ

and now the PRAY file:
Code: Select all

group DSGB "Medlar"

"Dependency 1" "gb_pp_medlar.c16"
"Dependency 2" "medlar.c16"
"Dependency 3" "medlar.catalogue"
"Dependency 4" "gb_pp_medlar.c16"
"Dependency 5" "medlar.c16"
"Dependency 6" "medlar.catalogue"
"Agent Animation Gallery" "gb_pp_medlar"
"Agent Description" "This medlar is a little manky."
"Agent Animation File" "gb_pp_medlar.c16"
"Agent Animation Gallery" "gb_pp_medlar"
"Agent Author" "Amaikokonut/Malkin"
"Remove script" "enum 1 205 10853\n   kill targ\nnext\nenum 2 9 10853\n   kill targ\nnext"

"Script Count" 1
"Script 1" @ "medlar.cos"

"Agent Type" 0
"Dependency Count" 6
"Dependency Category 1" 2
"Dependency Category 2" 2
"Dependency Category 3" 7
"Dependency Category 4" 2
"Dependency Category 5" 2
"Dependency Category 6" 7
"Agent Sprite First Image" 0
"GB_Category" 1

inline FILE "gb_pp_medlar.c16" "gb_pp_medlar.c16"
inline FILE "medlar.c16" "medlar.c16"
inline FILE "medlar.catalogue" "medlar.catalogue"

And here's the CAOS2PRAY information, which went just before the *flag agent commentary:

Code: Select all

*GB Template
*# Pray-File "gb_pp_medlar.agent"
*# DS-Name "Medlar"

*# Depend gb_pp_medlar.c16
*# Depend medlar.c16

*# Depend medlar.catalogue
*# Attach gb_pp_medlar.c16

*# Attach medlar.c16

*# Attach medlar.catalogue

*# desc = "This medlar is a little manky."
*# Agent Animation File = "gb_pp_medlar.c16"
*# Agent Animation Gallery = "gb_pp_medlar"
*# Agent Sprite First Image = 0
*# GB_Category = 1
*# Agent Author = "Amaikokonut/Malkin"
Posts: 131
Joined: Sat Feb 11, 2012 3:55 am

Return to Agents Collective

Who is online

Users browsing this forum: No registered users and 1 guest