Code Editing Tutorials
Making the chaingun jam at random time


Step 1: Open WL_AGENT.C and do a search for "change frame and fire" (no quotes and include the spaces) Scroll down to here:



case 4:

if(!gamestate.ammo)

break;



Add this under "break;" (ahh! no quotes)



if (US_RndT()<8)

{

if (US_RndT()<24)

{

SD_PlaySound(YOURSOUNDSND);// choose a sound

buttonstate[bt_attack] = false;

// IN_ClearKeysDown ();

gamestate.attackframe = gamestate.weaponframe = 0;

gamestate.bestweapon = gamestate.chosenweapon = gamestate.weapon = wp_machinegun;

DrawWeapon ();

break;

}

else if (buttonstate[bt_attack])

{

gamestate.attackframe -= 2;

}

}

else if (buttonstate[bt_attack])

{

gamestate.attackframe -= 2;

}



Step 2: MAKE SURE there are only 2 "else if (buttonstate[bt_attack])

{

gamestate.attackframe -= 2;" OK?




Compile and link up! Now have fun with that jamming chaingun! NOTE: Don't expect the chaingun to jam every 2 minutes, it may take a long time to jam. Please if any errors, email me at
Wolf3dkyle@aol.com and i will try to figure out the problem. Thanks!




 

Get back to the Dome tutorials
Jump to the top