Updated VScript in Mapbase (markdown)

Blixibon 2020-05-22 19:32:29 -05:00
parent 95e46bfbc7
commit 48c55b040a

@ -22,17 +22,22 @@ Mapbase's implementation of VScript does **not** use any leaked code whatsoever.
* [Known incompatibilities with Valve's VScript](VScript-in-Mapbase#Known-incompatibilities-with-Valves-VScript)
* [Documentation](VScript-in-Mapbase#Documentation)
* [Global Functions](VScript-in-Mapbase#Global-Functions)
* [New VScript Classes](VScript-in-Mapbase#New-VScript-Classes)
* [CBaseCombatCharacter](VScript-in-Mapbase#CBaseCombatCharacter)
* [CAI_BaseNPC](VScript-in-Mapbase#CAI_BaseNPC)
* [Hooks](VScript-in-Mapbase#Hooks)
* [CAI_BaseActor](VScript-in-Mapbase#CAI_BaseActor)
* [CAI_Network](VScript-in-Mapbase#CAI_Network)
* [CAI_Hint](VScript-in-Mapbase#CAI_Hint)
* [CAI_Expresser](VScript-in-Mapbase#CAI_Expresser)
* [CGlobalState](VScript-in-Mapbase#CGlobalState)
* [CMapbaseSystem](VScript-in-Mapbase#CMapbaseSystem)
* [CLogicExternalData](VScript-in-Mapbase#CLogicExternalData)
* [Modified VScript Classes](VScript-in-Mapbase#Modified-VScript-Classes)
* [CBaseEntity](VScript-in-Mapbase#CBaseEntity)
* [CBasePlayer](VScript-in-Mapbase#CBasePlayer)
* [CScriptKeyValues](VScript-in-Mapbase#CScriptKeyValues)
***
@ -52,6 +57,15 @@ In addition to the original VScript inputs, Mapbase introduces a new `RunScriptC
Other changes are documented below.
## Global Functions
These are functions that can be accessed globally and without a class.
| Signature | Description |
|:------------- | :-----|
| *handle* SpawnEntityFromKeyValues(string *className*, handle *keyValues)| Spawns an entity with the keyvalues in a CScriptKeyValues handle. |
| *handle* GameOver(string *message*, float *delay*, float *fadeTime*, float *loadTime*, int *r*, int *g*, int *b*)| Ends the game and reloads the last save. |
| *bool* MegaPhyscannonActive()| Checks if supercharged gravity gun mode is enabled. |
## New VScript Classes
These are classes Mapbase exposes to VScript.
@ -96,6 +110,7 @@ The base class shared all NPCs derive from.
| *void* SetEnemy(handle *target*)| Set the NPC's current enemy. |
| *Vector* GetEnemyLKP()| Get the last known position of the NPC's current enemy. |
| *handle* FindEnemyMemory()| Get information about the NPC's current enemy. |
| *string* GetHintGroup()| Get the name of the NPC's hint group. |
| *int* GetNPCState()| Get the NPC's current state. |
| *int* CapabilitiesGet()| Get the capabilities the NPC currently possesses. |
| *void* CapabilitiesAdd(int *capabilities*)| Add capabilities to the NPC. |
@ -125,6 +140,7 @@ The base class shared all NPCs derive from.
| Signature | Description |
|:------------- | :-----|
| *variable* NPC_TranslateActivity()| Translates a requested NPC activity to another activity. The requested activity is stored as a string in `activity` and as an integer in `activity_id`. Either an activity string or an activity ID can be returned. If either -1 or "ACT_INVALID" are returned, the activity will not be translated to anything different. |
| *variable* NPC_TranslateSchedule()| Translates a requested NPC schedule to another schedule. The requested schedule is stored as a string in `schedule` and as an integer in `schedule_id`. Either a schedule name string or a schedule ID can be returned. If either -1 or "SCHED_NONE" are returned, the schedule will not be translated to anything different. |
***
@ -155,6 +171,23 @@ The global list of AI nodes. Can be accessed through a global `AINetwork` instan
***
### 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. |
***
### CAI_Expresser
Expresser class for complex speech. Typically accessed through `GetExpresser()`. Not all NPCs/players have an expresser.
@ -170,6 +203,33 @@ Expresser class for complex speech. Typically accessed through `GetExpresser()`.
***
***
### CGlobalState
Global state system. Can be accessed through a global `Globals` instance.
| Signature | Description |
|:------------- | :-----|
| *int* GetIndex(string *globalName*)| Gets the index of the specified global name. Returns -1 if it does not exist. |
| *int* AddGlobal(string *globalName*)| Adds a new global with a specific map name and state. Returns its index. |
| *int* GetState(string *globalName*)| Gets the state of the specified global. |
| *void* SetState(string *globalName*, int *state*)| Sets the state of the specified global. |
| *int* GetCounter(string *globalName*)| Gets the counter of the specified global. |
| *void* SetCounter(string *globalName*, int *counter*)| Sets the counter of the specified global. |
| *void* AddToCounter(string *globalName*, int *counter*)| Adds to the counter of the specified global. |
***
### CMapbaseSystem
All-purpose Mapbase system primarily used for map-specific files. Can be accessed through a global `Mapbase` instance.
| Signature | Description |
|:------------- | :-----|
| *void* AddManifestFile(string *fileName*)| Loads a manifest file. |
| *void* LoadSoundscriptFile(string *fileName*)| Loads a custom soundscript file. |
| *void* LoadTalkerFile(string *fileName*)| Loads a custom talker file. |
| *void* LoadActbusyFile(string *fileName*)| Loads a custom actbusy file. |
***
### CLogicExternalData
An entity which loads keyvalues from an external data file.
@ -182,9 +242,13 @@ An entity which loads keyvalues from an external data file.
| *void* LoadFile()| Loads external data from the external file. |
| *void* SaveFile()| Saves the external data to the external file. |
***
## Modified VScript Classes
These are classes that were already exposed to VScript, but have new features or changes included with Mapbase.
***
### CBaseEntity
Root class of all server-side entities.
@ -195,6 +259,8 @@ Root class of all server-side entities.
| *bool* IsVisibleWithMask(Vector *target*, int *traceMask*)| Check if the specified position can be visible to this entity with a specific trace mask. |
| *int* Classify()| Get Class_T class ID |
***
### CBasePlayer
The player entity.
@ -202,6 +268,8 @@ The player entity.
|:------------- | :-----|
| *handle* GetExpresser()| Get a handle for this player's expresser. |
***
### CScriptKeyValues
Wrapper class over KeyValues instance.