1. Post #1
    Sechs's Avatar
    November 2005
    350 Posts
    So i wanted my CS:S weapons to eject shells. I made an effect for it.




    The effect covers every bullet type in CS:S and also has appropriate sounds for each.

    Here's how you'd use it:

    SHELL_9MM = 1
    SHELL_57 = 2
    SHELL_556 = 3
    SHELL_762NATO = 4
    SHELL_SHOTGUN = 5
    SHELL_338MAG = 6
    -- this would be done in the base swep
    
    SWEP.Primary.ShellType      = SHELL_9MM
    -- this would go in each SWEP
    
    local ed = EffectData()
    ed:SetEntity( self.Weapon )
    ed:SetAttachment( self.Weapon:LookupAttachment( "2" ) )
    ed:SetScale( self.Primary.ShellType )
    util.Effect( "weapon_shell", ed, true, true )
    -- this would go under the primary fire function somewhere

    Problems i'm having:

    [list][*]The shells don't have physics objects (not a huge issue, i just use a 2x2x2 box for their model)[*]Some weapons (so far only the TMP model) have an awkward shell eject position. It doesn't look horrible though.[*]The shells make a plastic impact sound when they hit the floor. There is no physics object material that doesn't make sounds. So i guess garry needs to add a "gmod_nosound" physics material to fix this problem.[/list]
    I'll post a download link if you guys are interested in having this now.
    Reply With Quote Edit / Delete Reply Canada Show Events Informative Informative x 1Funny Funny x 1 (list)

  2. Post #2
    Gold Member
    HiddenMyst's Avatar
    June 2006
    6,636 Posts
    Why do the shells eject into the player's face? That would just cause hot metal to land in their shirt.
    Reply With Quote Edit / Delete Reply Australia Show Events Agree Agree x 2Funny Funny x 1 (list)

  3. Post #3
    Jaykin Bacon: Episode 3
    SteveUK's Avatar
    May 2005
    2,470 Posts
    Why do the shells eject into the player's face? That would just cause hot metal to land in their shirt.
    Because Valve thought it was a good idea to model the weapons left handed (the view model is then flipped in code)
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Funny Funny x 5Agree Agree x 1Disagree Disagree x 1 (list)

  4. Post #4
    Sechs's Avatar
    November 2005
    350 Posts
    The mp5 is the only gun that ejects properly afaik. Not a big issue really.
    Reply With Quote Edit / Delete Reply Canada Show Events Informative Informative x 2Agree Agree x 1 (list)

  5. Post #5
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    I always wondered why they modeled the weapons left-handed and then never gave the option to use left-handed weapons. It'd be cool, but then I guess you'd have to flip the animations for player models aswell.

  6. Post #6
    SFArial's Avatar
    May 2009
    1,232 Posts
    Well the original counter strike (the mod) creators decided to make them left handed, no? I guess Valve didn't want to break the line.. or something. By the way the effect looks cool, though I miss that cheap point-type physics collision of the bullets. So cheap, so epic.

  7. Post #7
    Gold Member
    hexpunK's Avatar
    August 2008
    15,659 Posts
    I always wondered why they modeled the weapons left-handed and then never gave the option to use left-handed weapons. It'd be cool, but then I guess you'd have to flip the animations for player models aswell.
    I read that most games developers model left handed weapons for right handed usage just so you can see the mechanisms of the gun and see how it ejects spent cartridges. Makes sense from a aesthetics point, but not from a realism one.

    Edited:

    Well the original counter strike (the mod) creators decided to make them left handed, no? I guess Valve didn't want to break the line.. or something. By the way the effect looks cool, though I miss that cheap point-type physics collision of the bullets. So cheap, so epic.
    And if I remember rightly the CS mod team were mostly left handed or something, which is why their models are lefty.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Informative Informative x 1 (list)

  8. Post #8
    Mr_Roberto's Avatar
    October 2008
    133 Posts
    The shells make a plastic impact sound when they hit the floor. There is no physics object material that doesn't make sounds. So i guess garry needs to either add a "gmod_nosound" physics material to fix this problem..
    There's one included in hl2 by default called "default_silent" that's supposed to be just that, but I'm not sure if I ever got it to work.
    Reply With Quote Edit / Delete Reply United States Show Events Informative Informative x 1 (list)

  9. Post #9
    Sechs's Avatar
    November 2005
    350 Posts
    There's one included in hl2 by default called "default_silent" that's supposed to be just that, but I'm not sure if I ever got it to work.
    I checked surfaceproperties, it seems that it's only designed for the skybox material. Not physics props.

    Code:
    // for invisible collision materials (like sky)
    "default_silent"
    {
    	"gamematerial"	"X"
    }
    I made my own surfaceproperty, did a little hacky bit by replacing all the sounds with the silent sound clip from the combine radio shit.

    Code:
    // hacky workaround for making a silent surface property!
    "gmod_silent"
    {
    	"base"		"metal"
    	"impacthard"	"NPC_Combine.SentenceParameters"
    	"impactsoft"	"NPC_Combine.SentenceParameters"
    }
    Still didn't seem to want to work. It uses the plastic surface property regardless.

  10. Post #10
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    I actually coded some simple point physics for shells (that doesn't lag).
    I also spliced the sound for shells hitting the ground so they make individual plinks per bounce.

    I stopped working on it right before fixing up shell spawning. Shell ejection may or may not be networked, but feel free to take from this.

  11. Post #11
    Kaliger's Avatar
    December 2008
    41 Posts
    Why do the shells eject into the player's face? That would just cause hot metal to land in their shirt.
    ive shot some guns in real life, and some guns can cause the shell to fall onto your shirt, i was using a glock, i fired, it hit my glasses and went down my shirt, it was too hot, but still,

    (however im not 100% sure i was holding it right, even though i hit the target)
    Reply With Quote Edit / Delete Reply United States Show Events Funny Funny x 1Dumb Dumb x 1 (list)

  12. Post #12
    NotAlt's Avatar
    November 2008
    57 Posts
    i want this!
    Reply With Quote Edit / Delete Reply Sweden Show Events Informative Informative x 1 (list)

  13. Post #13
    Yobdren's Avatar
    June 2008
    2,394 Posts
    I always wondered why they modeled the weapons left-handed and then never gave the option to use left-handed weapons. It'd be cool, but then I guess you'd have to flip the animations for player models aswell.
    Aren't you able to swap the weapons? I play left handed. Should be under Multiplayer -> Advanced.

  14. Post #14
    Gold Member
    Rambo_6's Avatar
    June 2005
    772 Posts
    Since HL2 uses larger bullet shell models, i made a 50 caliber shell option for fun.

    I'll do a mini-release thread for this since it's done.

    Edited:

    http://www.facepunch.com/showthread....0#post16906020