Updated VScript in Mapbase (markdown)

Blixibon 2020-05-21 12:14:43 -05:00
parent 79719bd208
commit b94732503b

@ -12,13 +12,14 @@
Mapbase supports a custom implementation of VScript based off of the Alien Swarm SDK and reductor's Squirrel integration. VScript is a scripting layer which allows external scripts to be used as an extension of map logic.
Mapbase's VScript is more limited and primitive compared to the original VScript in Valve's games, as a lot of the original VScript code is inaccessible. Some common global methods and data types are not *(yet)* implemented, but since the Alien Swarm SDK includes entity script descriptions, most of the entity implementations are fully functional.
Mapbase's VScript is more limited and primitive compared to the VScript in Valve's games, as a lot of the original VScript code is inaccessible. Some common global methods and data types are not *(yet)* implemented, but since the Alien Swarm SDK includes entity script descriptions, most of the entity implementations are fully functional.
**Note:** Mapbase's implementation of VScript does **not** use any leaked code whatsoever.
A lot of the documentation for VScript on the VDC applies to Mapbase, but Mapbase also extends the VScript support in various ways, mostly to make it able to operate upon NPCs and other Source 2013/Half-Life 2 conventions. Those changes will be documented here.
A lot of the documentation for VScript on the VDC applies to Mapbase, but Mapbase also extends the VScript support in various ways, mostly to make it able to operate upon NPCs and other Source 2013/Half-Life 2 conventions. Those changes are documented below.
## Classes
## New VScript Classes
These are classes Mapbase exposes to VScript.
### CBaseCombatCharacter
The base class shared by players and NPCs.
@ -70,6 +71,8 @@ The base class for NPCs which act in complex choreo scenes.
| *void* AddLookTarget(handle *target*, float *importance*, float *duration*, float *ramp*)| Add a potential look target for this actor. |
| *void* AddLookTargetPos(Vector *target*, float *importance*, float *duration*, float *ramp*)| Add a potential look target position for this actor. |
***
### CAI_Network
The global list of AI nodes. Can be accessed through a global `AINetwork` instance.
@ -84,6 +87,28 @@ The global list of AI nodes. Can be accessed through a global `AINetwork` instan
| *int* GetNodeType()| Get a node's type |
| *handle* GetNodeHint()| Get a node's hint |
### CAI_Expresser
Expresser class for complex speech. Typically accessed through `GetExpresser()`. Not all NPCs/players have an expresser.
| Signature | Description |
|:------------- | :-----|
| *bool* IsSpeaking()| Check if the actor is speaking. |
| *bool* CanSpeak()| Check if the actor can speak. |
| *bool* BlockSpeechUntil(float *time*)| Block speech for a certain amount of time. This is stored in curtime. |
| *void* ForceNotSpeaking()| If the actor is speaking, force the system to recognize them as not speaking. |
| *void* SpeakRawScene(string *scene*, float *delay*)| Speak a raw, instanced VCD scene as though it were played through the Response System. Return whether the scene successfully plays. |
| *void* ScriptSpeakAutoGeneratedScene(string *soundname*, float *delay*)| Speak an automatically generated, instanced VCD scene for this sound as though it were played through the Response System. Return whether the scene successfully plays. |
***
### CLogicExternalData
An entity which loads keyvalues from an external data file.
| Signature | Description |
|:------------- | :-----|
| *handle* GetKeyValues()| Gets the external data expressed in CScriptKeyValues. |
| *handle* GetKeyValueBlock()| Gets the current external data block expressed in CScriptKeyValues. |
| *void* SetKeyValues(handle *keyvalues*)| Sets the external data from a CScriptKeyValues object. |
| *void* SetKeyValueBlock(handle *keyvalues*)| Sets the current external data block from a CScriptKeyValues object. |
| *void* LoadFile()| Loads external data from the external file. |
| *void* SaveFile()| Saves the external data to the external file. |