This article relates to the game "Half-Life: Alyx". Click here for more information.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Difference between revisions of "Half-Life: Alyx Workshop Tools/Level Design/Trigger Player Out Of Ammo"

From Valve Developer Community
Jump to: navigation, search
(Added HLATools page template)
m (Make entity link to its wiki page)
 
Line 6: Line 6:
 
== Setup ==
 
== 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).
+
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:
 
In the outputs, add the following output:

Latest revision as of 01:18, 21 July 2020

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.