Ammo Systems

You'll find these kinds of triggers in some UMS maps-- particularly realistic horror (such as Raccoon City) and GTA maps. It can be pretty frustrating to implement this instead of a real Ammo System because it doesn't actually detect when a player shoots, but when a player kills a unit.

Regardless, this system makes it so you have to watch your ammo gauge, because if you don't you'll be caught in some crossfire without any ammo. Usually you'll be shooting at units with one-shot kills (with notable exceptions) and no buildings. Note: You cannot completely disable a unit from firing at all because the player can manually firing by clicking on the attack button and clicking on the target (although with hyper triggers, it makes doing this much harder with most units). Most of the time, you should set it so that the minerals and the gas is their ammo gauge - Minerals for the ammo in their current clip, and gas for clips they have stored.

## Ammo Triggers

*StarCraft* Trigger [template]
Description
Ammo Initialization
Players

* Force 1

Conditions

* Always

Actions

* Modify resources for Force 1: Set to 6 Ore (Ore is used as ammunition)
* Modify resources for Force 1: Set to 2 Gas (while Gas is used as Ammo Clips)

This makes it so that they'll have six shots to start off with, and 2 extra clips, meaning 18 shots.

*StarCraft* Trigger [template]
Description
Ammo Usage
Players

* Force 1

Conditions

* Current Player Kills score is At least 1 (NOTE: This detects a player's kill, not a player's shot.)

Actions

* Modify score for Current Player: Set to 0 Kills (Resets the kill score to prevent endless loops.)
* Modify resources for Current Player: Subtract 1 Ore (Uses up ammo per kill.)

There you go. This will take away ammo from the unit's ammo gauge.

*StarCraft* Trigger [template]
Description
Ammo Reload
Players

* Force 1

Conditions

* Current Player accumulates exactly 0 Ore (0 Ammo)
* Current Player accumulates at least 1 Gas (and at least 1 Ammo Clip are prerequisites for reloading.)

Actions

* Preserve trigger.
* Display for current player: "Reloading..."
* Set All Players to Ally (Temporarily allies the enemy to prevent free kills.)
* Wait for 2500 milliseconds (Reloading wouldn't make sense if it was instant - although I recommend you use Death Counters as timers)
* Modify resources for Current Player: Set to 6 Ore
* Modify resources for Current Player: Subtract 1 Gas
* Set Force 2 to Enemy (Remarks enemies as hostile so you can shoot again.)

You can take out the Wait trigger if you want. The Force 2 in the 2nd Set Alliance after the reload could be the enemies that you're firing at. Anyways, a player has to run out of ammo, doesn't he?

*StarCraft* Trigger [template]
Description
Out of Ammo
Players

* Force 1

Conditions

* Current Player accumulates exactly 0 Ore and Gas

Actions

* Preserve trigger.
* Set All Players to Ally

This is best used with Hyper Triggers.

*StarCraft* Trigger [template]
Description
Ammo Reload
Players

* Force 1

Conditions

* Current Player brings at least 1 men to 'retrieve ammo location'

Actions

* Modify resources for Current Player: Add 3 Gas

And that's it. If you want to keep that location to always give the player ammo, preserve trigger.