Lights Out!

Difficulty: Easy

The colors:

  • New code
  • Original Xatrix code
  • Comments

This will show you how to make a mod like Midnight Massacre.Choose a mod you want to use for example Kingpin SDK or Monkey Mod.

Open G_spawn.c and search this (somewhere at the end of the file):

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

    // DAN 28–OCT-98
    // 0 normal
    gi.configstring(CS_LIGHTS+0, "m");
    
    // 1 FIRE FLICKER (first variety)
    gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo");
    
    // 2 SLOW STRONG PULSE
    gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
    
    // 3 CANDLE (first variety)
    gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
    
    // 4 FAST STROBE
    gi.configstring(CS_LIGHTS+4, "mamamamamama");
    
    // 5 GENTLE PULSE 1
    gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
    
    // 6 FIRE FLICKER (second variety)
    gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno");
    
    // 7 CANDLE (second variety)
    gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm");
    
    // 8 CANDLE (third variety)
    gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
    
    // 9 SLOW STRONG STROBE
    gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz");
    
    // 10 FLUORESCENT FLICKER (first variety)
    gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma");

    // 11 SLOW PULSE FADES TO BLACK
    gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
    
    // new kingpin light styles (these are still temp)
    // 12 FIRE FLICKER (third variety)
    gi.configstring(CS_LIGHTS+12, "mmnommomhkmmomnonmmonqnmmo");
    
    // 13 FLUORESCENT FLICKER (second variety)
    gi.configstring(CS_LIGHTS+13, "kmamaamakmmmaakmamakmakmmmma");

    // 14 FLUORESCENT FLICKER (third variety)
    gi.configstring(CS_LIGHTS+14, "kmmmakakmmaaamammamkmamakmmmma");

    // 15 REALISTIC FADE (first variety)
    gi.configstring(CS_LIGHTS+15, "mmnnoonnmmmmmmmmmnmmmmnonmmmmmmm");

    // 16 REALISTIC FADE (second variety)
    gi.configstring(CS_LIGHTS+16, "mmmmnonmmmmnmmmmmnonmmmmmnmmmmmmm");
         
    // 17 SLOW STRONG STROBE (out of phase with 9)
    gi.configstring(CS_LIGHTS+17, "zzzzzzzzaaaaaaaa");

    // 18 THREE CYCLE STROBE (cycle 1)
    gi.configstring(CS_LIGHTS+18, "zzzzzzzzaaaaaaaaaaaaaaaa");

    // 19 THREE CYCLE STROBE (cycle 2)
    gi.configstring(CS_LIGHTS+19, "aaaaaaaazzzzzzzzaaaaaaaa");

    // 20 THREE CYCLE STROBE (cycle 3)
    gi.configstring(CS_LIGHTS+20, "aaaaaaaaaaaaaaaazzzzzzzz");
    // END 28–OCT-98

    // styles 32-62 are assigned by the light program for switchable lights
    // styles 32-62 are assigned by the light program for switchable lights

    // 63 testing
    gi.configstring(CS_LIGHTS+63, "a");

}

Replace the code with this:

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

    // DAN 28–OCT-98
    // 0 normal
    gi.configstring(CS_LIGHTS+0, "a");
    
    // 1 FIRE FLICKER (first variety)
    gi.configstring(CS_LIGHTS+1, "a");
    
    // 2 SLOW STRONG PULSE
    gi.configstring(CS_LIGHTS+2, "a");
    
    // 3 CANDLE (first variety)
    gi.configstring(CS_LIGHTS+3, "a");
    
    // 4 FAST STROBE
    gi.configstring(CS_LIGHTS+4, "a");
    
    // 5 GENTLE PULSE 1
    gi.configstring(CS_LIGHTS+5,"a");
    
    // 6 FIRE FLICKER (second variety)
    gi.configstring(CS_LIGHTS+6, "a");
    
    // 7 CANDLE (second variety)
    gi.configstring(CS_LIGHTS+7, "a");
    
    // 8 CANDLE (third variety)
    gi.configstring(CS_LIGHTS+8, "a");
    
    // 9 SLOW STRONG STROBE
    gi.configstring(CS_LIGHTS+9, "a");
    
    // 10 FLUORESCENT FLICKER (first variety)
    gi.configstring(CS_LIGHTS+10, "a");

    // 11 SLOW PULSE FADES TO BLACK
    gi.configstring(CS_LIGHTS+11, "a");
    
    // new kingpin light styles (these are still temp)
    // 12 FIRE FLICKER (third variety)
    gi.configstring(CS_LIGHTS+12, "a");
    
    // 13 FLUORESCENT FLICKER (second variety)
    gi.configstring(CS_LIGHTS+13, "a");

    // 14 FLUORESCENT FLICKER (third variety)
    gi.configstring(CS_LIGHTS+14, "a");

    // 15 REALISTIC FADE (first variety)
    gi.configstring(CS_LIGHTS+15, "a");

    // 16 REALISTIC FADE (second variety)
    gi.configstring(CS_LIGHTS+16, "a");
         
    // 17 SLOW STRONG STROBE (out of phase with 9)
    gi.configstring(CS_LIGHTS+17, "a");

    // 18 THREE CYCLE STROBE (cycle 1)
    gi.configstring(CS_LIGHTS+18, "a");

    // 19 THREE CYCLE STROBE (cycle 2)
    gi.configstring(CS_LIGHTS+19, "a");

    // 20 THREE CYCLE STROBE (cycle 3)
    gi.configstring(CS_LIGHTS+20, "a");
    // END 28–OCT-98

    // styles 32-62 are assigned by the light program for switchable lights
    // styles 32-62 are assigned by the light program for switchable lights

    // 63 testing
    gi.configstring(CS_LIGHTS+63, "a");

}

If you now would compile the mod every level should be dark. The only problem with this that you won't start with a flashlight how to fix this.
Open p_client.c and search for:

void InitClientPersistant (gclient_t *client)

Somewhere in that function you will see this and add the new code to it:

    // Ridah, start with Pistol in deathmatch
    if (deathmatch->value)
    {

        item = FindItem("flashlight");                        
        client->pers.selected_item = ITEM_INDEX(item);
        client->pers.inventory[client->pers.selected_item] = 1;

        item = FindItem("pistol");
        client->pers.selected_item = ITEM_INDEX(item);
        client->pers.inventory[client->pers.selected_item] = 1;

        client->ammo_index = ITEM_INDEX(FindItem(item->ammo));
        client->pers.inventory[client->ammo_index] = 50;

        client->pers.weapon = item;

        // Ridah, start with the pistol loaded
        ammo = FindItem (item->ammo);

        AutoLoadWeapon( client, item, ammo );
    }

Now you should start with a flashlight if you compile your mod.


FREDZ | Saturday 14 May 2016 - 15:18
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • email
  • Facebook
  • Google
  • PrintFriendly