creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
Stuck on Starting First Plant Agent   
CosmiSynth

CosmiSynth
United States  

 visit CosmiSynth's website: My Tumblr!
  2/10/2016

Heylow people on the dev forum! I'm raring and ready to go - I have my sprite-making skills in gear, I have all the dev tools I could find relevant to making agents, I've looked through the main tutorial on how to make a simple plant, and have browsed through the guts of a few pre-existant ones that I've decompiled. I've also skimmed through other relevant tutorials.

... Still, I'm having a bit of a hard time putting two and two together.

I think[/] I understand roughly what the different pieces of the tutorial mean, or at least I can eventually get the hang of what I see, but the problem I'm having is that I don't know how to go about putting those bits and pieces in a .cos file. I don't have an example of the full "simple plant" .cos file to look at in comparison to the tutorial, so it's making it a bit hard for me to understand how I should paste and organize a working .cos file.

(Also, if we can get this problem sorted, it'd be great to know how to work from there and code a plant so it has unique death sprites.)


The Crafty Shee & Co.
 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  2/10/2016

You're using the Basic plant script at the Creatures Wiki, right?

You need some kind of a text editor to make a cos file - either the official CAOS Tool, or TextWrangler, NoteTab Light, TextEdit, Notepad, etc. You already have hundreds of examples of working cos files in your bootstrap folders. All of the official plants, animals, etc. use cos files. I can't recommend the C3 Bootstrap V2 enough as a development tool - it has comments for most of the C3 .cos files.


My TCR Norns
 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  2/10/2016

I haven't explicitly worked much with POSE, but I imagine it like a dance teacher, saying to the student/agent 'Strike a pose! Now pose 7! Now pose 8!' and the student/agent taking those poses. I believe that pose is relative to whatever amount of images you use in your agent, rather than the total amount of images in the sprite file.

When you create an agent, the TICK tells your agent how often to run your timer script. A lot of agents with a lifespan work by using an object variable to increment up (or down) every time the timer script runs, until they are too old, then they die of old age.

I think you can use a doif command, properly constructed, to control the life stages.

Let's say that the tick is 300 - 15 seconds.

let's say that you're counting up ov05 by 1 every time in your timer script.

addv ov05 1


you can 'skip a beat' by making the pose only change on every second run through of the timer script, by using a doif to change the pose.

doif ov05 = 2 or ov05 = 4 or ov05 = 6 or ov05 = 8 or ov05 gt 22


So this will happen every 30 seconds, or at the latest, after 5 and a half minutes.

Check the pose - if it is the final, rotten pose, kill the agent, or ELSE take the next pose up.

Beyond that, you can use ATTR to make sure that creatures can't see your plant until it is mature - which is a useful trick from things like apples and carrots, which you don't want creatures to eat until they are mature.


My TCR Norns
 
Papriko
Peppery One

Papriko



  2/11/2016

To be honest, I always thought that plants and critters are some of the harder things to begin with. Organizing the lifecycle and balancing the reproduction can be a real hassle.

Anyways, the first 3 things your plant needs are
1) a working injection, e.g. by spraying seeds into a certain room
2) a main living script, ideally using the aforementioned timer script (script ID 9)
3) a simple remove script.

The creation script is the new: something plus the physical attributes like ACCG, AERO, PERM and so on and moving the object to a safe position. It typically goes at the very top of a cosfile. Make this work even if your plant does not even have any scripts to function properly yet. Make sure the plant goes where it is supposed to go and does no funny things, like flying off-screen or bouncing all over the place (unless you WANT that, of course).
This is also where you initialize variables you might need, such as a basic lifeforce or age counter.

The next step is making the removal script. It goes to the end of the cosfile and is introduced with RSCR. You want to run an enum # # # kill targ next for all classifiers/different agent types you used in order to remove them from the world and a scrx # # # # for each script you created, so the scripts no longer linger around. Since you are adding scripts later on, you may want to come back to your remove script from time to time to accommodate these changes.
It is extremely useful to have one early on, though, as the remove script will come in handy while testing, to get rid of pesky earlier prototypes.

The next is the timer script. This is where all the living happens. The nice thing is that it works very modular, so you can add stuff step by step. Once a thing works, you can easily move on to the next thing.
Start out with something simple, like growing every so often by changing the pose and stopping when fully grown.
From here you have a good position to tackle the more intricate parts of the script.

Then, when your basic plant is done, then you can think about adding extra actions like eating scripts for the seeds or emitting smells or something like that. These are all things that just "dangle" from the main lifecycle. It is the best to just slap them on top when you are done with the timer script.

Another tip I can give is this: make your plant age rather fast, maybe a step every 10-20 seconds or so. That way you can effectively test it without having to sit around forever. Once everything works as intended, you can slow down the whole thing to a reasonable speed simply by adjusting the TICK value.


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
1 online
Malkin
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki