A Force Of Your Own

Written by Brian Taylor

It was made to be edited. Created by Yves Borckmans, who knew how tough it could be to figure out a programming language, Cog is simple, yet complex, elegant, yet simple, similar to C, yet simple, and did I mention that it is simple? How simple? Uhm, like, so simple, even a child can do it! (Cliche, no?)

Wasn't that nice? Didn't it grab your attention? (I think I should start the article now) Cog is the language which almost everything in Jedi Knight is controlled by. Want to make that Dark Jedi have no Force powers and be saberless? Want to throw your lightsaber at six enemies scattered across the room? Want to drive a vehicle? It's possible. Anything and everything can be done with Cog. Cog has been compared to C+, Duke .Con files, and something else, probably. So if you have experience editing these, you WILL be able to edit Cog. You WILL NOT try. You WILL do. I have made patches that rip off arms, make the bowcaster shoot lightning bolts (a personal favorite), throw the saber (Although somewhat buggy), and knock all your enemies away from you (Force Repel).

To get started editing Cogs, you'll need a Gob extractor (Such as ConMan or JKGob, from www.darkjedi.com), a text editor (Notepad or Wordpad will work), and time. A copy of the Cog Specs (Yes, that was a pathetic self-promotion) would help too. You can find a copy at Inside3D. Assuming you have all of this, it's time to start.

First, let's look at the types of cogs you'll find in res2.gob :-

  1. xx_ - These cogs, starting with a two digit numeral code, control happenings in a level. (Conveyor Belts, Elevators, doors). Basically, the level's INF. The numbers apply to the level it will be used in.
  2. actor_ - Doesn't control what an enemy does in the game (AI's do that). Rather, it controls what happens when certain events occur.
  3. class_ - Turrets and sequencer charges are the only things that use class_ cogs.
  4. ctf_itemkeycolor - The Capture the flag key. The color is either red or gold.
  5. darkjedi_ - Hmm? What are these for? They control the Force abilities, saber colors, and damage reactions.
  6. force_ - Force powers.
  7. item_ - The things in your inventory. (These cogs usually just control what happens when you select something (It shows the name), but with things such as fieldlight and the Goggles, it also controls what happens when you activate them.)
  8. kyle.cog - Controls what happens when you die, start a level, block things with your saber, etc.
  9. pow_ - Controls what happens when you get an item.
  10. weap_ - Weapons. What they shoot, what ammo they use, if they kick backwards, etc.
If you want to learn more about the code than I cover here, check out my cog specs (Another shameless self-promotion)

Editing time!!!! YAY!

Ok. First up, something really easy: Making the crossbow shoot lightning bolts. First, extract weap_crossbow.cog from the Res2 gob (In the Resource directory of either your JK folder, or the CD, depending on the install), and open it in a text editor. Look at the top part, where everything has a # before it: this is the header. Everything with a # before it is ignored by the game. The next part is the symbol section, where everything is defined. See the lines that say -


- change crossbowbolt, crossbowbolt2, and crossbowbolt3 to force_lightning, so it now says -


Save the cog, put it in your resource\cog folder, and play! (Remember - Cog patches don't work on saved games) When you charge the bow, it will shoot five lightning bolts at once, like it used to shoot five bolts before.

I know that was short, but you have to start simple. I would advise that you read over the Cog Specs (Three times now!) code section to get a better feel for the code. This next one is a little more advanced. (Note: I said a LITTLE. This is really basic stuff.)

Don't think Force Speed gives you enough of a speed boost? Want to go faster? I mean, so fast that if you ran into a wall, you would lose half your health? (Not really) If you modify this, it will make CTF games easier (remember: EVERYONE playing must have the same modified files). Extract and open force_speed.cog and scroll down to the code section. Look for the line that says -

SetActorExtraSpeed(player, 0.5 + rank / 2);

This means, basically, so set your speed to normal plus 1/2 of normal plus half the rank. Change the 0.5 to either make yourself go faster or slower (Give everyone in the game a modified patch that slows them WAY down (Don't tell them). But only if you want to be a bad sport. (I've never done this. ;] *innocent look*) Are you done? Go test it!