Lesson1.txt

txt file icon
Fact Value
Original File Lesson1.txt
Game
  • Creatures 1
Creator
  • LummoxJR
Wiki Link Search "Lesson1" on creatures.wiki
Tags
File Size: 6 KB

Description(Generated)

Text File Composite

::----- Lesson1.txt -----::
COB Tutorial
Lesson 1: A simple food object 

I've heard a lot of people say they don't know where to start with COB programming. Well, I don't blame you. It's kind of confusing, isn't it? Well, I've decided to start a tutorial series to help.
This lesson: Making a simple food object. I don't mean putting a carrot into the world; I mean making a new type of food from scratch.

Step 1: Planning
I think I'm going to make a variation on cheese. That way, I'll have graphics already available.
Cheese is class 2 6 1. Since I don't want to alter the behavior of existing cheese, I'll have to create an entirely new class of object. Family 2 and Genus 6 are a must; that's the same for all food. I'll make a new species. Let's say this is species 65. I don't think there's another object out with class 2 6 65.

It is very important to make the class unique for each object. If you install a script over an existing script, you'll change the behavior of existing objects.

The sprites I'll use are in the food.spr file. The cheese sprites are 3-5 in the file.

Step 2: Installation
Okay, now I'm ready to start CobCom and edit the object. CobCom starts up with two list boxes displaying "". One of them is for scripts; another is for the installation routine, in the box marked "Installation Scripts" ("Imports" in CobCom 1.02 or earlier). Click on that.
Now, "" appears in the window beneath. This is the editing box, where you'll type in the installation script.

Click in the edit box. Go ahead and delete the line that appears there. Now type in the following:

inst
new: simp food 3 3 3500 0
setv clas 33964288
setv attr 67
bhvr 0 1
edit 

Now, let's examine each line one by one.

inst
This command tells the object injector to execute the rest of this script before updating anything in the game. This is necessary when installing new objects, like we're doing here.

new: simp food 3 3 3500 0
This creates a new simple object with the following properties: 

food The sprite file to use for the new object. 
3 The number of images belonging to the new object. 
3 The index of the first sprite used by the new object. 
3500 The "plane" of the object. This tells the game how far forward or back it is. 
0 Tells whether the image is cloned. I don't understand it either; just put in 0. 
 <...truncated>