(Old code tutorial) Easy Weapon Display from Wolf Planet forum

View previous topic View next topic Go down

(Old code tutorial) Easy Weapon Display from Wolf Planet forum

Post by Officer-M. John (Admin) on Sat Mar 26, 2016 5:11 pm

This name doesn't fit well, but what the tutorial does is easily let you have weapons with diffrent status bar images without nasy "if" statements.



Lets begin. Open Up WL_Agent and go to the Draw Weapon Function. Replace the whole this with this:

Update! Kyo found a bug in the following code! If you used it before 02/16/2005, go over it again!

Code:


==================
=
= DrawWeapon
= Conner94's
= Version
=
= Based off of
= BrotherTanks's Ammo
= In the Same Place
= Tutorail
=
==================
*/

void DrawWeapon (void)
{
   switch (gamestate.chosenweapon)
     {
        case wp_newweaponwithnewimage: //change this to your new weapon
          StatusDrawPic (32,8,yourimage); //change to your image
         break; //Make sure you have this!
      
        default:
          StatusDrawPic (32,8,KNIFEPIC+gamestate.weapon);
        break; //Make sure you have this!
      }
}


/*

There you go. Based off of BrotherTank's ammo in same place. Add as many cases as you need.

Writte by Conner94 on Sun Feb 13, 2005 4:29 am
avatar
Officer-M. John (Admin)
Admin

Posts : 323
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

Re: (Old code tutorial) Easy Weapon Display from Wolf Planet forum

Post by Officer-M. John (Admin) on Sat Mar 26, 2016 5:15 pm

You forgot to put the Break; in here is my Ex:

Code:

void DrawWeapon (void)
{
   switch (gamestate.chosenweapon)
     {      
        case wp_knife:
          StatusDrawPic (32,8,KNIFEPIC);
     break;

        case wp_pistol:
          StatusDrawPic (32,8,GUNPIC);
     break;

        case wp_machinegun:
          StatusDrawPic (32,8,MACHINEGUNPIC);
     break;

        case wp_chaingun:
          StatusDrawPic (32,8,GATLINGGUNPIC);
          break;

   case wp_shotgun:
          StatusDrawPic (32,8,NEWPIC);
          break;

   case wp_sten:
          StatusDrawPic (32,8,NEWPIC1);
          break;

   case wp_rifle:
          StatusDrawPic (32,8,NEWPIC2);
          break;

   case wp_colt:
     StatusDrawPic (32,8,COLTPIC);
          break;

   case wp_dshotgun:
     StatusDrawPic (32,8,DSHOTGUNPIC);
          break;
      }
}

100% it works

Writte by Kyo Kusanagi (Richter Belmont) on Tue Feb 15, 2005 10:21 pm
avatar
Officer-M. John (Admin)
Admin

Posts : 323
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum