From 318f036500c355ce70a0859ffced08a602b56094 Mon Sep 17 00:00:00 2001 From: Blixibon Date: Fri, 12 Jun 2020 13:58:28 -0500 Subject: [PATCH] Updated Using VScript as a HL2 mapper (markdown) --- Using-VScript-as-a-HL2-mapper.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Using-VScript-as-a-HL2-mapper.md b/Using-VScript-as-a-HL2-mapper.md index 5681bc6..6772e37 100644 --- a/Using-VScript-as-a-HL2-mapper.md +++ b/Using-VScript-as-a-HL2-mapper.md @@ -1,9 +1,19 @@ This article is for Half-Life 2/Source 2013 mappers who have no experience with VScript to learn what it is and how they can use it in their maps. -Most mappers think VScript is too complicated since it's basically in-map programming and most mappers are not programmers. For that crowd, it actually works best when it makes things *less* complicated. +There are three main ways in which VScript can be used: + +* [**Using VScript to simplify map logic**](Using-VScript-as-a-HL2-mapper#Using-VScript-to-simplify-map-logic) +* [**Using VScript to do what's not possible with I/O**](Using-VScript-as-a-HL2-mapper#Using-VScript-to-do-what's-not possible-with-I/O) +* [**Using VScript to modify game behavior**](Using-VScript-as-a-HL2-mapper#Using-VScript-to-modify-game-behavior) + +Each of these sections have their own tutorial which starts as if you've never used VScript before. + +Mapbase's implementation of VScript started with code ported from the Alien Swarm SDK and reductor's custom Squirrel integration; it has been expanded to include functions adjusted specifically for Half-Life 2-related purposes as well as some more access to Valve's mathlib and utility functions. ## Using VScript to simplify map logic +Most mappers think VScript is too complicated since it's basically in-map programming and most mappers are not programmers. For that crowd, it actually works best when it makes things *less* complicated. + Source's logic entities *(and Mapbase's expansions to them)* make the I/O system a flexible tool for doing complex things, like math or storage. However, this can get very complicated very quickly, as several different outputs fire several different inputs on several different entities as one big, messy jumble of icons in Hammer's 3D view. VScript can be used to simplify these types of logic contraptions, as things like storing numbers, adding/subtracting numbers, finding entities, etc. can happen using just one line of text. This can be done to make map logic seem less complicated and sometimes it's actually necessary to reduce the level's entity count. @@ -14,4 +24,14 @@ If you want to learn how to use VScript, it may be best to start by doing it *al While you can just use VScript to simplify map logic, it also unlocks a lot of potential in other areas. It's a pathway to many abilities some mappers would consider...unnatural. Of course, if you're already a programmer, then using this side of VScript may come naturally. If not, then it may seem a bit more complex, but if you think you can benefit from what it's capable of, then it would definitely be worth the trouble. -[Click here to go to a tutorial which makes it simple and easy to understand.](https://github.com/mapbase-source/source-sdk-2013/wiki/VScript-:-Basic-Entity-Code-Tutorial) \ No newline at end of file +[Click here to go to a tutorial which makes it simple and easy to understand.](https://github.com/mapbase-source/source-sdk-2013/wiki/VScript-:-Basic-Entity-Code-Tutorial) + +## Using VScript to modify game behavior + +In some of Valve's games, VScript had unique abilities to modify game-specific behavior. This often replaced dedicated logic entities or even the regular keyvalue-based `scripts` files. + +For example, in Left 4 Dead 2, you can use VScript to influence or detect the behavior of the AI director which controls zombie spawning. This is often used to choreograph campaign finales. + +Half-Life 2 doesn't have any of those kinds of complex built-in game systems, but Mapbase still adds hooks to modify certain HL2-related elements. For instance, Mapbase adds `NPC_TranslateActivity` and `NPC_TranslateSchedule` hooks for modifying NPC behavior. + +(TODO: Tutorial) \ No newline at end of file