Changing texture of brush based on who shoots it

Discussion in 'Mapping Questions & Discussion' started by Toomai, Jul 2, 2011.

  1. Toomai

    Toomai L3: Member

    Messages:
    129
    Positive Ratings:
    77
    I'm trying an experiment where shooting a brush causes its colour to change based on the type of damage and which team it is. So first I set up this:
    [​IMG]
    The left block is a func_breakable with 9999 health. OnTakeDamage, it tells the upper-right block - an env_texturetoggle - to SetTextureIndex to 4 (value's not important other than it's different than 0, which is the red). The env_texturetoggle's target is the red block, which is a func_brush with a custom multi-frame texture (its .vmf being taken from here).

    The first problem here is that the red block should be appearing white - red is index 0, but the default index is not 0, so it's supposed to start off as white. Also, when this setup is run in-game, nothing happens when the func_breakable is hit with any weapon. (I saw this topic but as I said this is an experiment to see if it can be done this way, and that method gets clunky rather quickly.)

    Aside from these problems, is it even possible to filter damage by team? I know it's easy to filter it by type. Not too big a deal if you can't since this isn't anything serious.
     
  2. Empyre

    Empyre L6: Sharp Member

    Messages:
    297
    Positive Ratings:
    148
    I don't believe func_breakable can be textured with the trigger texture. Maybe make the block to be changed func_breakable, so you hit the block whose color you want to change. Or how about a func_breakable that is slightly larger than the block to be changed, surrounding it, and textured with nodraw?
     
  3. Toomai

    Toomai L3: Member

    Messages:
    129
    Positive Ratings:
    77
    I've tried trigger, the grey floor texture, and nodraw. The block made noise when I attacked it for all three, but the texture swapping didn't happen.
    That would mean it would do the same thing regardless of what type of damage or what team attacked it, which is kind of the opposite of the point.
    That's the future idea; I have the two blocks separate right now to makes things easier to test.

    Here's the material's .vmf, if anyone can spot something wrong with it:
    Code:
    "LightmappedGeneric"
    {   
       "$baseTexture" "test/stripe"
       "Proxies" 
       {
          "ToggleTexture" 
          {
             "toggleTextureVar" "$baseTexture" 
             "toggleTextureFrameNumVar" "$frame" 
             "toggleTextureShouldWrap" "1" 
          } 
       } 
    }