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/Lua Scripting/Getting Started"

From Valve Developer Community
Jump to: navigation, search
(This is where all your .lua files will go)
(Starter Examples)
Line 20: Line 20:
  
 
1. Hello Gordon: '''[[Half-Life:_Alyx_Workshop_Tools/Level_Design/Lua_Scripting_Examples/Hello_Gordon| The classic example]]'''.
 
1. Hello Gordon: '''[[Half-Life:_Alyx_Workshop_Tools/Level_Design/Lua_Scripting_Examples/Hello_Gordon| The classic example]]'''.
 
2. Coming soon ...
 
  
 
== Example Index ==
 
== Example Index ==
 
'''[[Half-Life:_Alyx_Workshop_Tools/Level_Design/Lua_Scripting_Examples|Half-Life: Alyx Lua Scripting Examples]]'''
 
'''[[Half-Life:_Alyx_Workshop_Tools/Level_Design/Lua_Scripting_Examples|Half-Life: Alyx Lua Scripting Examples]]'''

Revision as of 17:46, 22 May 2020

What is Lua?

Lua is a programming language frequently used in games running on the source engine. Lua scripts are able to talk to the game engine through an API layer, which allows people to create new scripts for weapons, gammemodes and much more.

  • NOTE: Due to Half Life Alyx being a fairly new game, some of the API functionality simply does not exist yet on the engine side. For example, you may encounter some API calls that will simply return nil instead of what you were expecting.

Create a Place For Your Scripts

1. Find your hlvr folder

  • The path should looks something like: D:\SteamLibrary\steamapps\common\Half-Life Alyx\game\hlvr, depending on where you installed it.

2. Create folders

  • Create a folder called: scripts. Inside that folder create another folder called: vscripts.
  • you should now be in a directory that looks like this: D:\SteamLibrary\steamapps\common\Half-Life Alyx\game\hlvr\scripts\vscripts

This is where all your .lua files will go

Source looks for the scripts in the scripts/vscripts folder. You can also add folders in scripts/vscripts to separate out your scripts by project or have common scripts.

Starter Examples

These basic examples will show you how to connect the game world to the scripts that you write:

1. Hello Gordon: The classic example.

Example Index

Half-Life: Alyx Lua Scripting Examples