Skip to content

Vending shop prefab for map creators to use in custom Half-Life: Alyx maps.

License

Notifications You must be signed in to change notification settings

ThomasTerp/hla-vending-shop

Repository files navigation

Half-Life: Alyx - Vending Shop Prefab

A vending machine prefab for map creators to use in custom Half-Life: Alyx maps.
https://youtu.be/HkA5BKw9mug

It has 6 slots for items that players can purchase using resin. The items can either be randomized or map creators can choose what goes in each slot along with their cost. The items are ammo, grenades and syringes. Map creators can also place custom items, like a keycard. The Vending Shop is made mostly using scripting, however you don't have to touch a single line of code to use or customize it.

Installing

Follow these steps to install it for use with your addon:

  1. Download the latest release
  2. Extract the folders inside of \game\hla_addons\vending_shop\ into your
    C:\Program Files (x86)\Steam\steamapps\common\Half-Life Alyx\game\hlvr_addons\<YOUR ADDON NAME>\ folder
  3. Extract the folders inside of \content\hla_addon\vending_shop\ into your
    C:\Program Files (x86)\Steam\steamapps\common\Half-Life Alyx\content\hlvr_addons\<YOUR ADDON NAME>\ folder

Note: If you installed the demo map, remember to remove that map before publishing your map to the workshop, remove all files named vending_shop_demo from these locations:

  • \content\hlvr_addons\<YOUR ADDON NAME>\maps\
  • \game\hlvr_addons\<YOUR ADDON NAME>\maps\
  • \game\hlvr_addons\<YOUR ADDON NAME>\maps\graphs\

How to use

Follow these steps to add a Vending Shop to your map:

  1. Open the Prefabs tab at top of the Hammer window
  2. Select Import Prefab
  3. Find the folder containing the Vending Shop prefab in \content\hlvr_addons\<YOUR ADDON NAME>\maps\prefabs\vending_shop\ and open vending_shop.vmap
  4. The prefab should now be added to the map and is ready to use
  5. Optionally you can change the properties of the prefab to your liking, see Prefab Variables below for more detailed descriptions of each variable

Prefab Variables

These variables can be changed per prefab instance to customize how the Vending Shop functions.
Prefab variables

Prefab Variable Default Value Description
Start Active On Start the Vending Shop activated
Items will only be spawned while active
Starting Currency Amount 0 How much currency the Vending Shop starts with
Extra Lights Off Turn on extra lighting, useful for dark places
Tutorial On Enable tutorial that shows players where to put currency
Only shows once globabally per new game
Disable Emit Trigger Off Disable the trigger that allows the player to take resin out of their backpack
This can be used if you want to use your own trigger that fits the environment shape better
Slot 1 Cost -1 Cost of slot 1, will be assigned automatically when set to -1
Slot 2 Cost -1 Cost of slot 2, will be assigned automatically when set to -1
Slot 3 Cost -1 Cost of slot 3, will be assigned automatically when set to -1
Slot 4 Cost -1 Cost of slot 4, will be assigned automatically when set to -1
Slot 5 Cost -1 Cost of slot 5, will be assigned automatically when set to -1
Slot 6 Cost -1 Cost of slot 6, will be assigned automatically when set to -1
Slot 1 Item Random Type of item inside slot 1
Slot 2 Item Random Type of item inside slot 2
Slot 3 Item Random Type of item inside slot 3
Slot 4 Item Random Type of item inside slot 4
Slot 5 Item Random Type of item inside slot 5
Slot 6 Item Random Type of item inside slot 6

Prefab Variables - Advanced

These variables can break the whole Vending Shop if formatted incorrectly, so only change them if you know what you are doing.

Prefab Variable Default Value Description
Random Item Chances item_hlvr_clip_energygun=80,
item_hlvr_clip_energygun_multiple=20,
item_hlvr_clip_shotgun_multiple=100,
item_hlvr_clip_rapidfire=100, item_hlvr_grenade_frag=50,
item_hlvr_grenade_xen=50,
item_healthvial=100
Comma separated string to assign chance (0 to 100) for randomized slots
Item Costs
(when -1)
item_hlvr_clip_energygun=3,
item_hlvr_clip_energygun_multiple=10,
item_hlvr_clip_shotgun_multiple=6,
item_hlvr_clip_rapidfire=8, item_hlvr_grenade_frag=5,
item_hlvr_grenade_xen=5,
item_healthvial=5
Comma separated string to assign cost for item types
These only get applied when the slot cost is set to -1