Jump to content
  • Weapon View Model Ammo Counters/C4 Timer Counter


    CMDBob
    • Supported Version: W3D Engine 5.0

    This tutorial will cover both adding an ammo counter to a weapon (imagine the Halo Assault Rifle's ammo display), as well as adding a timer to the C4 object in the world, instead of having to use an animation to display the timer. It's simple, but does require some setup.

     

    Setting up the Number Texture

    The first step is creating a texture for the counters. It needs to have the numbers laid out in a grid format, like this:

    0 1 2 3
    4 5 6 7
    8 9 -  
           

    The dash in the grid is for when a weapon is reloading. It could be any graphic, but a dash works well.

    It doesn't matter if the texture has an alpha channel or not, that more depends on how the texture will be applied to the digit meshes in the model. A sample texture is included in the sample pack at the end of this post.

     

    Setting up the W3D Material

    One important part of the counter system is the material. You will need a W3D Material for this. Set up the material for how you want the texture to look on the weapon, including blending modes, vertex material colours, etc. There is one limitation: You can only use the Stage 0 texture for this (so no detail texture. However, you shouldn't need it.)

    Once you have the rest of the material set up, it's time to set up the Stage 0 Mapping. Set the Type to Grid and fill in the Args box with this text:

    FPS=0.0
    Log2Width=2
    Last=10
    Offset=0

    Once that is done, the material is ready, and it's time to set up the model part of this.

     

    Setting up a weapon view model to have an ammo counter

    Setting up a weapon to have an ammo counter requires up to 3 meshes to act as the digits (you can have two or even one depending on what you want the weapon to show.)

    Apply the texture to the mesh, then make sure that the mesh you want the number to appear on is unwrapped so that the UVs only cover the zero on the number texture. Then name the 3 digits appropriately:

    Name Purpose
    AmmoCH Displays the hundreds digit (eg 123)
    AmmoCT Displays the tens digit (eg 123)
    AmmoCO Displays the ones digit (eg 123)

    Included in the sample pack at the end of this post is an example weapon view model with the digits set up.

     

    Setting up a C4 Timer

    Setting up a C4 timer is much the same as setting up a view model ammo counter, just that the names that are used are different:

    Name Purpose
    TIMERDTM Displays the tens digit of the minutes on the display (eg 12:34)
    TIMERDOM Displays the ones digit of the minutes on the display (eg 12:34)
    TIMERDT Displays the tens digit of the seconds on the display (eg 12:34)
    TIMERDO Displays the ones digit of the seconds on the display (eg 12:34)

    Included in the sample pack at the end of this post is an example weapon view model with the digits set up.

     

    Sample Pack

    AmmoCounterC4TimerSamplePack.zip

    This sample pack contains the texture for the counter digits, as well as an example of the weapon ammo counter and C4 timers, in Max 2017 format.

    The Counter Material is the material that is applied to the digits, to make them work.

     

    19366083.tga


    User Feedback

    Recommended Comments

    There are no comments to display.



    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...