View Full Version: [Basic Tutorial] Adding Godmode and Noclip Cheats

wolfers >>Coding Alliance >>[Basic Tutorial] Adding Godmode and Noclip Cheats


<< Prev | Next >>

Deathshead- 04-07-2005
[Basic Tutorial] Adding Godmode and Noclip Cheats
This is two tutorials I wrote up for my first forum, and thought I'd put them here for any n00bs: ------------------------------------------------------------------ Enabling the NoClip Debug cheat For those who like playing with debug mode, this is how to enable the NoClip function for Wolfenstein. Open WL_DEBUG.C and do a search for "noclip". You should get this: #ifdef SPEAR else if (Keyboard[sc_N]) // N = no clip { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); else US_PrintCentered ("No clipping OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #endif To enable it, simply delete the "#ifdef SPEAR" and "#endif" statements. else if (Keyboard[sc_N]) // N = no clip { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); else US_PrintCentered ("No clipping OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } How about enabling NoClip as a normal cheat? Simply open WL_PLAY.C and search for "MLI". You should get the following: // // SECRET CHEAT CODE: 'MLI' // if (Keyboard[sc_M] && Keyboard[sc_L] && Keyboard[sc_I]) { gamestate.health = 100; gamestate.ammo = 99; gamestate.keys = 3; gamestate.score = 0; gamestate.TimeCount += 42000L; GiveWeapon (wp_chaingun); DrawWeapon(); DrawHealth(); DrawKeys(); DrawAmmo(); DrawScore(); Above this cheat, type the following: // // SECRET NOCLIP CHEAT // if (Keyboard[sc_J] && //You can customize these Keyboard[sc_K] && //keys to suit your needs Keyboard[sc_L]) //in your code. { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); //You may customize this message else US_PrintCentered ("No clipping OFF"); //You may customize this message VW_UpdateScreen(); IN_Ack (); return 1; } When you compile, you may get a warning which reads that such and such can't return a value, but you just ignore that. Now when in the game, pressing the keys JKL will activate NoClip mode, allowing you to go through walls! ~~~~~~~~~~~~~~~~~~~~ Activating the God Mode cheat in Wolfenstein. In Spear of Destiny, pressing TAB-G-F10 activated GodMode. This cheat was not available in the original, so here's how to activate it. Open up WL_PLAY.C and search for godmode until you get this: #ifdef SPEAR // // SECRET CHEAT CODE: TAB-G-F10 // if (Keyboard[sc_Tab] && Keyboard[sc_G] && Keyboard[sc_F10]) { WindowH = 160; if (godmode) { Message ("God mode OFF"); SD_PlaySound (NOBONUSSND); } else { Message ("God mode ON"); SD_PlaySound (ENDBONUS2SND); } IN_Ack(); godmode ^= 1; DrawAllPlayBorderSides (); IN_ClearKeysDown(); return; } #endif "#ifdef SPEAR" means that the cheat is only active in Spear of Destiny. To fix this, simply delete or comment out "#ifdef SPEAR" and "#endif". Now the cheat is accessable in Wolfenstein. Before you compile, you will have to change the sounds used in this code; namely "NOBONUSSND" and "ENDBONUS2SND" as they are only available in Spear of Destiny. I would change them to "BONUS1SND" and "BONUS2SND". The code would now look like this: // // SECRET CHEAT CODE: TAB-G-F10 // if (Keyboard[sc_Tab] && Keyboard[sc_G] && Keyboard[sc_F10]) { WindowH = 160; if (godmode) { Message ("God mode OFF"); SD_PlaySound (BONUS1SND); } else { Message ("God mode ON"); SD_PlaySound (BONUS2SND); } IN_Ack(); godmode ^= 1; DrawAllPlayBorderSides (); IN_ClearKeysDown(); return; } Now, the last thing you can do is customize the messages and buttons to activate godmode. In this next example I have changed the code to G-O-D and customized the message to read "You're invincible!". It now looks like this: // // SECRET CHEAT CODE: G-O-D You don't need to change this line // if (Keyboard[sc_G] && Keyboard[sc_O] && Keyboard[sc_D]) { WindowH = 160; if (godmode) { Message ("You're gonna die!"); //you're custom message SD_PlaySound (BONUS1SND); } else { Message ("You're Invincible!"); //you're custom message SD_PlaySound (BONUS2SND); } IN_Ack(); godmode ^= 1; DrawAllPlayBorderSides (); IN_ClearKeysDown(); return; } Save, compile, and play. Simple. -------------------------------------------------------- I hope this helps someone learn more about the code. There you go -Deathshead


Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.