From 3d586cc4c8d5f01175afaa8657947c40c5dbf95d Mon Sep 17 00:00:00 2001 From: Blixibon Date: Thu, 11 Jun 2020 18:35:49 -0500 Subject: [PATCH] Updated VScript in Mapbase (markdown) --- VScript-in-Mapbase.md | 94 ++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/VScript-in-Mapbase.md b/VScript-in-Mapbase.md index f4bceb4..832bebb 100644 --- a/VScript-in-Mapbase.md +++ b/VScript-in-Mapbase.md @@ -35,7 +35,7 @@ For more information on VScript itself, [click here](https://developer.valvesoft * [CAI_BaseNPC](VScript-in-Mapbase#CAI_BaseNPC) * [Hooks](VScript-in-Mapbase#CAI_BaseNPC-Hooks) * [CAI_BaseActor](VScript-in-Mapbase#CAI_BaseActor) - * [CAI_Expresser](VScript-in-Mapbase#CAI_Expresser) + * [CAI_Hint](VScript-in-Mapbase#CAI_Hint) * [CAI_GoalEntity](VScript-in-Mapbase#CAI_GoalEntity) * [CAI_ActBusyGoal](VScript-in-Mapbase#CAI_ActBusyGoal) * [CPropVehicle](VScript-in-Mapbase#CPropVehicle) @@ -50,8 +50,8 @@ For more information on VScript itself, [click here](https://developer.valvesoft * [CScriptKeyValues](VScript-in-Mapbase#CScriptKeyValues) * [CTakeDamageInfo](VScript-in-Mapbase#CTakeDamageInfo) * [CGameTrace](VScript-in-Mapbase#CGameTrace) - * [CAI_Hint](VScript-in-Mapbase#CAI_Hint) * [AI_EnemyInfo_t](VScript-in-Mapbase#AI_EnemyInfo_t) + * [CAI_Expresser](VScript-in-Mapbase#CAI_Expresser) * [CFourWheelVehiclePhysics](VScript-in-Mapbase#CFourWheelVehiclePhysics) *** @@ -108,12 +108,12 @@ These are functions that can be accessed globally and without a class. ## Entity Classes -These are entity-based classes Mapbase exposes to VScript. These are listed relative to L4D2 and Portal 2's script functions; some of Mapbase's script functions coincide with Source 2 script functions (e.g. `CTakeDamageInfo` is also exposed to Half-Life: Alyx's VScript in the same way), but they will still be listed here (keep in mind they aren't actually from Source 2's code). +These are entity-based classes Mapbase exposes to VScript. Entities based on one class (e.g. `CAI_BaseNPC` for all NPCs) can use any function from that base class. `CBaseEntity` is the "root" class of all entities and all base classes, so any entity can use its functions. *** ### CBaseEntity -Root class of all server-side entities. +Root class of all server-side entities. This class was already exposed to VScript, but it has new features or changes included with Mapbase. | Signature | Description | |:------------- | :-----| @@ -124,16 +124,16 @@ Root class of all server-side entities. | *int* Classify()| Get Class_T class ID | | *string* GetKeyValue(string *key*)| Get a keyvalue | | *int* GetSpawnFlags()| Get spawnflags | -| *void* AddSpawnFlags()| Add spawnflag(s) | -| *void* RemoveSpawnFlags()| Remove spawnflag(s) | +| *void* AddSpawnFlags(int *flags*)| Add spawnflag(s) | +| *void* RemoveSpawnFlags(int *flags*)| Remove spawnflag(s) | | *void* ClearSpawnFlags()| Clear spawnflag(s) | -| *bool* HasSpawnFlags()| Check if the entity has specific spawnflag(s) ticked | +| *bool* HasSpawnFlags(int *flags*)| Check if the entity has specific spawnflag(s) ticked | | *int* GetEffects()| Get effects | -| *void* AddEffects()| Add effect(s) | -| *void* RemoveEffects()| Remove effect(s) | +| *void* AddEffects(int *flags*)| Add effect(s) | +| *void* RemoveEffects(int *flags*)| Remove effect(s) | | *void* ClearEffects()| Clear effect(s) | -| *void* SetEffects()| Set effect(s) | -| *void* IsEffectActive()| Check if an effect is active | +| *void* SetEffects(int *flags*)| Set effect(s) | +| *void* IsEffectActive(int *flags*)| Check if an effect is active | *** @@ -210,7 +210,7 @@ The base class shared by players and NPCs. *** ### CBasePlayer -The player entity. +The player entity. This class was already exposed to VScript, but it has new features or changes included with Mapbase. | Signature | Description | |:------------- | :-----| @@ -279,19 +279,20 @@ The base class for NPCs which act in complex choreo scenes. *** -### CAI_Expresser -Expresser class for complex speech. Typically accessed through `GetExpresser()`. Not all NPCs/players have an expresser. +### CAI_Hint +An entity which gives contextual pointers for NPCs. | 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. | - - +| *int* GetHintType()| Get the hint's type ID. | +| *handle* GetUser()| Get the hint's current user. | +| *string* GetHintGroup()| Get the name of the hint's group. | +| *string* GetHintActivity()| Get the name of the hint activity. | +| *bool* IsDisabled()| Check if the hint is disabled. | +| *bool* IsLocked()| Check if the hint is locked. | +| *int* GetHintType()| Get the hint's node ID. | +| *float* Yaw()| Get the hint's yaw. | +| *Vector* GetDirection()| Get the hint's direction. | *** @@ -353,13 +354,6 @@ All entities which could be used as filters. *** - -*** - - -*** -*** - ### CLogicExternalData An entity which loads keyvalues from an external data file. @@ -375,7 +369,7 @@ An entity which loads keyvalues from an external data file. *** ## Singletons -single +Singletons are single, global instances which contain a bunch of usable functions and data. *** @@ -390,8 +384,8 @@ The global list of AI nodes. Can be accessed through a global `AINetwork` instan | *float* GetNodeYaw(int *nodeID*)| Get yaw of node | | *float* NearestNodeToPoint(Vector *position*, bool *checkVisibility*)| Get ID of nearest node | | *float* NearestNodeToPointForNPC(handle *npc*, Vector *position*, bool *checkVisibility*)| Get ID of nearest node | -| *int* GetNodeType()| Get a node's type | -| *handle* GetNodeHint()| Get a node's hint | +| *int* GetNodeType(int *nodeID*)| Get a node's type | +| *handle* GetNodeHint(int *nodeID*)| Get a node's hint | *** @@ -420,14 +414,15 @@ All-purpose Mapbase system primarily used for map-specific files. Can be accesse | *void* LoadTalkerFile(string *fileName*)| Loads a custom talker file. | | *void* LoadActbusyFile(string *fileName*)| Loads a custom actbusy file. | +*** ## Data Containers -These are classes that were already exposed to VScript, but have new features or changes included with Mapbase. +These are classes intended to contain and relay specific kinds of data. *** ### CScriptKeyValues -Wrapper class over KeyValues instance. +Wrapper class over KeyValues instance. This class was already exposed to VScript, but it has new features or changes included with Mapbase. | Signature | Description | |:------------- | :-----| @@ -525,23 +520,6 @@ Handle for accessing trace_t info. *** -### CAI_Hint -An entity which gives contextual pointers for NPCs. - -| Signature | Description | -|:------------- | :-----| -| *int* GetHintType()| Get the hint's type ID. | -| *handle* GetUser()| Get the hint's current user. | -| *string* GetHintGroup()| Get the name of the hint's group. | -| *string* GetHintActivity()| Get the name of the hint activity. | -| *bool* IsDisabled()| Check if the hint is disabled. | -| *bool* IsLocked()| Check if the hint is locked. | -| *int* GetHintType()| Get the hint's node ID. | -| *float* Yaw()| Get the hint's yaw. | -| *Vector* GetDirection()| Get the hint's direction. | - -*** - ### AI_EnemyInfo_t Accessor for information about an enemy. Typically accessed through `FindEnemyMemory()`. @@ -574,6 +552,20 @@ Accessor for information about an enemy. Typically accessed through `FindEnemyMe *** +### 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. | + +*** + ### CFourWheelVehiclePhysics Handler for four-wheel vehicle physics. Can be accessed through `GetPhysics()` on vehicles.