Data Realms Fan Forums http://45.55.195.193/ |
|
Lord Tim's Tutorial's (on Chapter 4) http://45.55.195.193/viewtopic.php?f=1&t=13394 |
Page 1 of 1 |
Author: | Lord Tim [ Tue Apr 15, 2008 4:50 am ] |
Post subject: | Lord Tim's Tutorial's (on Chapter 4) |
Here shall be displayed for general use, all of my tutorials, of which I will begin to create. I will also put up any really cool tutorials made by other people, if they're cool enough. Index:
Cool stuff:
All tutorials in .doc format: (Thanks to Yoman987) Attachment: ModdersBible.doc Tutorial help: Variables are those words that hold values in CC. Pretty much all CC modding is changing variables around. Arguments are what the variables hold. There can be many different kinds of arguments. Example: Code: AddActor = AHuman InstanceName = Person Mass = 12 "AddActor" is a special function in CC code that allows you to add new things into the game. "AHuman" is a CC class that is defined by the variables after it. "InstanceName" is on a new line with an extra tab, because it is a variable belonging to the new "AHuman". "InstanceName" holds a string value. "Person" is the string that you are giving to "InstanceName". "Mass" is another variable for the new "AHuman". "Mass" holds a number value. "12" is the number that you give to "Mass". The "AHuman" will now have a "Mass" of "12". Glossary:
Chapter One: Doors. Doors are actors. They share some of the same variables as other kinds of actors. Most doors consist of:
The ADoor actor has these unique variables:
Most of this is pretty straight forward. I might go more indepth in the basics of offsets in a later tutorial. The most common problem people have with doors, however, is the Sensors. The Sensor class has these unique variables:
This is how the sensor is created for the "Door Slide Short" ADoor: Code: AddSensor = Sensor StartOffset = Vector X = -48 Y = 50 SensorRay = Vector X = 52 Y = 0 SkipPixels = 6 This image should help you with figuring out how this stuff works. In the image example, I used the door from my Bridge Door mod (TroubledWaters.rte). The door, on sensing that an actor is on either side, lowers, and allows the actor to cross a gap. Note: "Actors are only sensed when intersecting this line" That means that an atom from the actor has to physically be on one of the same pixels as the line. As long as an actor is in the line, the door will stay open. Also note that I should have used a straight line, like Data does in his Doors. If the line is at a diagonal like that, then an actor might crawl under the sensor on one side. It won't make much of a difference for small doors, but for big doors, that could be a problem. |
Author: | Lord Tim [ Thu Apr 17, 2008 10:52 pm ] |
Post subject: | Re: Lord Tim's Tutorial Compilation |
Chapter Two: The Scene Scenes are the places you go in Cortex Command. Cool people, like me, make scenes. Scenes are not made as often as regular mods, so if you make a good one, you're sure to be called "cool" or "amazing". I get that a lot, at least. Lets go through this line by line. I think that will be helpful. Code tags take up too much space, so I'll just use the list format thing.
To finish up, here's how you create a TerrainDebris object: Code: AddTerrainDebris = TerrainDebris InstanceName = Boulders //Name DebrisFile = ContentFile // When loading, 000-001-002 etc is added automatically before .bmp Path = Base.rte/Scenes/Objects/Boulders/Boulder.bmp // You can have as many (or up to 1000) images as you want. They all have to be in the same location. You manually put the 000,001, etc. on the image's filename, and here all you have to do is define one image. It will get the rest. DebrisPieceCount = 103 //Tell it how many images you made DebrisMaterial = Material //The material the debris is made out of CopyOf = Stone TargetMaterial = Material //The material the debris will be scattered in. Make another TerrainDebris object to have it in more than one material CopyOf = Earth OnlyOnSurface = 0 //Same as Frostings. 1 will make it only go on the top of the material. MinDepth = 0 //How far down the placement will be (assuming OnlyOnSurface is 0) MaxDepth = 300 //See above DensityPerMeter = 1.5 //How close together the debris will be randomly placed And a Background Layer: Code: AddBackgroundLayer = SceneLayer InstanceName = Near Layer AddToGroup = Near Backdrops // For scene editor DrawTransparent = 1 // Do you want it to make the magenta areas transparent? WrapX = 1 // You should make this the same as your scene's warpping. WrapY = 0 // Same here ScrollRatio = Vector X = 0.25 // Make this smaller if you want it to scroll slower. Making it the same as the width of the image or higher will cause it to not scroll at all. Y = 1200 // Make this the height of your image. BitmapFile = ContentFile // Where is the image? Path = Base.rte/Scenes/Backdrops/Middle.bmp Now for the Terrain's BitmapFile. This image has to be in the CC Mat palette (unless you're doing custom materials, but that's really hard, and I explain it below, as well). The colors in the mat palette correspond to the index in Materials.ini, so the first color in the palette is the first material in Materials.ini. When making a scene, you'll probably only need a few colors. Here are just a few of the most common materials: The the "dirt" materials are mostly in order from least strong, to strongest. "Air" is anything Magenta. There isn't really a material there, it just doesn't place anything. Background makes the BackgroundTexture show. Gold places gold pixels. Not nuggets. Test is pretty much invincible. It also doesn't have a texture, and will look weird. Grass that you make will give you textured grass, if you want to do it manually. Here is how you put a custom material into a scene: 1. Create the code for the material like Data does it in Materials.ini. 2. The color of the material will be what it appears ingame. This has to be an in-palette color. 3. The Index of the material has to be the same as the index in the palette of the color that you want to use to color on the scene image. So, this means that you have to use a non-palette'd image for the scene's .bmp. You have to use a non-used up Index, and whichever index you choose, will use the color from the regular palette as the material's placement color. I.E. if you choose Index 39 in the material code, you'd go to index 39 in the regular FG palette, and use that color in the scene .bmp to color it. Then ingame, it'd show up as that material's Color = Color part. Unless you use a texture, then it'll be the texture. And that's about all you need to know for making scenes. The hardest part, really, is thinking up ideas and spriting everything. But it's actually probably even easier that regular modmaking. |
Author: | Lord Tim [ Thu May 22, 2008 5:54 am ] |
Post subject: | Re: Lord Tim's Tutorial Compilation |
Chapter Three: Attaching stuff You can attach either an "Attachable" object or an "AEmitter." Attachables: Here's an example Attachable object. Code: AddEffect = Attachable InstanceName = Soldier Helmet A AddToGroup = Coalition Parts Mass = 3 Sharpness = 1 HitsMOs = 0 GetsHitByMOs = 1 SpriteFile = ContentFile FilePath = Base.rte/Actors/Coalition/HelmetA.bmp FrameCount = 1 SpriteOffset = Vector X = -7 Y = -4 AngularVel = 6 EntryWound = AEmitter CopyOf = Dent Metal Light ExitWound = AEmitter CopyOf = Dent Metal Light AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 4 Depth = 0 DeepCheck = 0 JointStrength = 50 JointStiffness = 0.6 JointOffset = Vector X = 0 Y = 0 DrawAfterParent = 1 GibImpulseLimit = 1500 GibWoundLimit = 5 As you may or may not see, Attachables are pretty much the exact same thing as MOSRotating objects, except for one small difference. Code: JointStrength = 50 JointStiffness = 0.6 JointOffset = Vector X = 0 Y = 0 This means that Attachable objects can have a parent object that they attach to. The strength determines how much force it takes to break the Attachable off the parent. The stiffness effects how easily the Attachable will recieve that force. And the offset determines where on the parent object the Attachable will be located. To attach an Attachable to something you have to have a parent object, say, an AHuman, and an Attachable that you've already made. Then use the simple code in the AHuman's code. somewhere above where you define the gibs. Code: AddAttachable = Attachable CopyOf = Soldier Helmet A ParentOffset = Vector X = -1 Y = -4 Here are what Attachables can and cannot do:
Also able to be attached are AEmitters. AEmitters are attached similarly to Attachables: Code: AddEmitter = AEmitter CopyOf = Some emitter ParentOffset = Vector X = -1 Y = -4 Then the emitters function just like they would anywhere else. The emitters will emit in the direction that they were attached relative to the parent object. If the parent object rotates, then the emitter will rotate with it, and emit in the new direction. The last way to attach stuff is through TerrainObjects. TerrainObjects are placed in scenes or through the build phase, and can have child objects. The difference between attaching Attachables and using TerrainObjects, is that you can attach anything to a TerrainObject. To attach a child object to a TerrainObject, use this code: Code: AddChildObject = SOPlacer PlacedObject = Actor //Or any other class CopyOf = Brain Case //Or any other InstanceName Offset = Vector //Where you want to place it in relation to the TerrainObject(optional) X = 8 Y = -38 Rotation = Matrix //Rotation in relation to the TerrainObject (optional) AngleDegrees = 180 |
Author: | Lord Tim [ Mon Jul 21, 2008 2:40 am ] |
Post subject: | Re: Lord Tim's Tutorial Compilation (Ch3: Attachables) |
Chapter 4: Super Duper New Person Guide The Hello World of Cortex Command. Here, I will attempt to create a tutorial that will let any new member quickly start on the path of modding greatness, as well as instill a sense of modding that keep them from making boring generic mods. Success ensues. Also, the number one thing I would like for this particular tutorial is criticism. Please tell me how you would like this changed to better help the learning process. So you want to make a mod? Well, first thing you're going to have to do is download Cortex Command. Got that? Good. Now navigate to your Cortex Command folder. In it you will see many files. Most of these are useless to you, but there are a few important ones.
If you cannot see the extensions on the files (.exe, .rte, .ini), you need to turn that option on. In Windows, open any folder. Find the "Folder Options" option, switch to the "View" tab, and where it says "Hide extensions for known filetypes", uncheck that box. You want to see the extensions, so that you can edit them later. Personally, I learn best by example, but this tutorial isn't for me, so I won't tell you to just look at the code until you get it. I'll walk you through the mod creation process. The hardest part for most people is syntax. Syntax is the grammar of the game's language. If you don't make your mods according to a very specific syntax, it will give you lots of errors. If you have really, really bad spelling, turn back now. Also, I'll be comparing your new mod's structure to PromGrounds.rte a lot, because that's how the original modmakers learn how to create mods. Data doesn't like us enough to give us documentation. I won't go over the exact details of every file in Base.rte. Eventually, all that info will be available on the wiki, but for now, let's just start by creating a fresh modding set up for you to work with. To begin, right click and create a new folder in the Cortex Command folder (Not inside base.rte or promgrounds.rte). You can name your folder whatever you want, but for the game to see it, you'll have to add a ".rte" at the end, just like "PromGrounds.rte". Data has never really told us what "rte" stands for, but I'd guess something like "Run Time Environment" or "Ready To Eat" or something fancy like that. You don't really need to know all the fancy behind-the-scenes info, though. You have so far:
If you look inside PromGrounds.rte, you'll see that it has a few files. These are going to be very important to your modmaking career. The first, most important file is the "Index.ini". Without this file, your mod won't run. Don't be frightened of the ".ini" suffix, either. It's really just a text file. Try opening "Index.ini" with a text editor like notepad or my favorite Notepad++. I wouldn't use Word, though. Word saves files kind of weird, so the game probably won't be able to read it. Once you open Index.ini in PromGrounds.rte, you'll see.. not much: Code: DataModule IncludeFile = Promgrounds.rte/Scenes.ini The DataModule part tells the game that this is infact a CC mod, and it should be included in the game. The IncludeFile part tells the game which files in your mod to use. In this case, to use the Scenes.ini file. This gets a bit tricky, because if you're a first time modder/coder you might not understand exactly how this syntax works. There are rules, see. For just this small file, you have to know all this:
Intimidating, I know. But other than that, you can do quite a lot. For instance, you can add another "IncludeFile" line, and include more files. So you don't have to put everything in one file. To make a new .ini file, all you have to do is right click, go to New..., and then choose Text Document. It will give you a New Text Document.txt. Rename this to "Index.ini" (Make sure it doesn't have the ".txt" at the end. Just ".ini". If you don't see the .txt in the first place, go up a bit and make Windows show you the file extensions like I told you to). Windows will tell you that changing the file extension might break things, but in this case, it won't, so just click "Yes". For now let's just do something like this: Code: DataModule IncludeFile = MyNewMod.rte/MyNewGun.ini Of course, as you're following this, you can always change the name to something else. But if you do, you have to change it everywhere that it's used. So, to start off, we're going to make a gun. It is good coding to give each prominent object in your mod it's own file. This way, you can quickly find the object if there's an error. If you start to get up to around 1000-2000 lines of code, you're not going to be able to debug it quickly, and it's best to seperate it into a couple of files. So, since you've said that there's a MyNewGun.ini in your Index.ini, go ahead and make that file the same way you make the "Index.ini". Now for the Hello World bit. Since you can use objects that have already been defined in Base.rte, I'll show you how to make a gun using some of the default objects. First thing to do when creating a new gun: Code: AddDevice = HDFirearm Put this as the first line of your "MyNewGun.ini" file. This tells the game that you're creating a new weapon, and you want that weapon to be added to the game's internal list of weapons, so that you can use it later. On the next line (hit enter once), You want to define some of the properties of your new gun. The way to do this is by adding one (1) more tab than the last line. For instance, since your new gun (The AddDevice line) has no tabs in front of it, all of the properties of that gun will be on the lines with one tab. If your gun had an object as a property (We'll get to this in a sec, hang with me), the properties of that object would have two tabs in front of them. A good start would be to name your gun. Add: Code: InstanceName = Hello World Make sure that you have the one (1) tab on that new line. So far, the code looks like this: Code: AddDevice = HDFirearm InstanceName = Hello World What you've done is created a new weapon (HDFirearm) and set the InstanceName property of that object (Hello World). This means that the game will call the gun "Hello World". I hope this is all clear. Since this will be the most basic of guns, we'll skip some of the less-needed properties, and just let them be their default values. A great thing about Cortex Command coding is that you don't actually need to set all of the properties of an object. Just that ones that will make your object unique. However, you do need a few basic properties set if you want to be able to use the gun. For an HDFirearm, you have to have at least:
But let's just start out by creating a boring gun. You can add fancyness to it later, if you want. Next up on the list is the GetsHitByMOs property. This property can either be set to 1 or 0. On or off. If you try to set it to something like 1337, it'll give you an error. Right now, we want to set it to 1, so that way MOs (Moving Objects) will be able to collide. Specifically, we want the actors to be able to collide their hands with it and be able to pick it up. Add this code right under InstanceName: Code: GetsHitByMOs = 1 Next let's do the SpriteFile property. You're going to need a .bmp image to assign to the gun. I'm sure you can find some tutorials around here on the specifics of creating paletted .bmp images for CC, but that takes a long time to explain, and instead, I'll just give you an wholly original image to use. Attachment: MyNewImage.bmp Download that, and stick it in your mod folder. If you've got your own image, you can use that too. But beware, because the CC palette is a finicky thing, and just any image won't do. Now that you've got your image, go back to MyNewGun.ini, and add these lines: Code: SpriteFile = ContentFile FilePath = MyNewMod.rte/MyNewImage.bmp Lets explain this a bit, it's easy really. SpriteFile is the property of the HDFirearm that sets what the image will be. The SpriteFile is set to a ContentFile object. Remember back when I told you you could set properties to other objects? Here, setting the SpriteFile to a ContentFile creates a new ContentFile object. ContentFile objects have their own properties that need to be set, so you go to a new line, and add another tab to show that you're setting the ContentFile's properties and not the HDFirearm's properties. ContentFile has one property that you can set, which is FilePath. FilePath tells the game where to find this sprite. It works a lot like how IncludeFile works from the Index.ini, except now you want it to point to an image. Cortex Command only accepts .bmps in it's special palette, so set the FilePath to the path of the image. Now your gun will show up with that image ingame. Next you'll need to set an AtomGroup property. These are a bit tricky and complex. Infact, I'm not 100% certain what all of it does, suffice to say, I would just go ahead and copy this stuff: Code: AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 2 Depth = 0 Technical description is that AtomGroups are groups of "Atoms" that CC uses to calculate collision on a pixel-by-pixel basis somehow fancy. The material is what the atoms are made of, which in turn changes how the pixels collide. Military Stuff is one of the default materials. Resolution is something fancy. Depth is how deep into the sprite the atomgroup starts generating atoms. But that's all for another tutorial. You don't need to know any of it. AtomGroups are generated automatically by themselves. Now we need to give the gun a magazine. The Magazine property tells the gun what kind and how many bullets to fire. Magazines are actual objects in CC, but we'll put off making a whole new magazine, and I'll show you a different way to add objects. Instead of creating whole new objects, you can copy the properties of other objects of the same type to save time. Add this code to the end: Code: Magazine = Magazine CopyOf = Magazine Pistol What you've done is set the Magazine property of the HDFirearm to a new Magazine object. Then you set all the properties of the new Magazine to be the same as the properties of the object "Magazine Pistol", which happens to be the magazine used in the pistol's code. Lastly, set the RateOfFire. You might be able to figure it out yourself even. All you need to do is go to a new line, press tab, type out RateOfFire, use an equals sign, and then give it any number between 1 and 2147483647. I would recommend a nice round number like 500. The rate of fire in CC is actually number of bullets per minute. So setting it to 500 would mean that your gun will fire 500 bullets if you were firing it for a full minute and you had enough ammo. If you don't set RateOfFire, it won't give you an error, but your gun won't fire any bullets either. And that is it. Now all you have to do is save your .ini file, make sure everything is in the right place, and start up Cortex Command. While it's loading, you should see your mod zip by quickly at the end. If you don't, then you've probably named the .rte wrong. Once the game finishes loading, just start up a skirmish on a scene where you can place stuff, go down to "Weapons", and you should see "Hello World" if all went well. Place your gun, pick it up, and be amazed at the power of Cortex Command .ini modification! Questions/Comments feel free to PM me or post in this thread. Tell me what you'd like me to add or change. Where to next?
|
Author: | Kelas [ Thu Jan 08, 2009 5:50 pm ] |
Post subject: | Re: Lord Tim's Tutorial's (on Chapter 4) |
This is really handy and people should read it. Bugs and problems should get PM'd to the OP. OP should PM staff if they need to update. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |