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)
Line 1: Line 1:
 +
{{HLATools page|leveldesign=1}}
 
== Introduction ==
 
== Introduction ==
  
Line 29: Line 30:
  
 
Beware, if you remove the ammo from your backpack and there is nothing left there and in your trigger, it will fire the output.
 
Beware, if you remove the ammo from your backpack and there is nothing left there and in your trigger, it will fire the output.
 
[[Category:Half-Life:_Alyx_Workshop_Tools/Level_Design]]
 
[[Category:Half-Life:_Alyx_Workshop_Tools]]
 

Revision as of 20:44, 27 May 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.