Fact | Value |
---|---|
Original File | lesson5.txt |
Game |
|
Creator |
|
Wiki Link | Search "lesson5" on creatures.wiki |
Tags |
File Size: 7 KB
Text File Composite
::----- lesson5.txt -----:: COB Tutorial Lesson 5: Cheese vendor NOTE: I've replaced cven.spr with a ZIPped version of the file. The old one did not always download correctly. So far we've covered food, removers, objects with external scripts, and weeds. Let's move on to another very important type of object: vendors. Many of us are familiar with the carrot vendor. But the carrot vendor appears in a remote part of Albia, largely inaccessable to Norns who might need it elsewhere. Fortunately, there are carrots in the garden. But what about cheese and other foods? Cheese is the most nutritious food in Albia, and most of us don't want to be bothered injecting it every time a Norn is really hungry. So why not make a way for Norns to get cheese whenever they want it? Step 1: The sprite file What's different about this COB is that it has a sprite file to go with it: The cven.spr file is needed to display the cheese vendor. (We could use the carrot vendor's sprites, but that displays- surprise!- carrots.) Currently the easiest way to make SPR files is to create a bitmap (.BMP) file with an image editor, then change it to an SPR file with Alexander Laemmle's COE. (If you use version 1.4 of COE, you'll need to make sure all the colors in your image use only the colors in the Creatures palette.) This sprite file is 64 pixels wide, 100 high. This information will be important later. To use this COB, you must copy cven.spr to the \Images directory. If you make a COB with its own sprites or sounds, be sure to make a text file with instructions on how to do this; otherwise, people will make the Newbie Mistake and forget. Step 2: The object classes This step is important, but brief. It's important to put the vendor object in family 2, genus 8; those are the vendor objects. I'm going to choose species 65, which I've used for a lot of objects in the tutorials; hopefully no one else has made an object of class 2 8 65. The cheese objects are all class 2 6 1. Scripts for eating cheese are already installed in the scriptorium (they'd better be!), since there's cheese in the world when the world is created. There's no need to install new scripts for cheese, just to create the cheest object itself. It will know what scripts to use, since we'll tell it it's in the same class as all the other cheese in the world. Step 3: The installation script Start CobCom and click the list box marked "Installation Scripts" ("Imports" in CobCom 1.02 or earlier). In the edit box, type in the following: inst new: simp cven 1 0 500 0 setv clas 34095360 setv attr 70 bhvr 1 1 edit Now, let's look through the new lines for this script. new: simp cven 1 0 500 0 Well, we're making a new object that uses the cven.spr sprite file. That's nothing new. You may notice, though, that I wrote in 500 for the image plane (how far forward or back the object is) instead of the usual 3500. Most objects use 3500, but we want this to appear behind the creatures who use it; I experimented and found out that 500 will do, though 1000 will not. setv clas 34095360 This object is in family 2, genus 8, species 65. <...truncated>