Created By: Chris Voss
eMail:
Difficulty Scale: Easy


Chris Voss' Quake Menu System

Step 1: This is a tutorial to show you how to make a menu. For this one I am making a class menu because that is what I use it for. This will display a menu for the player when they start a new level and no impulses work until the choices are made off of the menu.

Step 2: First thing you should do is make a new .qc file, I'll call it menu.qc, and put this in it:

/*
==================================================
Menu.qc By: Chris Voss 3-18-99
==================================================
*/
.float    count;    // for counting triggers
.float    menu_count;
.float    menu_time;
.float    class;    // object.class is what this will be
float    c_none=1;    // no class
float    c_mage=2;    // Mage class
float    c_warrior=4;    // Warrior class
void() GetClass =
{
    if (self.class==c_none)  // If they haven't chosen a class do this
    {
        if ((self.menu_count < 1) && (self.menu_time < time))
        //1 = seconds the menu will be displayed but it redisplays over and over
        {
            self.menu_time = time + 1;
            self.menu_count = self.menu_count + 1;
            centerprint(self, "(1)Be a Mage\n (2)Be a Warrior\n"); //this is what your choices are in the menu
            return;
        }

        if (self.menu_count == 1) //If they haven't chosen anything
        // then restart the display
        {
            self.menu_count = 0; // set it to 0 again
        }
    }
    else
    {
       return;
    }
};

// this is called when an impulse is called instead of regular impulses
void(float inp) ChangeClass =
{
    if (inp == 1)
    {
        self.class = c_mage; // set to mage class
        sprint (self, "You are a Mage\n");
    }
    else if (inp == 2)
    {
        self.class = c_warrior; // set to warrior class
        sprint (self, "You are a Warrior\n");
    }
};

and when finished save it, open up progs.src and put the menu.qc filename right before weapons.qc.

Step 3: After that open up client.qc and goto the function PutClientInServer() and scroll down to where it says:

self.invincible_time = 0;

after that put:

self.class = c_none; //This sets your class to nothing used later

Step 4: Then scroll down to the function PlayerPostThink() then goto the line that says:

CheckPowerups ();

then under that put:

GetClass();

close client.qc and save it.

Step 5: Open up weapons.qc and goto ImpulseCommands() function then replace the function with this:

void() ImpulseCommands =
{
    if (self.class != c_none) // If they have a class go regularly
    {
        if (self.impulse >= 1 && self.impulse <= 8)
            W_ChangeWeapon ();

        if (self.impulse == 9)
            CheatCommand ();
        if (self.impulse == 10)
            CycleWeaponCommand ();
        if (self.impulse == 11)
            ServerflagsCommand ();
        if (self.impulse == 12)
            CycleWeaponReverseCommand ();

        if (self.impulse == 255)
            QuadCheat ();

        self.impulse = 0;
    }
    else // If they don't have a class do this
    {
        SecondImpulse(); // call special impulse commands below
    }
};

void() SecondImpulse =
{
    if (self.impulse == 1)
        ChangeClass(1); // call class change commands
    if (self.impulse == 2)
        ChangeClass(2); // call class change commands
};

Step 6: Save it all and compile and prepare for the menu to show up on the screen when you first start the game.