In Dark Forces, Kyle Katarn, a young mercenary successfully infiltrated the Empire. Jedi Knight continues the story of Katarn as he embarks on a quest into his past and learns the mysterious ways of the Jedi. With this knowledge, he must stop seven Dark Jedi from unlocking the powers of a hidden Jedi burial ground. This task forces Katarn to decide his destiny. If he chooses the Dark side, he will come into enormous power. If he chooses the Light side, he faces seemingly insurmountable evil. Whatever path Katarn chooses will change the face of the galaxy forever.

Post tutorial Report RSS Key Assignment

In this tutorial, veteran COG expert Brian Taylor shows you how to adding keys to Jedi Knight so you can add patches (eg. grappling hook) to the key selection menu.

Posted by on - Advanced Client Side Coding

Tutorial originally posted on Jediknight.net. Mirrored here for archival purposes.

Key Assignment
Written by Brian Taylor


Note: I'm assuming that you have some Cog editing experience, watch Buffy, and have used my grappling hook patch. With that said, lets get started.

People, today we're going to learn the best way to create patches for Jedi Knight: Not replacing anything, but adding a new item completely! Aren't we excited? (Watch Buffy)

First of all, extract items.dat from res2.gob and jkstrings.uni from res1low(or high).gob. Now go watch Buffy. Next, get a cog file (like the fieldlight cog, or possibly the hook.) Open Items.dat. Look for -

bactatank         40         0 5 0x102 cog=item_bacta.cog
irgoggles         41         0      1      0x102 cog=item_irgoggles.cog
fieldlight         42         1      1      0x122 cog=item_fieldlight.cog
here's what this all means:
bactatank ---- This is used to find the bm file. The engine will look for "an icon named icXXXXX8.bm or icXXXXX16.bm in the UI\bm directory, where XXXXX are the first 5 letters of the name in items.dat" so it looks for icbacta8.bm or icbacta16.bm Until we can create new bms, you have to use an existing name, or else jk will crash.40 ---- This is the bin number0 ---- Minimum bin value5 ---- Maximum Bin value0x102 ---- Flag (this is important)
Copy one of those lines (like, fieldlight), then paste near the bottom, so you get this:
goal15          115      0         1000        0x040 
fieldlight          42      1         1        0x122 cog=item_fieldlight.cog
hotkeyOffset  150      0         99999      0x000 
Then change the 42 to a 116, and the cog to your cog name (in this case, watch_buffy.cog)
goal15          115      0         1000        0x040 
fieldlight          116      1         1        0x122 cog=watch_buffy.cog
hotkeyOffset  150      0         99999      0x000 

This will now display the fieldlight picture for your item. Go ahead and save items.dat and close it. We're done with it. Next, open up jkstrings.uni, and scroll down till you get to -

"ACTIVATE15" 0 "IR Goggles"
"ACTIVATE16" 0 "Field Light"

Ok. ACTIVATE15 Will search items.dat for the 15th entry with flags set to 0x100, or anything else with a 0x1xx....Which in this case is bin 41 (IR Goggles). After these lines, add -

"ACTIVATE17" 0 "Watch Buffy"

Next, scroll to the top of the screen, and update the message count from 900 to 901. So now, at the bottom of the control section under options in the game, it will say "Watch Buffy", and you can bind a key to it. Simple, right? Well, there are some limitations.

As of right now, I'm not exactly sure how you would go about adding Force Powers, since they would need to be added to the Force Star chart. Another problem is weapons. Weapons run on a Select1 (fists) to Select0 (saber), so the only way to add a new weapon (without a lot of Cog Programming), is, well, to wait for MotS and hope they change from select1 to select01. And you can only add bins up to 199, and only have 33 total ActivateXX messages. Hope this helps you like, make cool things.


Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: