Ammo regeneration area - how to?

Archmage MC

L2: Junior Member
Jun 17, 2011
61
1
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.
 

Archmage MC

L2: Junior Member
Jun 17, 2011
61
1
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.
 

Berry

resident homo
aa
Dec 27, 2012
1,056
1,898
Isn't there a setting for cart dispensers and/or resupply lockers to only regenerate ammo?
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Isn't there a setting for cart dispensers and/or resupply lockers to only regenerate ammo?
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.
 

Avaray

L2: Junior Member
Oct 14, 2011
72
4
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.

Doesn't work (or Im doing it wrong, but im pretty sure Im doing it right).
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
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.
 

14bit

L14: Bit Member
aa
Oct 5, 2014
642
2,065
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.

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.
 

Egan

aa
Feb 14, 2010
1,375
1,720
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:

vJsfQPp.png


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:
1ykqBCY.png


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:

Avaray

L2: Junior Member
Oct 14, 2011
72
4
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.

Question: What is this for? Can you not simply have ammo packs on the ground in the area?
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.

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."
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: