Welcome to PlagueFest.com! Log in or Sign up to interact with the Plague Fest community.
  1. Welcome Guest! to interact with the community and gain access to all the site's features.

Deleting dropped weapons without a plugin

Discussion in Mapping Discussion started by nyronic, Mar 27, 2013

  1. May 17, 2011
    Posts
    EDIT: Found a better solution thanks to the help of pF :grin:

    People were dropping weapons / dying on top of the roof of my tower map, which left guns for sudden death.

    I was having a lot of trouble finding out info on how to delete a dropped weapon, as triggers and pretty much everything else seems to ignore weapons no matter what combination of flags you use. However, I finally came to a solution so I thought I'd share.

    The magic entity is game_weapon_manager

    It has 4 keyvalues:

    targetname - Name - The name that other entities refer to this entity by.
    weaponname - Weapon Classname - Classname of the weapon type to limit.
    maxpieces - Max Allowed in Level - The maximum amount of the specified weapon type allowed in the world.
    ammomod - Ammo Modifier - Modifier for ammount of ammo dropped by a weapon.(I believe this is a singleplayer thing)

    Setting the Max Allowed in Level setting to 0 would delete all weapons of that type. You can change this value at any time with Addoutput -> maxpieces #.

    If you want to clean up all weapons you will need a separate one for every single weapon, there are 29 weapons total, 28 of them are droppable(nades drops upon death). The 29th is the knife which cannot be dropped and automatically despawns on death.

    If you don't want them eating up 28 edicts all the time, put them in a template until you need them.
    • Like Like x 1
    • Wizard! Wizard! x 1
      nyronic, Mar 27, 2013 Last edited by nyronic, Mar 28, 2013
    • Apr 9, 2012
      Posts
      Templated or not, they are there as a working entity and at all times count towards the limit count
      • Informative Informative x 1
      • May 17, 2011
        Posts
        report_entities says otherwise, unless its wrong?

        before and after spawning

        Class: ai_network (1)
        Class: cs_gamerules (1)
        Class: cs_player_manager (1)
        Class: cs_team_manager (4)
        Class: info_player_counterterrorist (2)
        Class: info_player_terrorist (2)
        Class: player (1)
        Class: point_template (1)
        Class: predicted_viewmodel (2)
        Class: scene_manager (1)
        Class: soundent (1)
        Class: weapon_glock (1)
        Class: weapon_knife (1)
        Class: worldspawn (1)
        Total 20 entities (0 empty, 19 edicts)

        Class: ai_network (1)
        Class: cs_gamerules (1)
        Class: cs_player_manager (1)
        Class: cs_team_manager (4)
        Class: game_weapon_manager (29)
        Class: info_player_counterterrorist (2)
        Class: info_player_terrorist (2)
        Class: player (1)
        Class: point_template (1)
        Class: predicted_viewmodel (2)
        Class: scene_manager (1)
        Class: soundent (1)
        Class: weapon_glock (1)
        Class: weapon_knife (1)
        Class: worldspawn (1)
        Total 49 entities (0 empty, 48 edicts)
        nyronic, Mar 28, 2013 Last edited by nyronic, Mar 28, 2013
      • Sep 25, 2010
        Posts
        This post is about Reducing amount of edicts and not reduce entity count.
      • May 14, 2011
        Posts
        I thought you were going to make a trigger on the roof filtered for "weapon*"

        You could have just had it enable at the start of the blackout for the split second before people are teleported and it would clean the roof of ALL weapons within the trigger. Having experimented with this it also clears weapons people are holding at the time inside the trigger. (I used it as a work-around for player-strip once)

        TLDR;

        Filter class -> Allow -> weapon*

        trigger_multiple -> (Set the filter) -> OnStartTouch -> !activator -> kill

        This would save you 27 entities and a lot of typing out.
        • Like Like x 1
        • Jan 11, 2011
          Posts
          What Joris meant, is that no matter if they are templated or not, they are taken into account when the map loads (end/start), and can cause the map to crash.
          This is usually not a problem if you have the extra space for spawning templates and what not. But if your map had 1500 Entities (Point_Templates included) and then 600 extra entities as part of those templates and not-spawned; even if while playing (if you were able) you would only get 1500 edicts; the map would crash on loading because the 1500+600 = 2100 > 2048

          Oh... And about what Ghost just proposed; you can always make a fake-floor of player clip (allows weapons to fall throught) and put the trigger under it.
          • Informative Informative x 1
          • Apr 9, 2007
            Posts
            Please don't stress vphysics with fake floors :frown:
          • May 14, 2011
            Posts
            My original proposition was to just enable/disable it temporarily just to clean the roof. Its easier than having to create a fake floor. Also people could drop weapons on props etc.

            Just to clarify. Would using a func_illusionary and a player clip in it for players to walk on stress vphysics at all?
          • May 31, 2012
            Posts
            No, I don't think. Playerclips are just 'walls' that only collide with the player. As long as there is no weird entity (not the illusionary, but something else) that collides with weapons there should be no problem.
          • May 17, 2011
            Posts
            I've never been able to get triggers of any type to detect dropped weapons, and I wasn't able to find any info on it either.

            I did not know this, thanks. It's well under the loading limit currently.
          • May 14, 2011
            Posts
            Really? Try to throw yourself into an OnStartTouch !activator kill and nothing will be left of you. (weapons included)
          • May 31, 2012
            Posts
            Doing that, from what I've done, crashes the server.
          • Apr 9, 2007
            Posts
            Yes, killing player entities like this is a bad idea. Weapons should be fine, just make sure you filter.
          • May 17, 2011
            Posts
            It doesn't work, try it yourself.

            Weapon entities don't seem to be classified as anything that's in the flags. I even went as far as trying a func_door that crushes them and has OnBlockedClosing / OnBlockedOpening -> !activator -> kill and that didn't work either.

            If somebody knows how to get weapon entities to be detected by a trigger I'd love to know, because I've had 0 luck whatsoever and the answer is non-existent on google.
            • Like Like x 1
            • May 31, 2012
              Posts
              I am quite sure (like nyro) that I tried and it didn't work and that, in fact, I tried with Tony or talking about something with him (with me assuming it was possible) and I couldn't find a way.

              EDIT: One of those magical entities that seem to detect everything is a trigger_soundscape. I don't know if it detects weapons or not (although I'm quite sure I managed to detect func_doors with it). It has the downside that it is a 'permanent' entity (doesn't get resetted) so killing/enabling/disabling/parenting will break it bad.

              SUB-EDIT: Remember that those permanent entities can be 'parented' using logic_measure_movement (although I believe it is a bit (bit bit bit) more inaccurate than normal parenting).

              Another edit just to be cooler: This thread is full of blue mapper group things.
              • Funny Funny x 1
                enviolinador, Mar 28, 2013 Last edited by enviolinador, Mar 28, 2013
              • May 14, 2011
                Posts
                Let me go try something. I'm sure I made deleting weapons work at one point.
                Post Merged, Mar 28, 2013
                It seems that I was wrong. Well I have deleted them but not within a trigger. :frown:

                OnAnything -> weapon_xxxx -> kill

                Deletes every weapon of that type in the map.

                n.b. It doesn't look like triggering that while none of them are in the map crashes the map either although that bug may be server based. :dontknow:
                Post Merged, Mar 28, 2013
                Kyle and deto ruined it.
                • Informative Informative x 1
                • May 17, 2011
                  Posts
                  How are you targeting the weapons?
                • May 31, 2012
                  Posts
                  You're using the entity system with classnames, which works perfectly fine. The only crashes by killing entities (that I know of) are players and path_tracks (and well, weapons that I believe are used by the server to manage things, such as cs_player_manager, gamerules, worldpsawn, etc). In general any 'classname' -> DoSomething will do it for all entities of that class.

                  Just anywhere, even in a relay, writing 'weapon_elite -> Kill -> 0.00 ' would kill all weapon_elites within the level. As far as I know, you can't detect weapons (although testing soundescapes might me interesting).
                  • Informative Informative x 1
                  • May 17, 2011
                    Posts
                    Oh wow, wish I knew that from the beginning. I had no idea you could target those entities by their classname. Does that work with other entities too?
                  • May 14, 2011
                    Posts
                    Yup, lol.