Ammo regeneration area - how to?

Discussion in 'Mapping Questions & Discussion' started by Avaray, Jan 25, 2014.

  1. Avaray

    Avaray L2: Junior Member

    Messages:
    73
    Positive Ratings:
    3
    I need Ammo regeneration area (important: not Health regeneration!).
    How can I do it?
     
  2. Archmage MC

    Archmage MC L2: Junior Member

    Messages:
    61
    Positive Ratings:
    0
    put a dispenser behind a wall? It'll dispense ammo but not health if you get close to it, or at least thats what happens in normal gameplay.

    You can also just have a bunch of ammo kits placed there with very short respawn timers.
     
  3. Avaray

    Avaray L2: Junior Member

    Messages:
    73
    Positive Ratings:
    3
  4. Archmage MC

    Archmage MC L2: Junior Member

    Messages:
    61
    Positive Ratings:
    0
    Well, if you want, though I'm not sure how well this would work, is you could maybe parent an item_ammopack when someone spawns by using a trigger_multiple on the spawn points using the SetParent !Activator command, and set it so the ammopack doesn't respawn unless its told to do so through a trigger_multiple in the ammo resupply room. Try that, though I'm not sure how well it'll work, or if it'll work.
     
  5. Berry

    aa Berry Sharing is caring, and I don't care

    Messages:
    984
    Positive Ratings:
    1,474
    Isn't there a setting for cart dispensers and/or resupply lockers to only regenerate ammo?
     
  6. Archmage MC

    Archmage MC L2: Junior Member

    Messages:
    61
    Positive Ratings:
    0
    I checked both of those, I see no 'ammo only' flag for either of them.
     
  7. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    I believe this was a bug in the mapobj_cart_dispenser, such that when sent a Disable input only half of it turned off. It works correctly now and I can't find any written record of this so I'm not entirely sure, but I do distinctly remember something along those lines.
     
  8. Avaray

    Avaray L2: Junior Member

    Messages:
    73
    Positive Ratings:
    3
    Doesn't work (or Im doing it wrong, but im pretty sure Im doing it right).
     
  9. LeSwordfish

    aa LeSwordfish semi-trained quasi-professional

    Messages:
    4,105
    Positive Ratings:
    6,003
    You could use the same method as is used for pumpkin bombs, spawning an entity from a template.
     
  10. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,527
    I'm not sure if you could really use the SAME method, because the pumpkin entity actually is removed when it explodes, ammo pickups just go inactive until they respawn. You'd need to use a regular point_template and forcefully kill/respawn the pickup whenever it is taken.
     
  11. Sergis

    aa Sergis L666: ])oo]v[

    Messages:
    1,871
    Positive Ratings:
    1,130
    can you trigger impulse 101 on people somehow
     
  12. Avaray

    Avaray L2: Junior Member

    Messages:
    73
    Positive Ratings:
    3
    // Yes, Im digging this topic because Im still searching the way for ammo regen and instant clip refill.

    It's possible only with sv_cheats 1.
     
  13. 14bit

    aa 14bit L14: Bit Member

    Messages:
    215
    Positive Ratings:
    496
    Are you sure it works now? I tried to use it in a1 of my 72 hour map ctf_14bit (it was attached to the flag), but when it was disabled it still gave out ammo causing massive engine turtling. So unless they fixed it in Gun Mettle, I think it still does ammo and not health if you disable it.
     
  14. Egan

    aa Egan

    Messages:
    1,304
    Positive Ratings:
    1,486
    Question: What is this for? Can you not simply have ammo packs on the ground in the area?

    A way you can do this is to use a game_player_equip with a keyvalue of item_ammopack_small set to 1. You will have to disable SmartEdit to add custom keyvalues. I've set its targetname to regen_ammo_equip:

    [​IMG]

    Next make a logic_timer, set its refire time to something like 6.

    Now make a trigger_multple (let's name it: regen_area), have start disabled.

    On the logic_timer add these outputs:
    OnTimer - regen_area - Enable , OnTimer - regen_area - Disable - After 0.10.

    On the regen_area trigger add an output of OnTrigger - regen_ammo_equip - Use.

    This is enough to, every 6 seconds for players in the trigger, have them 'equip' a small ammo pack. The problem is though if the player doesn't need ammo then the ammopacks will start to litter the floor because they aren't being picked up. We'll need to find a way to kill the newly spawned ammo (to stop them from building up) but keep all the existing ammopacks in the level unaffected.

    To kill the ammopacks we can simply use the output on the regen_trigger:
    OnTrigger - item_ammopack_small - Kill - After 0.10

    We don't want to kill all ammopacks in the level though, so we'll need to 'hide' the existing map-ammopacks before they get killed by this output:

    Again on the regen_trigger we'll add:
    OnTrigger - item_ammopack_small - AddOutput - classname ammo_temp
    OnTrigger - ammo_temp - AddOutput - classname item_ammopack_small - After 0.15

    The full output list will look like:
    [​IMG]

    Now we have all the map-ammopacks being temporarily moved to the classname of 'ammo_temp', the players in the trigger equipping the ammopacks, the unused ammopacks being killed, and the 'ammo_temp' entities moving back to regular item_ammopack_small.

    You may able able to tighten when the delays happen to intervals of 0.04 instead of 0.05, but going lower than 0.04 doesn't seem to work properly since those outputs may be grouped together on the same server tick causing unwanted results.

    =======

    With some unwanted results but otherwise fine behavior you can alternatively use a trigger_add_tf_player_condition with the condition keyvalue set to 92, which says "Player periodically regenerates ammo, health, and metal. Health regeneration rate is inversely proportional to maximum health. Used for the "Regen" powerup in Mannpower mode."
     
    Last edited: Aug 24, 2015
  15. Tumbolisu

    aa Tumbolisu  I ⌄ I 

    Messages:
    935
    Positive Ratings:
    904
    You can have an ammopack instantly respawn by giving it the Output
    "OnPlayerTouch - !self - Enable - <none> - 0.05"
    [​IMG]
     
  16. Avaray

    Avaray L2: Junior Member

    Messages:
    73
    Positive Ratings:
    3
    Nice, thanks for answers both of you!
    I didnt checked it yet but it seems it might work.
    Im working on another project right now so I dont know when I will test it.

    Nope. I need it for Pyro Paintball map (flaregun fight where 1 shoot = 1 kill; Tournament mode). If ammo will be on the ground there will be easy way to guess where player will walk when his ammo ends. I dont want easy kills at this map.

    I will try to use it with trigger. At this moment if I will use it by console (addcond) in game it will just spawn "icon" of that buff and it does nothing.
    I was thinking about Power Up Canteen from MVM (Power Up that is giving full ammo) - but it seems it is wepon thing and is not possible to play with it in VHE.
    By the way - how did you get latest list of conditions? Can you share URL or something?
    Here is up to cond 88 https://developer.valvesoftware.com/wiki/Trigger_add_tf_player_condition

    Also I emailed today to Valve.
    I told them about func_regenerate to give options:
    1. regenerate health and ammo (by default)
    2. regenerate health only
    3. regenerate ammo only
    I wonder if they will do something with it :bored:
     
    Last edited: Aug 28, 2015