General Half-Life 2/Entities
description
Thirsty? A working vending machine.
keywords
vending, machine, bottle, vend.
In this tutorial you will learn how to create a water bottle vending machine similar to the cs_office vending machines.
Start off with the room you want the vending machine to be in. Select your entity tool and place an entity in your map. While it is still selected, press alt+enter and select prop_static from the list. Click on World Model under the Keyvalues and browse for the model named models/props/cs_office/Vending_machine. Adjust your model so it is on the ground and facing the direction your want it to.
We will now create what will cause the bottle to be shot from the vending machine.
Select your entity tool and place it near the vending machine model. While it is selected press alt+enter and choose env_shooter from the list. Give it the following properties:
Name: shooter
Gibs Direction: This will be explained below.
Number of Gibs: 1
Gib Velocity: 150 - This is the speed that the bottle comes out at. You can change this setting to what suits you.
Gib Life: 20 - This is the time in seconds before the bottle disappears.
Model: models/props/cs_office/Water_bottle.mdl
Simulate: Physics
Under the flags tab, tick Repeatable
You must now adjust your env_shooter so it is postioned correctly with the model.
Gibs Direction:
I will now explain how to change the Gibs Direction. In the picture below I have circled the two parts to look out for. The circled part on the properties window is where you edit the direction. You simply click on the white line and change which way it faces. The yellow line is the direction the gib will shoot in. After editing the direction in the properties box and clicking on apply, the yellow line will indicate the new direction.
We must now create a brush and place it over the button of the vending machine as shown below.
With the brush selected, press ctrl+t and choose func_button. Give it the following setings:
Delay Before Reset: 4 - This number can be changed to suit your needs.
Under the flags tick Don't Move and Use Activates.
Next we must setup the Outputs tab. Set it up as show in the image below.
Thats it. Just compile and test.
Related
Example Map
Cr4ig










