Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Diffrent weapons of certain class

  1. #11
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    I'll work on it when I get home from work tonight.

    EDIT:

    I took a look at your pk3 and have a few comments.

    I'm not sure which weapon you are trying to modify. In your original thread you mentioned mg/smg, but I don't see any reference to your textures at all, so instead of butchering your initial mod, I'll walk you through on what to do.

    First open up one of the weapons you want. For the sake of this tut, I'm just going to assume you are trying to modify the "bar.tik"

    1. Open up bar.tik in a text editor (notepad, notepad++, etc)
    2. In the very first part of the file you will see this:

    TIKI
    setup
    {
    scale 0.52 // Set default scale to 16/30.5 since world is in 16 units per foot and model is in cm's
    path models/weapons/BAR
    skelmodel BAR.skd
    surface bar1 shader bar
    surface bar3 shader bar
    surface bar4 shader barclip
    }


    This is the bulk of the code you will want to focus on (in terms of the rendering).. You can see the model (bar.skd) has 3 surface shaders.

    surface bar1 shader bar
    surface bar3 shader bar
    surface bar4 shader barclip

    From what I see in the tik file, 2 surfaces share the same shader "bar", so the bar weapon actually only has 2 unique textures. The shaders that will hold the texture info for us is in bold above.

    If you want to apply your own custom texture you can do this a few different ways...
    A. Create a new shader with the path to the new texture and call the shader from the tik. SO instead of the shader "bar" in bold above, you can make it something like "myTexture"

    so it would look like

    surface bar1 shader myTexture
    surface bar3 shader myTexture
    surface bar4 shader barclip




    B. You can keep the shader names named as they are originally, and then just update the actual script containing the shader to point to your custom texture.

    (As a general rule of thumb (for myself at least); I never want to modify the original content, so I would create a new shader and tik and texture so that it won't conflict with the original weapons) If you do this, you'll also want to name the weapon tik something else. Instead of bar.tik something like "myWeapon.tik"


    3. Next step is to find the shader we will be working with. As easymeat mentioned the script will be in "Pak0.pk3\scripts\ weapons_allied.shader & weapons_german.shader"
    So I look for the shaders, and I found them in weapons_allied.shader. The code looks like this:


    bar
    {
    qer_editorimage textures/models/weapons/bar/bar.tga
    {
    map textures/models/weapons/bar/bar.tga
    rgbGen lightingSpherical
    }
    }
    barclip
    {
    qer_editorimage textures/models/weapons/bar/barclip.tga
    {
    map textures/models/weapons/bar/barclip.tga
    rgbGen lightingSpherical
    }
    }


    And here you can clearly see the texture that is associated with that shader and the surface that points to the shader.

    So let's assume that now you made your surface shaders like this in your weapon tik:


    surface bar1 shader myWeap
    surface bar3 shader myWeap
    surface bar4 shader myWeapClip


    Now, in your shader (you can create your own shader, or just put it in the allied_weapons shader anywhere in that file) you would have something like this:





    myWeap
    {
    qer_editorimage textures\del\gangstert\gangt1.tga
    {
    map textures\del\gangstert\gangt1.tga
    rgbGen lightingSpherical
    }
    }
    myWeapClip
    {
    qer_editorimage textures\del\gangstert\gangt2.tga
    {
    map textures\del\gangstert\gangt2.tga
    rgbGen lightingSpherical
    }
    }


    Also, if you don't have a custom model (you're using the model of an existing weapon), then you don't need to copy over all the models from the original game. You only need to copy the model if you have a custom one that you created for a custom weapon.

    Now.... Assuming you're just retexturing an existing gun; technically speaking you can be done right there. If you're adding more weapons into the game though (or want to give the "illusion" of more weapons per class, you would need to create a new custom weapon menu.)

    Edit2:

    When you select your primary weapon, the menu that gets activated is in pak0.pk3 --> ui folder and it's called "dm_primaryselect.urc"


    You can modify this menu to activate a 2nd "submenu" after you click a weapon class that you want.
    Let's say your submenu will be called "MG-submenu.urc".


    So in the "dm_primaryselect.urc"; where you see this:



    resource
    Button
    {
    name "Machinegun"
    rect 208 248 224 32
    fgcolor 1.00 1.00 1.00 1.00
    bgcolor 0.17 0.17 0.17 0.00
    borderstyle "3D_BORDER"
    shader "menu_button_trans"
    hovershader "menu_button_glow"
    clicksound "sound/menu/apply.wav"
    stuffcommand "primarydmweapon mg;popmenu 0"
    hovercommand "set ui_weaponsign machinegun_sign"
    }



    I believe what you would do is, if someone clicks on the MG to use as their primary weapon class, you would change this:

    stuffcommand "primarydmweapon mg;popmenu 0"



    to something like this:

    stuffcommand "pushmenu MG-submenu"



    So your code will look something like this:

    resource
    Button
    {
    name "Machinegun"
    rect 208 248 224 32
    fgcolor 1.00 1.00 1.00 1.00
    bgcolor 0.17 0.17 0.17 0.00
    borderstyle "3D_BORDER"
    shader "menu_button_trans"
    hovershader "menu_button_glow"
    clicksound "sound/menu/apply.wav"
    stuffcommand "pushmenu MG-submenu"
    hovercommand "set ui_weaponsign machinegun_sign"
    }

  2. #12

    Default

    well , but there is some part not clear to me ; i have no knoweldge of surface shaders , if there is an avaialbe tutorial for it i am so grateful

  3. #13
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    I don't understand what you're asking.. :S
    I have explained everything above.
    Are you talking about this:

    surface bar1 shader myWeap
    surface bar3 shader myWeap
    surface bar4 shader myWeapClip


    I believe those surfaces are in the model itself. I'm not very familiar with the skelmodels themselves, but I believe that's what it refers to.
    So the bar model has 3 surfaces and then in the tik you're basically saying this surface = this shader and that shader = this texture.
    You should never modify the surface itself, unless you modify the name of it in the model.

    That's my best guess/explanation, but I'm not sure if that's accurate.

  4. #14

    Default

    Download Shadows tutorials it's a good thing to have explains a lot of stuff and is a must have if you want to learn scripting,mapping and moding

    https://www.x-null.net/forums/thread...OHAA-TUTORIALS

  5. #15

    Default

    well i'll check shadow's tutorial it will help me with alot of other stuff in the project Thank you Guys for help ^_^

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •