Jump to content

Jedi Academy turned 20 this year! We celebrated in a ton of different ways: mod contest, server event, podcast, etc. Thank you to all who have been a part of this game for the last two decades. Check out the anniversary content!

Read more

Welcome to JKHub

This community is dedicated to the games Star Wars: Jedi Outcast (2002) and Jedi Academy (2003). We host over 3,000 mods created by passionate fans around the world, and thousands of threads of people showcasing their works in progress and asking for assistance. From mods to art to troubleshooting help, we probably have it. If we don't, request or contribute!

Get started

This game turned 20 years old this year, and it is still one of the greatest Star Wars games of all time. If you're new or returning from a long hiatus, here are the basics of getting started with Star Wars Jedi Knight Jedi Academy in 2023.

Read more

Basic knowledge of coding menus


afi

Basic knowledge of coding menus

 

Prior Knowledge Requirements: Creating/Modifying/Opening .Pk3s

Tools: PakScape, a good text editor like EditPlus.

 

Coding menus in Jedi Knight is not hard at all and can be compared to markup languages like HTML.

Calling it "coding" is actually not completly correct but since everyone does so, I'm gonna do so as well.

 

My goal with this tutorial is just to give you some small overview. I will go more into detail in future tutorials.

 

Your first step is to open PakScape and to extract all the ui-files (located in assets1.pk3) to your hard drive.

Now open the file main.menu with your text editor.

As you can see a menu consists of several different parts.

 

The assetGlobalDef affects all menu files and can only be found in the main.menu.

The menuDef is the header of every menu and sets stuff like the resolution, the name of the menu, etc.

The itemDefs are the actual elements of a menu. Text, images, buttons or videos are all itemDefs.

 

To go more into detail:

 

assetGlobalDef:

 

For beginners there is actually not much that is important to alter (there is also a lot hardcoded). I will explain in a future tutorial how you can change the fonts though.

 

menuDef:

 

name - sets the name of the menu. Attention! The name of the menu file (e.g. main.menu) can differ from the actual name of the menu that is set in the menuDef. I will explain later why this is important.

fullScreen - The main menu has to be fullscreen, other menus can open as a small window.

rect - sets the position and the resolution of the menu. If fullScreen is set to 1, it should be always set to 0 0 640 480.

visible - defines the visibility of the menu. Better set it to 1.

focusColor - sets the color of the item that is in focus (= in contact with the mouse).

desc... - the description-text that appears when you hover over the buttons (usually located at the bottom of the menu).

descX, descY - the positioning of the desc-text.

descScale - the size of the desc-text.

descColor - the color of the desc-text.

descAlignment - the alignment of the desc-text.

 

Itemdef

The Background (for example the Star Wars-logo on the top):

 

name - sets the name of the item. Can be important if you want to open or focus items.

group - can be useful if you want to centralize several items in one group.

style - defines the style of the item.

WINDOW_STYLE_EMPTY no background

WINDOW_STYLE_FILLED filled with background color

WINDOW_STYLE_GRADIENT gradient bar based on background color

WINDOW_STYLE_SHADER gradient bar based on background color

WINDOW_STYLE_TEAMCOLOR team color

WINDOW_STYLE_CINEMATIC cinematic

rect - the position and the resolution of the item. (Explanation in the end of the tutorial.)

background - the path of the background-image. Can also be a path to a shader-file.

forecolor - the fore color used in the item. Only useful if you use a color instead of an image as a background.

visible - defines the visibility of the item.

decoration - makes you not touching and picking the item with the mouse.

 

The Button (for example the Loadgame-button)

Pretty similar to the background-items. You can actually also use an image to be a button. But in JK:JA there are only text-buttons used.

 

text - the path to the text-string (I will explain that in a future tutorial).

descText - the path to the description text-string.

font - the font used for the text (1-4).

textscale - the size of the text.

textaligny, textalignx - changes the position of the text.

textalign - the alignment of the text.

textstyle - there are different textstyles, like shadowed text.

type - important command that can be used to implement listboxes, checkboxes, etc.

ITEM_TYPE_TEXT simple text

ITEM_TYPE_BUTTON button, basically text with a border

ITEM_TYPE_RADIOBUTTON toggle button, may be grouped

ITEM_TYPE_CHECKBOX check box

ITEM_TYPE_EDITFIELD editable text, associated with a cvar

ITEM_TYPE_COMBO drop down list

ITEM_TYPE_LISTBOX scrollable list

ITEM_TYPE_MODEL model

ITEM_TYPE_OWNERDRAW owner draw, name specs what it is

ITEM_TYPE_NUMERICFIELD editable text, associated with a cvar

ITEM_TYPE_SLIDER mouse speed, volume, etc.

ITEM_TYPE_YESNO yes no cvar setting

ITEM_TYPE_MULTI multiple list setting, enumerated

ITEM_TYPE_BIND multiple list setting, enumerated

ITEM_TYPE_TEXTSCROLL scrolls text

ITEM_TYPE_INTSLIDER mouse speed, volume, etc.

 

The "on"-commands

 

Only used in the menuDef:

onOpen - stuff that happens when the menu gets opened

onEsc - stuff that happens when the menu gets closed

 

Used in the itemDefs:

Action - gets executed when you click on the item. For example a new menu opens.

mouseEnter - gets executed when you touch the item with the mouse.

mouseExit - gets exectued when tou leave the item with the mouse.

doubleclick - gets executed when you doubleclick the item.

 

Rect

 

The rect-command works like this:

rect X Y W H

 

X = horizontal position

Y = vertical position

W = width

H = height

 

Colors

 

The colors work like this:

color R G B T

 

R = red

G = green

B = blue

T = transparency

 

All values can go from 0 to 1.

 

 

Loading menu files.

 

There are textfiles which are responsible for loading the actual menu files. For example the file that loads the singleplayer menus is called menus.txt.

Please note that the engine loads the menus by their actual filename not their "menu-name" that is defined in the menuDef.

 

 

This concludes my tutorial about basic menu coding.


User Feedback

Recommended Comments

Just wanted to add that if you need more technical details for any of the menu stuff not covered in the basic tutorial, JKA's menus are basically identical to the one's listed in the Quake III documentation located here.

afi likes this
Link to comment


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...