Half-Life: Alyx Workshop Tools/Level Design/Trigger Player Out Of Ammo
Introduction
This tutorial will teach you how detect if the player is out of ammo or out of a specific ammo.
Setup
Create a test room. Insert a trigger_player_out_of_ammo mesh entity. In its properties, select the Ammo Type: All, Energy Gun (Pistol), Shotgun or Rapidfire (SMG).
In the outputs, add the following output:
My Output | Target Entity | Target Input | Parameter | Delay |
---|---|---|---|---|
OnPlayerOutOfAmmo | <targetEntity> | <input> | 0.00 |
Finishing up
Compile and run your map, and you should have a trigger that, whenever the player enters it or is inside it without the selected ammo, it will output OnPlayerOutOfAmmo.
Beware, if you remove the ammo from your backpack and there is nothing left there and in your trigger, it will fire the output.