mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-02-03 09:10:40 +03:00
Updated VScript in Mapbase (markdown)
parent
7b87c51a4d
commit
080733e555
@ -1,8 +1,8 @@
|
||||
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.
|
||||
VScript is a scripting layer which allows external scripts to be used as an extension of map logic. It was originally created by Valve for Left 4 Dead 2 and has existed in the majority of their games ever since.
|
||||
|
||||
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.
|
||||
Mapbase supports a custom implementation of VScript based off of the Alien Swarm SDK and the public Squirrel API. It was originally created by reductor with the goal of creating a legal, open-source version of VScript in Source 2013. **Mapbase's implementation of VScript does not use any leaked code whatsoever.**
|
||||
|
||||
Mapbase's implementation of VScript does **not** use any leaked code whatsoever.
|
||||
Because a lot of the original VScript code is inaccessible, Mapbase's VScript is composed of code and script descriptions from the Alien Swarm SDK, code inspired by VScript documentation from the Valve Developer Community, and code created for the purpose of adding more capabilities in a Source 2013/Half-Life 2 setting. Overall, it's much different from the VScript in Valve's games and it diverges a lot from what VScript was originally meant to be capable of. More information on what's different in Mapbase's VScript can be found below.
|
||||
|
||||
For more information on VScript itself, [click here](https://developer.valvesoftware.com/wiki/VScript) to see its article on the Valve Developer Community. See [[Using VScript as a HL2 mapper]] if you're coming to VScript as a HL2/Source 2013 mapper with no prior VScript experience.
|
||||
|
||||
@ -13,47 +13,9 @@ For more information on VScript itself, [click here](https://developer.valvesoft
|
||||
* [Known incompatibilities with Valve's VScript](VScript-in-Mapbase#Known-incompatibilities-with-Valves-VScript)
|
||||
* [Tutorials](VScript-in-Mapbase#Tutorials)
|
||||
* [Documentation](VScript-in-Mapbase#Documentation)
|
||||
* [Global Functions](VScript-in-Mapbase#Global-Functions)
|
||||
* [Math](VScript-in-Mapbase#Math)
|
||||
* [Entity Classes](VScript-in-Mapbase#Entity-Classes)
|
||||
* [CBaseEntity](VScript-in-Mapbase#CBaseEntity)
|
||||
* [Hooks](VScript-in-Mapbase#CBaseEntity-Hooks)
|
||||
* [CBaseAnimating](VScript-in-Mapbase#CBaseAnimating)
|
||||
* [CBaseCombatWeapon](VScript-in-Mapbase#CBaseCombatWeapon)
|
||||
* [CBaseCombatCharacter](VScript-in-Mapbase#CBaseCombatCharacter)
|
||||
* [CBasePlayer](VScript-in-Mapbase#CBasePlayer)
|
||||
* [Hooks](VScript-in-Mapbase#CBasePlayer-Hooks)
|
||||
* [CHL2_Player](VScript-in-Mapbase#CHL2_Player)
|
||||
* [CAI_BaseNPC](VScript-in-Mapbase#CAI_BaseNPC)
|
||||
* [Hooks](VScript-in-Mapbase#CAI_BaseNPC-Hooks)
|
||||
* [CAI_BaseActor](VScript-in-Mapbase#CAI_BaseActor)
|
||||
* [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)
|
||||
* [CPropVehicleDriveable](VScript-in-Mapbase#CPropVehicleDriveable)
|
||||
* [CBaseFilter](VScript-in-Mapbase#CBaseFilter)
|
||||
* [CSceneListManager](VScript-in-Mapbase#CSceneListManager)
|
||||
* [CLogicExternalData](VScript-in-Mapbase#CLogicExternalData)
|
||||
* [Singletons *(Game Systems)*](VScript-in-Mapbase#Singletons)
|
||||
* [CLocalize](VScript-in-Mapbase#CLocalize)
|
||||
* [CAI_Network](VScript-in-Mapbase#CAI_Network)
|
||||
* [CGlobalState](VScript-in-Mapbase#CGlobalState)
|
||||
* [CMapbaseSystem](VScript-in-Mapbase#CMapbaseSystem)
|
||||
* [Data Containers](VScript-in-Mapbase#Data-Containers)
|
||||
* [CScriptKeyValues](VScript-in-Mapbase#CScriptKeyValues)
|
||||
* [CTakeDamageInfo](VScript-in-Mapbase#CTakeDamageInfo)
|
||||
* [Global Functions](VScript-in-Mapbase#CTakeDamageInfo-Global-Functions)
|
||||
* [CGameTrace](VScript-in-Mapbase#CGameTrace)
|
||||
* [FireBulletsInfo_t](VScript-in-Mapbase#FireBulletsInfo_t)
|
||||
* [Global Functions](VScript-in-Mapbase#FireBulletsInfo_t-Global-Functions)
|
||||
* [AI_EnemyInfo_t](VScript-in-Mapbase#AI_EnemyInfo_t)
|
||||
* [CAI_Expresser](VScript-in-Mapbase#CAI_Expresser)
|
||||
* [CFourWheelVehiclePhysics](VScript-in-Mapbase#CFourWheelVehiclePhysics)
|
||||
* [CUserCmd](VScript-in-Mapbase#CUserCmd)
|
||||
* [Data Types](VScript-in-Mapbase#Data-Types)
|
||||
* [matrix3x4_t](VScript-in-Mapbase#matrix3x4_t)
|
||||
* [Global Functions](VScript-in-Mapbase#matrix3x4_t-Global-Functions)
|
||||
* [New Utilities](VScript-in-Mapbase#New-Utilities)
|
||||
* [Players, NPCs, and Weapons](VScript-in-Mapbase#Players-NPCs-and-Weapons)
|
||||
* [VScript VBSP](VScript-in-Mapbase#VScript-VBSP)
|
||||
|
||||
***
|
||||
|
||||
@ -61,17 +23,8 @@ For more information on VScript itself, [click here](https://developer.valvesoft
|
||||
|
||||
Some features from Valve's games are not available in Mapbase's implementation of VScript, although some may be available in the future.
|
||||
|
||||
* Most of the global functions are not yet available because many of them are game-specific and are not included in the Alien Swarm SDK.
|
||||
* Notable functions which are in Mapbase's implementation:
|
||||
* `AddThinkToEnt`
|
||||
* `EntIndexToHScript`
|
||||
* `PrecacheEntityFromTable`
|
||||
* `SpawnEntityFromTable`
|
||||
* Some singletons are not yet available.
|
||||
* Notable singletons which are in Mapbase's implementation:
|
||||
* `Entities`
|
||||
* `Convars`
|
||||
* `NetProps`
|
||||
* Some of the global functions are not yet available because many of them are game-specific and are not included in the Alien Swarm SDK.
|
||||
* Some singletons are not yet available for the same reason.
|
||||
* `script_debug` is not supported.
|
||||
* In the source code, the following `IScriptVM` functions are currently unsupported: `ConnectDebugger`, `DisconnectDebugger`, `AddSearchPath`, `Frame`, `DumpState`, `SetOutputCallback`, `SetErrorCallback`
|
||||
|
||||
@ -91,835 +44,38 @@ A few tutorials are available for using VScript in Mapbase.
|
||||
|
||||
#### [List of L4D2 Script Functions](https://developer.valvesoftware.com/wiki/List_of_L4D2_Script_Functions)
|
||||
#### [List of Portal 2 Script Functions](https://developer.valvesoftware.com/wiki/List_of_Portal_2_Script_Functions)
|
||||
#### [Half-Life Alyx Scripting API](https://developer.valvesoftware.com/wiki/Half-Life_Alyx_Scripting_API)
|
||||
|
||||
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.
|
||||
A lot of the documentation for VScript on the VDC applies to Mapbase, but Mapbase has many changes which do not exist in Valve's games, so it has its own documentation as well.
|
||||
|
||||
However, because of the lack of automation and the amount of work needed to document it online, no full online documentation exists for Mapbase's VScript functions, constants, or classes. Instead, users could use the `script_help` command in-game. This command allows users to print documentation to the console for any functions, constants, or classes which involve the entered text. For example, you can type `script_help collision` to get all functions or constants with "collision" in their names or documentation text.
|
||||
|
||||
# New Utilities
|
||||
|
||||
In addition to the original VScript inputs, Mapbase introduces a new `RunScriptCodeQuotable` input. This operates the same way as `RunScriptCode`, but double apostrophes ('') are converted to quotation marks ("), allowing code with strings to be run from Hammer and in-game `ent_fire`.
|
||||
|
||||
This article will only list functions and classes introduced as a part of Mapbase's changes. Mapbase's VScript is based off of the Alien Swarm SDK, so it already contains most of the functions available in L4D2 and Portal 2.
|
||||
# Players, NPCs, and Weapons
|
||||
|
||||
Some of Mapbase's script functions coincide with Source 2's script functions. For example, `CTakeDamageInfo` is available in Mapbase's VScript, but it's also available in Half-Life: Alyx's VScript in almost the exact same way. This is usually a matter of either inspiration or evolutionary convergence, but none of Mapbase's counterparts are actually from Source 2's code and they will still be listed here.
|
||||
Mapbase exposes player, NPC, and weapon classes/functions primarily used in Half-Life 2. They allow VScript to know and do more about the current state of entities which would be highly prominent in mods using Mapbase.
|
||||
|
||||
**Note:** This only includes serverside script functions. Clientside scripting (e.g. through the `VScriptProxy` material proxy) may be limited to fewer/different functions. Use `script_help_client` in-game to get documentation for clientside VScript.
|
||||
Players and NPCs share a single class called `CBaseCombatCharacter`, which is one of the classes extensively exposed to VScript by Mapbase. More documentation can be given with the `script_help` command, but it contains several functions for reading weapon-related data, including the amount of ammo a NPC or player currently has. Weapons themselves have also been exposed with most of the functions regularly used in the code.
|
||||
|
||||
## Global Functions
|
||||
These are functions that can be accessed globally and without a class.
|
||||
In spite of the overlap, players and NPCs have been given their own exclusive functions as well. Not all of them are listed here, but here's a basic overview of what can now be done:
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *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. |
|
||||
| *void* printc(*string* text)| Version of print() which takes a color before the message. |
|
||||
| *void* printcl(*string* text)| Version of printl() which takes a color before the message. |
|
||||
| *void* DecalTrace(*CGameTrace* trace, *string* decalName)| Creates a dynamic decal based on the given trace info. The trace information can be generated by TraceLineComplex() and the decal name must be from decals_subrect.txt. |
|
||||
### Players
|
||||
|
||||
***
|
||||
* There are now functions for monitoring and controlling the player's "button mask", or which binds the player is holding down. This is used by `game_ui` to detect what the player is pressing and `player_speedmod` suppresses abilities by selectively preventing certain buttons from being added to the button mask. *(Both features can also be used through these new VScript functions)*
|
||||
* There are now functions for detecting HEV suit properties, like the amount of armor, aux power, flashlight battery, etc. are available and whether certain suit features are being used.
|
||||
* In HL2's HEV suit, support for custom suit devices has been added. (TODO: proper tutorial?)
|
||||
* A `PlayerRunCommand` hook has been added for controlling the player's movement and button commands as an alternative to the `game_ui` entity.
|
||||
|
||||
### Entities
|
||||
These global functions are related to entities.
|
||||
### NPCs
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *handle* SpawnEntityFromKeyValues(*string* className, *handle* keyValues)| Spawns an entity with the keyvalues in a CScriptKeyValues handle. |
|
||||
| *void* EntitiesInBox(*handle* table, *int* listMax, *Vector* hullMin, *Vector* hullMax, *int* iMask)| Gets all entities which are within a worldspace box. |
|
||||
| *void* EntitiesAtPoint(*handle* table, *int* listMax, *Vector* point, *int* iMask)| Gets all entities which are intersecting a point in space. |
|
||||
| *void* EntitiesInSphere(*handle* table, *int* listMax, *Vector* center, *float* radius, *int* iMask)| Gets all entities which are within a sphere. |
|
||||
* TODO
|
||||
|
||||
### Math
|
||||
These global functions are related to math or math-related classes.
|
||||
# VScript VBSP
|
||||
|
||||
#### Angle
|
||||
As of Mapbase v6.0, VBSP is capable of supporting a VScript VM which can read from and write to a compiling map. As of writing, this is a work-in-progress feature and its abilities are mostly limited to operating upon entities.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *float* ApproachAngle(float *target*, float *value*, float *speed*)| Returns an angle which approaches the target angle from the input angle with the specified speed. |
|
||||
| *float* AngleDiff(float *destAngle*, float *srcAngle*)| Returns the degrees difference between two yaw angles. |
|
||||
| *float* AngleDistance(float *next*, float *cur*)| Returns the distance between two angles. |
|
||||
| *float* AngleNormalize(float *angle*)| Clamps an angle to be in between -360 and 360. |
|
||||
| *float* AngleNormalizePositive(float *angle*)| Clamps an angle to be in between 0 and 360. |
|
||||
| *bool* AnglesAreEqual(float *a*, float *b*, float *tolerance*)| Checks if two angles are equal based on a given tolerance value. |
|
||||
VScript in VBSP can be enabled with the `-scripting` launch parameter. When this is enabled, VBSP will seek out a "<mapname>_vbsp.nut" file in the same directory as the VMF. To print documentation for VScript in VBSP, the `-doc` launch parameter could also be used.
|
||||
|
||||
#### Vector
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *Vector* AngleVectors(Vector *angles*)| Turns an angle into a direction vector. |
|
||||
| *Vector* VectorAngles(Vector *direction*)| Turns a direction vector into an angle. |
|
||||
| *float* CalcSqrDistanceToAABB(Vector *mins*, Vector *maxs*, Vector *point*)| Returns the squared distance to a bounding box. |
|
||||
| *Vector* CalcClosestPointOnAABB(Vector *mins*, Vector *maxs*, Vector *point*)| Returns the closest point on a bounding box. |
|
||||
| *float* CalcDistanceToLine(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the distance to a line. |
|
||||
| *Vector* CalcClosestPointOnLine(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the closest point on a line. |
|
||||
| *float* CalcDistanceToLineSegment(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the distance to a line segment. |
|
||||
| *Vector* CalcClosestPointOnLineSegment(Vector *point*, Vector *vLineA*, Vector *vLineB*)| Returns the closest point on a line segment. |
|
||||
|
||||
#### Misc.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *float* Approach(*float* target, *float* value, *float* speed)| Returns a value which approaches the target value from the input value with the specified speed. |
|
||||
| *float* PredictedPosition(*CBaseEntity* target, *float* flTimeDelta)| Predicts what an entity's position will be in a given amount of time. |
|
||||
|
||||
### Precaching
|
||||
These global functions are related to precaching assets.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *int* PrecacheModel(*string* fileName)| Precaches a model for later usage. |
|
||||
| *void* PrecacheMaterial(*string* fileName)| Precaches a material for later usage. |
|
||||
| *void* PrecacheParticleSystem(*string* fileName)| Precaches a particle system for later usage. |
|
||||
| *void* PrecacheOther(*string* className)| Precaches an entity class for later usage. |
|
||||
|
||||
***
|
||||
|
||||
## Entity Classes
|
||||
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. This class was already exposed to VScript, but it has new features or changes included with Mapbase.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *bool* IsVisible(*Vector* target)| Check if the specified position can be visible to this entity. |
|
||||
| *bool* IsEntVisible(*CBaseEntity* target)| Check if the specified entity can be visible to this entity. |
|
||||
| *bool* IsVisibleWithMask(*Vector* target, *int* traceMask)| Check if the specified position can be visible to this entity with a specific trace mask. |
|
||||
| *int* TakeDamage(*CTakeDamageInfo* info)| Apply damage to this entity with a given info handle |
|
||||
| *void* FireBullets(*FireBulletsInfo_t* info)| Fire bullets from entity with a given info handle |
|
||||
| *int* TakeHealth(*float* health, *int* damageType)| Give this entity health |
|
||||
| *bool* IsAlive()| Return true if this entity is alive |
|
||||
| *int* GetWaterLevel()| Get current level of water submergence |
|
||||
| *int* Classify()| Get Class_T class ID |
|
||||
| *bool* AddOutput(*string* output, *string* target, *string* input, *string* parameter, *float* delay, *int* maxTimes)| Add an output |
|
||||
| *string* GetKeyValue(string *key*)| Get a keyvalue |
|
||||
| *int* GetSpawnFlags()| Get spawnflags |
|
||||
| *void* AddSpawnFlags(int *flags*)| Add spawnflag(s) |
|
||||
| *void* RemoveSpawnFlags(int *flags*)| Remove spawnflag(s) |
|
||||
| *void* ClearSpawnFlags()| Clear spawnflag(s) |
|
||||
| *bool* HasSpawnFlags(int *flags*)| Check if the entity has specific spawnflag(s) ticked |
|
||||
| *Vector* GetColorVector()| Get the render color as a vector |
|
||||
| *int* GetColorR()| Get the render color's R value |
|
||||
| *int* GetColorG()| Get the render color's G value |
|
||||
| *int* GetColorB()| Get the render color's B value |
|
||||
| *int* GetAlpha()| Get the render color's alpha value |
|
||||
| *void* SetColorVector(*Vector* value)| Set the render color as a vector |
|
||||
| *void* SetColorR(*int* value)| Set the render color's R value |
|
||||
| *void* SetColorG(*int* value)| Set the render color's G value |
|
||||
| *void* SetColorB(*int* value)| Set the render color's B value |
|
||||
| *void* SetAlpha(*int* value)| Set the render color's alpha value |
|
||||
| *int* GetEffects()| Get effects |
|
||||
| *void* AddEffects(*int* flags)| Add effect(s) |
|
||||
| *void* RemoveEffects(*int* flags)| Remove effect(s) |
|
||||
| *void* ClearEffects()| Clear effect(s) |
|
||||
| *void* SetEffects(*int* flags)| Set effect(s) |
|
||||
| *void* IsEffectActive(*int* flags)| Check if an effect is active |
|
||||
| *void* SetAbsAngles(*Vector* value)| Set angles relative to world origin |
|
||||
| *Vector* GetLocalOrigin()| Get origin relative to parent or world origin |
|
||||
| *void* SetLocalOrigin(*Vector* value)| Set origin relative to parent or world origin |
|
||||
| *Vector* GetLocalAngles()| Get angles relative to parent or world origin |
|
||||
| *void* SetLocalAngles(*Vector* value)| Set angles relative to parent or world origin |
|
||||
| *Vector* EyeAngles()| Get eye pitch, yaw, roll as a vector |
|
||||
| *bool* IsPlayer()| Returns true if this entity is a player. |
|
||||
| *bool* IsNPC()| Returns true if this entity is a NPC. |
|
||||
| *bool* IsCombatCharacter()| Returns true if this entity is a combat character (player or NPC). |
|
||||
| *bool* IsWeapon()| Returns true if this entity is a weapon. |
|
||||
|
||||
***
|
||||
|
||||
#### CBaseEntity Hooks
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *bool* Input*InputName*()| Called when the entity receives an input from the I/O system. [This already existed in L4D2](https://developer.valvesoftware.com/wiki/List_of_L4D2_Script_Functions#Hooks), but Mapbase adds a `parameter` value which contains the input's parameter. |
|
||||
| *bool* FireBullets()| Called when the entity fires bullets. The involved `FireBulletsInfo_t` can be accessed via `info`. Returning true on this function will allow the bullets to be fired, but returning false prevents the bullets from being fired at all. |
|
||||
|
||||
***
|
||||
|
||||
### CBaseAnimating
|
||||
Base class for model-based entities. This class was already exposed to VScript, but it has new features or changes included with Mapbase.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *matrix3x4_t* GetAttachmentMatrix(*int* attachment)| Get the attachment id's matrix transform |
|
||||
| *float* GetPoseParameter(*string* name)| Get the specified pose parameter's value |
|
||||
| *float* SetPoseParameter(*string* name, *float* value)| Set the specified pose parameter to the specified value |
|
||||
| *int* LookupBone(*string* name)| Get the named bone id |
|
||||
| *void* GetBoneTransform(*int* bone, *matrix3x4_t* matrix)| Get the transform for the specified bone |
|
||||
| *void* GetPhysicsBone(*int* bone)| Get physics bone from bone index |
|
||||
| *int* GetNumBones()| Get the number of bones |
|
||||
| *int* GetSequence()| Gets the current sequence |
|
||||
| *void* SetSequence(*int* sequence)| Gets the current sequence |
|
||||
| *bool* SequenceLoops()| Checks if the current sequence loops |
|
||||
| *int* LookupSequence(*string* name)| Gets the index of the specified sequence name |
|
||||
| *int* LookupActivity(*string* name)| Gets the ID of the specified activity name |
|
||||
| *bool* SequenceHasMovement(*int* sequence)| Checks if the specified sequence has movement |
|
||||
| *float* GetSequenceMoveYaw(*int* sequence)| Gets the move yaw of the specified sequence |
|
||||
| *float* GetSequenceMoveDist(*int* sequence)| Gets the move distance of the specified sequence |
|
||||
| *string* GetSequenceName(*int* sequence)| Gets the name of the specified sequence index |
|
||||
| *string* GetSequenceActivityName(*int* sequence)| Gets the activity name of the specified sequence index |
|
||||
| *int* GetSequenceActivity(*int* sequence)| Gets the activity ID of the specified sequence index |
|
||||
| *int* SelectWeightedSequence(*int* activity)| Selects a sequence for the specified activity ID |
|
||||
| *int* SelectHeaviestSequence(*int* activity)| Selects the sequence with the heaviest weight for the specified activity ID |
|
||||
| *CScriptKeyValues* GetSequenceKeyValues(*int* sequence) | Get a KeyValue class instance on the specified sequence. WARNING: This uses the same KeyValue pointer as GetModelKeyValues! |
|
||||
| *int* GetBodygroup(*int* group) | Gets a bodygroup |
|
||||
| *string* GetBodygroupName(*int* group) | Gets a bodygroup name |
|
||||
| *int* FindBodygroupByName(*string* name) | Finds a bodygroup by name |
|
||||
| *int* GetBodygroupCount() | Gets the number of models in a bodygroup |
|
||||
| *int* GetNumBodyGroups() | Gets the number of bodygroups |
|
||||
| *void* Dissolve(*string* material, *float* startTime, *bool* npcOnly, *int* dissolveType, *Vector* dissolverOrigin, *int* magnitude) | Dissolve. Use `""` for the default material, `Time()` for the default start time, `false` for `npcOnly` if you don't want it to check if the entity is a NPC first, `0` for the default dissolve type, `Vector(0,0,0)` for the default dissolver origin, and `0` for the default magnitude. |
|
||||
| *void* Ignite(*float* flameLifetime, *bool* NPCOnly, *float* size, *bool* CalledByLevelDesigner)| Ignite. "NPCOnly" only lets this fall through if the entity is a NPC and "CalledByLevelDesigner" determines whether to treat this like the `Ignite` input or just an internal ignition call. |
|
||||
| *void* Scorch(*int* rate, *int* floor) | Makes the entity darker from scorching |
|
||||
|
||||
***
|
||||
|
||||
### CBaseCombatWeapon
|
||||
The base class all equippable weapons derive from.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *int* Clip1()| Get the weapon's current primary ammo. |
|
||||
| *int* Clip2()| Get the weapon's current secondary ammo. |
|
||||
| *void* SetClip1()| Set the weapon's current primary ammo. |
|
||||
| *void* SetClip2()| Set the weapon's current secondary ammo. |
|
||||
| *int* GetMaxClip1()| Get the weapon's maximum primary ammo. |
|
||||
| *int* GetMaxClip2()| Get the weapon's maximum secondary ammo. |
|
||||
| *int* GetDefaultClip1()| Get the weapon's default primary ammo. |
|
||||
| *int* GetDefaultClip2()| Get the weapon's default secondary ammo. |
|
||||
| *bool* HasAnyAmmo()| Check if the weapon currently has ammo or doesn't need ammo. |
|
||||
| *bool* HasPrimaryAmmo()| Check if the weapon currently has ammo or doesn't need primary ammo. |
|
||||
| *bool* HasSecondaryAmmo()| Check if the weapon currently has ammo or doesn't need secondary ammo. |
|
||||
| *bool* UsesPrimaryAmmo()| Check if the weapon uses primary ammo. |
|
||||
| *bool* UsesSecondaryAmmo()| Check if the weapon uses secondary ammo. |
|
||||
| *void* GiveDefaultAmmo()| Fill the weapon back up to default ammo. |
|
||||
| *bool* UsesClipsForAmmo1()| Check if the weapon uses clips for primary ammo. |
|
||||
| *bool* UsesClipsForAmmo2()| Check if the weapon uses clips for secondary ammo. |
|
||||
| *int* GetPrimaryAmmoType()| Get the weapon's primary ammo type. |
|
||||
| *int* GetSecondaryAmmoType()| Get the weapon's secondary ammo type. |
|
||||
| *int* GetSubType()| Get the weapon's subtype. |
|
||||
| *void* SetSubType()| Set the weapon's subtype. |
|
||||
| *int* GetFireRate()| Get the weapon's firing rate. |
|
||||
| *string* GetWorldModel()| Get the weapon's world model. |
|
||||
| *string* GetViewModel()| Get the weapon's view model. |
|
||||
| *float* GetWeight()| Get the weapon's weight. |
|
||||
| *bool* CanBePickedUpByNPCs()| Check if the weapon can be picked up by NPCs. |
|
||||
|
||||
***
|
||||
|
||||
#### CBaseCombatCharacter
|
||||
The base class shared by players and NPCs.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *handle* GetActiveWeapon()| Get the character's active weapon entity. |
|
||||
| *handle* GetWeapon(int *index*)| Get a specific weapon in the character's inventory. |
|
||||
| *handle* FindWeapon(string *classname*)| Find a specific weapon in the character's inventory by its classname. |
|
||||
| *void* GetAllWeapons(*handle* table)| Get the character's weapon inventory. |
|
||||
| *Vector* ShootPosition()| Get the character's shoot position. |
|
||||
| *void* DropAllWeapons(bool *disallowWeaponPickup*)| Make the character drop all of its weapons. |
|
||||
| *void* EquipWeapon(handle *weapon*)| Make the character equip the specified weapon entity. If they don't already own the weapon, they will acquire it instantly. |
|
||||
| *int* GetAmmoCount(int *type*)| Get the ammo count of the specified ammo type. |
|
||||
| *void* SetAmmoCount(int *type*, int *count*)| Set the ammo count of the specified ammo type. |
|
||||
| *int* GetRelationship(handle *target*)| Get a character's relationship to a specific entity. |
|
||||
| *int* GetRelationPriority(handle *target*)| Get a character's relationship priority for a specific entity. |
|
||||
| *void* SetRelationship(handle *target*, int *disposition*, int *priority*)| Set a character's relationship with a specific entity. |
|
||||
| *handle* GetVehicleEntity()| Get the entity for a character's current vehicle if they're in one. |
|
||||
| *bool* InViewCone(Vector *target*)| Check if the specified position is in the character's viewcone. |
|
||||
| *bool* EntInViewCone(handle *target*)| Check if the specified entity is in the character's viewcone. |
|
||||
| *bool* InAimCone(Vector *target*)| Check if the specified position is in the character's aim cone. |
|
||||
| *bool* EntInAimCone(handle *target*)| Check if the specified entity is in the character's aim cone. |
|
||||
| *Vector* BodyAngles()| Get the body's angles. |
|
||||
| *Vector* BodyDirection2D()| Get the body's 2D direction. |
|
||||
| *Vector* BodyDirection3D()| Get the body's 3D direction. |
|
||||
| *Vector* HeadDirection2D()| Get the head's 2D direction. |
|
||||
| *Vector* HeadDirection3D()| Get the head's 3D direction. |
|
||||
| *Vector* EyeDirection2D()| Get the eyes' 2D direction. |
|
||||
| *Vector* EyeDirection3D()| Get the eyes' 3D direction. |
|
||||
|
||||
***
|
||||
|
||||
### CBasePlayer
|
||||
The player entity. This class was already exposed to VScript, but it has new features or changes included with Mapbase.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *CAI_Expresser* GetExpresser()| Get a handle for this player's expresser. |
|
||||
| *string* GetPlayerName()| Gets the player's name. |
|
||||
| *string* GetPlayerUserId()| Gets the player's user ID. |
|
||||
| *string* GetNetworkIDString()| Gets the player's network (i.e. Steam) ID. |
|
||||
| *int* FragCount()| Gets the number of frags (kills) this player has in a multiplayer game. |
|
||||
| *int* DeathCount()| Gets the number of deaths this player has had in a multiplayer game. |
|
||||
| *bool* IsConnected()| Returns true if this player is connected. |
|
||||
| *bool* IsDisconnecting()| Returns true if this player is disconnecting. |
|
||||
| *bool* IsSuitEquipped()| Returns true if this player had the HEV suit equipped. |
|
||||
| *int* GetArmor()| Gets the player's armor. |
|
||||
| *void* SetArmor(*int* value)| Sets the player's armor. |
|
||||
| *bool* FlashlightIsOn()| Returns true if the flashlight is on. |
|
||||
| *void* FlashlightTurnOn()| Turns on the flashlight. |
|
||||
| *void* FlashlightTurnOff()| Turns off the flashlight. |
|
||||
| *void* DisableButtons(*int* buttons)| Disables the specified button mask. |
|
||||
| *void* EnableButtons(*int* buttons)| Enables the specified button mask if it was disabled before. |
|
||||
| *void* ForceButtons(*int* buttons)| Forces the specified button mask. |
|
||||
| *void* UnforceButtons(*int* buttons)| Unforces the specified button mask if it was forced before. |
|
||||
| *int* GetButtons()| Gets the player's active buttons. |
|
||||
| *int* GetButtonPressed()| Gets the player's currently pressed buttons. |
|
||||
| *int* GetButtonReleased()| Gets the player's just-released buttons. |
|
||||
| *int* GetButtonLast()| Gets the player's previously active buttons. |
|
||||
| *int* GetButtonDisabled()| Gets the player's currently unusable buttons. |
|
||||
| *int* GetButtonForced()| Gets the player's currently forced buttons. |
|
||||
|
||||
***
|
||||
|
||||
#### CBasePlayer Hooks
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *void* PlayerRunCommand()| Called when the player runs a movement command. Uses a `command` variable containing a `CUserCmd` instance representing the command. |
|
||||
| *void* ClientCommand()| Called when the player runs an unknown console command. Uses a `command` variable containing the command and an `args` variable containing a list of argument strings based on the arguments passed with the command. |
|
||||
|
||||
***
|
||||
|
||||
### CHL2_Player
|
||||
The HL2 player entity.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *void* RemoveAuxPower(float *value*)| Removes from the player's available aux power. |
|
||||
| *void* AddAuxPower(float *value*)| Adds to the player's available aux power. |
|
||||
| *void* SetAuxPower(float *value*)| Sets the player's available aux power. |
|
||||
| *float* GetAuxPower()| Gets the player's available aux power. |
|
||||
| *float* GetFlashlightBattery()| Gets the energy available in the player's flashlight. If the legacy (aux power-based) flashlight is enabled, this returns the aux power. |
|
||||
|
||||
***
|
||||
|
||||
### CAI_BaseNPC
|
||||
The base class all NPCs derive from.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *handle* GetEnemy()| Get the NPC's current enemy. |
|
||||
| *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. |
|
||||
| *string* GetHintGroup()| Get the name of the NPC's hint group. |
|
||||
| *handle* GetHintNode()| Get the NPC's current AI hint. |
|
||||
| *int* CapabilitiesGet()| Get the capabilities the NPC currently possesses. |
|
||||
| *void* CapabilitiesAdd(int *capabilities*)| Add capabilities to the NPC. |
|
||||
| *void* CapabilitiesRemove(int *capabilities*)| Remove capabilities from the NPC. |
|
||||
| *void* CapabilitiesClear()| Clear capabilities for the NPC. |
|
||||
| *string* GetActivity()| Get the NPC's current activity. |
|
||||
| *int* GetActivityID()| Get the NPC's current activity ID. |
|
||||
| *void* SetActivity(string *activity*)| Set the NPC's current activity. |
|
||||
| *void* SetActivityID(int *activity*)| Set the NPC's current activity ID. |
|
||||
| *void* ResetActivity()| Reset the NPC's current activity. |
|
||||
| *string* GetSchedule()| Get the NPC's current schedule. |
|
||||
| *int* GetScheduleID()| Get the NPC's current schedule ID. |
|
||||
| *void* SetSchedule(string *schedule*)| Set the NPC's current schedule. |
|
||||
| *void* SetScheduleID(int *schedule*)| Set the NPC's current schedule ID. |
|
||||
| *string* GetTask()| Get the NPC's current task. |
|
||||
| *int* GetTaskID()| Get the NPC's current task ID. |
|
||||
| *void* ClearSchedule(string *reason*)| Clear the NPC's current schedule for the specified reason. |
|
||||
| *bool* HasCondition(int *condition*)| Get whether the NPC has a condition. |
|
||||
| *bool* HasConditionID(int *condition*)| Get whether the NPC has a condition ID. |
|
||||
| *void* SetCondition(int *condition*)| Set a condition on the NPC. |
|
||||
| *void* SetConditionID(int *condition*)| Set a condition on the NPC by ID. |
|
||||
| *void* ClearCondition(int *condition*)| Clear a condition on the NPC. |
|
||||
| *void* ClearConditionID(int *condition*)| Clear a condition on the NPC by ID. |
|
||||
| *bool* IsMoving()| Check if the NPC is moving. |
|
||||
| *handle* GetExpresser()| Get a handle for this NPC's expresser. |
|
||||
| *bool* IsCommandable()| Check if the NPC is commandable. |
|
||||
| *bool* IsInPlayerSquad()| Check if the NPC is in the player's squad. |
|
||||
|
||||
***
|
||||
|
||||
#### CAI_BaseNPC Hooks
|
||||
|
||||
| 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. |
|
||||
|
||||
***
|
||||
|
||||
### CAI_BaseActor
|
||||
The base class for NPCs which act in complex choreo scenes.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *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_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_GoalEntity
|
||||
The base class for goal entities used to control NPC behavior.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *bool* IsActive()| Check if the goal entity is active. |
|
||||
| *int* NumActors()| Get the number of actors using this goal entity. |
|
||||
|
||||
***
|
||||
|
||||
### CAI_ActBusyGoal
|
||||
A goal entity which makes NPCs act busy.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *void* ForceBusy(*handle* npc, *handle* hint, *bool* teleportOnly)| Force a NPC to act busy. |
|
||||
| *void* ForceBusyComplex(*handle* npc, *handle* hint, *bool* teleportOnly, *bool* useNearestBusy, *float* maxTime, *int* activity, *handle* seeEntity)| Force a NPC to act busy with additional parameters. |
|
||||
| *void* StopBusy()| Force a NPC to stop busying. |
|
||||
|
||||
***
|
||||
|
||||
### CPropVehicle
|
||||
The base class for four-wheel physics vehicles.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *int* GetVehicleType()| Get a vehicle's type. |
|
||||
| *handle* GetPhysics()| Get a vehicle's physics. |
|
||||
|
||||
***
|
||||
|
||||
### CPropVehicleDriveable
|
||||
The base class for drive-able vehicles. *(this descends from `CPropVehicle`!)*
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *bool* IsOverturned()| Check if the vehicle is overturned. |
|
||||
| *bool* IsVehicleBodyInWater()| Check if the vehicle's body is submerged in water. |
|
||||
| *void* StartEngine()| Start the engine. |
|
||||
| *void* StopEngine()| Stop the engine. |
|
||||
| *bool* IsEngineOn()| Check if the engine is on. |
|
||||
| *handle* GetDriver()| Get a vehicle's driver, which could be either a player or a npc_vehicledriver. |
|
||||
|
||||
***
|
||||
|
||||
### CBaseFilter
|
||||
All entities which could be used as filters.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *bool* PassesFilter(handle *caller*, handle *entity*)| Check if the given caller and entity pass the filter. |
|
||||
| *bool* PassesDamageFilter(handle *caller*, handle *info*)| Check if the given caller and damage info pass the damage filter. |
|
||||
| *bool* PassesFinalDamageFilter(handle *caller*, handle *info*)| Used by filter_damage_redirect to distinguish between standalone filter calls and actually damaging an entity. Returns true if there's no unique behavior. |
|
||||
| *bool* BloodAllowed(handle *caller*, handle *info*)| Check if the given caller and damage info allow for the production of blood. |
|
||||
| *bool* DamageMod(handle *caller*, handle *info*)| Mods the damage info with the given caller. |
|
||||
|
||||
***
|
||||
|
||||
### CSceneListManager
|
||||
Stores choreo scenes and cleans them up when a later scene in the list begins playing.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *CSceneEntity* GetScene(*int* index)| Gets the specified scene index from this manager. |
|
||||
|
||||
***
|
||||
|
||||
### CLogicExternalData
|
||||
An entity which loads keyvalues from an external data file.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *CScriptKeyValues* GetKeyValues()| Gets the external data expressed in CScriptKeyValues. |
|
||||
| *CScriptKeyValues* GetKeyValueBlock()| Gets the current external data block expressed in CScriptKeyValues. |
|
||||
| *void* SetKeyValues(*CScriptKeyValues* keyvalues)| Sets the external data from a CScriptKeyValues object. |
|
||||
| *void* SetKeyValueBlock(*CScriptKeyValues* 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. |
|
||||
|
||||
***
|
||||
|
||||
## Singletons
|
||||
Singletons are single, global instances which contain a bunch of usable functions and data.
|
||||
|
||||
***
|
||||
|
||||
### CLocalize
|
||||
Accesses functions related to localization strings. Can be accessed through a global `Localize` instance.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *string* GetTokenAsUTF8(*string* token)| Gets the current language's token as a UTF-8 string (not Unicode). |
|
||||
|
||||
***
|
||||
|
||||
### CAI_Network
|
||||
The global list of AI nodes. Can be accessed through a global `AINetwork` instance.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *int* NumNodes()| Number of nodes in the level |
|
||||
| *Vector* GetNodePosition(int *nodeID*)| Get position of node using a generic human hull |
|
||||
| *Vector* GetNodePositionWithHull(int *nodeID*, int *hull*)| Get position of node using the specified hull |
|
||||
| *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(int *nodeID*)| Get a node's type |
|
||||
| *handle* GetNodeHint(int *nodeID*)| Get a node's hint |
|
||||
|
||||
***
|
||||
|
||||
### 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. |
|
||||
| *string* GetModName()| Gets the name of the mod. This is the name which shows up on Steam, RPC, etc. |
|
||||
| *bool* IsCoreMapbase()| Indicates whether this is one of the original Mapbase mods or just a separate mod using its code. |
|
||||
|
||||
***
|
||||
|
||||
### CAmmoDef
|
||||
The ammo type definition manager. Can be accessed through a global `AmmoDef` instance.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *string* Name(*int* index)| Gets the name of the specified ammo type index. |
|
||||
| *int* Index(*string* name)| Gets the index of the specified ammo type name. |
|
||||
| *int* PlrDamage(*int* index)| Gets the damage players deal for the specified ammo type. |
|
||||
| *int* NPCDamage(*int* index)| Gets the damage NPCs deal for the specified ammo type. |
|
||||
| *int* MaxCarry(*int* index)| Gets the maximum amount of this ammo type which players should be able to carry. |
|
||||
| *int* DamageType(*int* index)| Gets the type of damage this ammo type deals. |
|
||||
| *int* TracerType(*int* index)| Gets the type of tracer this ammo type uses. |
|
||||
| *float* DamageForce(*int* index)| Gets the amount of force this ammo type deals. |
|
||||
| *int* MinSplashSize(*int* index)| Gets the minimum size of water splashes caused by impacts from this ammo type. |
|
||||
| *int* MaxSplashSize(*int* index)| Gets the maximum size of water splashes caused by impacts from this ammo type. |
|
||||
| *int* Flags(*int* index)| Gets the flags this ammo type uses. |
|
||||
|
||||
***
|
||||
|
||||
## Data Containers
|
||||
These are classes intended to contain and relay specific kinds of data.
|
||||
|
||||
***
|
||||
|
||||
### CScriptKeyValues
|
||||
Wrapper class over KeyValues instance. This class was already exposed to VScript, but it has new features or changes included with Mapbase.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *string* GetName()| Given a KeyValues object, return its name. |
|
||||
| *int* GetInt()| Given a KeyValues object, return its own associated integer value. |
|
||||
| *float* GetFloat()| Given a KeyValues object, return its own associated float value. |
|
||||
| *string* GetString()| Given a KeyValues object, return its own associated string value. |
|
||||
| *bool* GetBool()| Given a KeyValues object, return its own associated bool value. |
|
||||
| *void* SetKeyInt(int *value*)| Given a KeyValues object and a key name, set associated integer value. |
|
||||
| *void* SetKeyFloat(float *value*)| Given a KeyValues object and a key name, set associated float value. |
|
||||
| *void* SetKeyBool(bool *value*)| Given a KeyValues object and a key name, set associated bool value. |
|
||||
| *void* SetKeyString(string *value*)| Given a KeyValues object and a key name, set associated string value. |
|
||||
| *void* SetName(string *name*)| Given a KeyValues object, set its name. |
|
||||
| *void* SetFloat(float *value*)| Given a KeyValues object, set its own associated float value. |
|
||||
| *void* SetBool(bool *value*)| Given a KeyValues object, set its own associated bool value. |
|
||||
| *void* SetString(string *value*)| Given a KeyValues object, set its own associated string value. |
|
||||
|
||||
***
|
||||
|
||||
### CTakeDamageInfo
|
||||
Damage information handler.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *handle* GetInflictor()| Gets the inflictor. |
|
||||
| *void* SetInflictor(handle *target*)| Sets the inflictor. |
|
||||
| *handle* GetWeapon()| Gets the weapon. |
|
||||
| *void* SetWeapon(handle *target*)| Sets the weapon. |
|
||||
| *handle* GetAttacker()| Gets the attacker. |
|
||||
| *void* SetAttacker(handle *target*)| Sets the attacker. |
|
||||
| *float* GetDamage()| Gets the damage. |
|
||||
| *void* SetDamage(handle *damage*)| Sets the damage. |
|
||||
| *float* GetMaxDamage()| Gets the max damage. |
|
||||
| *void* SetMaxDamage(float *damage*)| Sets the max damage. |
|
||||
| *void* ScaleDamage(float *scale*)| Scales the damage. |
|
||||
| *void* AddDamage(float *damage*)| Adds to the damage. |
|
||||
| *void* SubtractDamage(float *damage*)| Removes from the damage. |
|
||||
| *float* GetDamageBonus()| Gets the damage bonus. |
|
||||
| *void* SetDamageBonus(float *damage*)| Sets the damage bonus. |
|
||||
| *float* GetBaseDamage()| Gets the base damage. |
|
||||
| *bool* BaseDamageIsValid()| Checks if the base damage is valid. |
|
||||
| *Vector* GetDamageForce()| Gets the damage force. |
|
||||
| *void* SetDamageForce(Vector *force*)| Sets the damage force. |
|
||||
| *void* ScaleDamageForce(float *scale*)| Scales the damage force. |
|
||||
| *Vector* GetDamagePosition()| Gets the damage position. |
|
||||
| *void* SetDamagePosition(Vector *position*)| Sets the damage position. |
|
||||
| *Vector* GetReportedPosition()| Gets the reported damage position. |
|
||||
| *void* SetReportedPosition(Vector *position*)| Sets the reported damage position. |
|
||||
| *int* GetDamageType()| Gets the damage type. |
|
||||
| *void* SetDamageType(int *type*)| Sets the damage type. |
|
||||
| *void* AddDamageType(int *type*)| Adds to the damage type. |
|
||||
| *int* GetDamageCustom()| Gets the damage custom. |
|
||||
| *void* SetDamageCustom(int *custom*)| Sets the damage custom. |
|
||||
| *int* GetDamageStats()| Gets the damage stats. |
|
||||
| *void* SetDamageStats(int *stats*)| Sets the damage stats. |
|
||||
| *bool* IsForceFriendlyFire()| Gets force friendly fire. |
|
||||
| *void* SetForceFriendlyFire(bool *toggle*)| Sets force friendly fire. |
|
||||
| *int* GetAmmoType()| Gets the ammo type. |
|
||||
| *void* SetAmmoType(int *type*)| Sets the ammo type. |
|
||||
| *string* GetAmmoName()| Gets the ammo type name. |
|
||||
| *int* GetPlayerPenetrationCount()| Gets the player penetration count. |
|
||||
| *void* SetPlayerPenetrationCount(int *count*)| Sets the player penetration count. |
|
||||
| *bool* GetDamagedOtherPlayers()| Gets whether other players have been damaged. |
|
||||
| *void* SetDamagedOtherPlayers(bool *toggle*)| Sets whether other players have been damaged. |
|
||||
|
||||
***
|
||||
|
||||
#### CTakeDamageInfo Global Functions
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *CTakeDamageInfo* CreateDamageInfo(handle *inflictor*, handle *attacker*, Vector *force*, Vector *damagePos*, float *damage*, int *type*)| Creates damage info. |
|
||||
| *void* DestroyDamageInfo(CTakeDamageInfo *info*)| Destroys damage info. |
|
||||
|
||||
***
|
||||
|
||||
### CGameTrace
|
||||
Handle for accessing trace_t info.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *bool* DidHitWorld()| Returns whether the trace hit the world entity or not. |
|
||||
| *bool* DidHitNonWorldEntity()| Returns whether the trace hit something other than the world entity. |
|
||||
| *int* GetEntityIndex()| Returns the index of whatever entity this trace hit. |
|
||||
| *bool* DidHit()| Returns whether the trace hit anything. |
|
||||
| *float* FractionLeftSolid()| If this trace started within a solid, this is the point in the trace's fraction at which it left that solid. |
|
||||
| *int* HitGroup()| Returns the specific hit group this trace hit if it hit an entity. |
|
||||
| *int* PhysicsBone()| Returns the physics bone this trace hit if it hit an entity. |
|
||||
| *handle* Entity()| Returns the entity this trace has hit. |
|
||||
| *int* HitBox()| Returns the hitbox of the entity this trace has hit. If it hit the world entity, this returns the static prop index. |
|
||||
| *bool* IsDispSurface()| Returns whether this trace hit a displacement. |
|
||||
| *bool* IsDispSurfaceWalkable()| Returns whether DISPSURF_FLAG_WALKABLE is ticked on the displacement this trace hit. |
|
||||
| *bool* IsDispSurfaceBuildable()| Returns whether DISPSURF_FLAG_BUILDABLE is ticked on the displacement this trace hit. |
|
||||
| *bool* IsDispSurfaceProp1()| Returns whether DISPSURF_FLAG_SURFPROP1 is ticked on the displacement this trace hit. |
|
||||
| *bool* IsDispSurfaceProp2()| Returns whether DISPSURF_FLAG_SURFPROP2 is ticked on the displacement this trace hit. |
|
||||
| *Vector* StartPos()| Gets the trace's start position. |
|
||||
| *Vector* EndPos()| Gets the trace's end position. |
|
||||
| *float* Fraction()| Gets the fraction of the trace completed. For example, if the trace stopped exactly halfway to the end position, this would be 0.5. |
|
||||
| *int* Contents()| Gets the contents of the surface the trace has hit. |
|
||||
| *int* DispFlags()| Gets the displacement flags of the surface the trace has hit. |
|
||||
| *bool* AllSolid()| Returns whether the trace is completely within a solid. |
|
||||
| *bool* StartSolid()| Returns whether the trace started within a solid. |
|
||||
| *void* Destroy()| Deletes this instance. Important for preventing memory leaks. |
|
||||
|
||||
***
|
||||
|
||||
### FireBulletsInfo_t
|
||||
Handle for accessing FireBulletsInfo_t info.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *int* GetShots()| Gets the number of shots which should be fired. |
|
||||
| *void* SetShots(*int* value)| Gets the number of shots which should be fired. |
|
||||
| *Vector* GetSource()| Gets the source of the bullets. |
|
||||
| *void* SetSource(*Vector* value)| Sets the source of the bullets. |
|
||||
| *Vector* GetDirShooting()| Gets the direction of the bullets. |
|
||||
| *void* SetDirShooting(*Vector* value)| Sets the direction of the bullets. |
|
||||
| *Vector* GetSpread()| Gets the spread of the bullets. |
|
||||
| *void* SetSpread(*Vector* value)| Sets the spread of the bullets. |
|
||||
| *float* GetDistance()| Gets the distance the bullets should travel. |
|
||||
| *void* SetDistance(*float* value)| Sets the distance the bullets should travel. |
|
||||
| *int* GetAmmoType()| Gets the ammo type the bullets should use. |
|
||||
| *void* SetAmmoType(*int* value)| Sets the ammo type the bullets should use. |
|
||||
| *int* GetTracerFreq()| Gets the tracer frequency. |
|
||||
| *void* SetTracerFreq(*int* value)| Sets the tracer frequency. |
|
||||
| *float* GetDamage()| Gets the damage the bullets should deal. 0 = use ammo type. |
|
||||
| *void* SetDamage(*float* value)| Sets the damage the bullets should deal. 0 = use ammo type. |
|
||||
| *int* GetPlayerDamage()| Gets the damage the bullets should deal when hitting the player. 0 = use regular damage |
|
||||
| *void* SetPlayerDamage(*int* value)| Sets the damage the bullets should deal when hitting the player. 0 = use regular damage |
|
||||
| *int* GetFlags()| Gets the flags the bullets should use. |
|
||||
| *void* SetFlags(*int* value)| Sets the flags the bullets should use. |
|
||||
| *float* GetDamageForceScale()| Gets the scale of the damage force applied by the bullets |
|
||||
| *void* SetDamageForceScale(*float* value)| Sets the scale of the damage force applied by the bullets. |
|
||||
| *CBaseEntity* GetAttacker()| Gets the entity considered to be the one who fired the bullets. |
|
||||
| *void* SetAttacker(*CBaseEntity* value)| Sets the entity considered to be the one who fired the bullets. |
|
||||
| *CBaseEntity* GetAdditionalIgnoreEnt()| Gets the optional entity which the bullets should ignore. |
|
||||
| *void* SetAdditionalIgnoreEnt(*CBaseEntity* value)| Sets the optional entity which the bullets should ignore. |
|
||||
| *bool* GetPrimaryAttack()| Gets whether the bullets came from a primary attack. |
|
||||
| *void* SetPrimaryAttack(*bool* value)| Sets whether the bullets came from a primary attack. |
|
||||
|
||||
***
|
||||
|
||||
#### FireBulletsInfo_t Global Functions
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *FireBulletsInfo_t* CreateFireBulletsInfo(*int* shots, *Vector* source, *Vector* direction, *Vector* spread, *float* damage, *CBaseEntity* attacker)| Creates FireBullets info. |
|
||||
| *void* DestroyFireBulletsInfo(*FireBulletsInfo_t* info)| Destroys FireBullets info. |
|
||||
|
||||
***
|
||||
|
||||
### AI_EnemyInfo_t
|
||||
Accessor for information about an enemy. Typically accessed through `FindEnemyMemory()`.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *handle* Enemy()| Get the enemy. |
|
||||
| *void* SetEnemy(handle *target*)| Set the enemy. |
|
||||
| *Vector* LastKnownLocation()| Get the enemy's last known location. |
|
||||
| *void* SetLastKnownLocation(Vector *target*)| Set the enemy's last known location. |
|
||||
| *Vector* LastSeenLocation()| Get the enemy's last seen location. |
|
||||
| *void* SetLastSeenLocation(Vector *target*)| Set the enemy's last seen location. |
|
||||
| *float* TimeLastSeen()| Get the last time the enemy was seen. |
|
||||
| *void* SetTimeLastSeen(float *time*)| Set the last time the enemy was seen. |
|
||||
| *float* TimeFirstSeen()| Get the first time the enemy was seen. |
|
||||
| *void* SetTimeFirstSeen(float *time*)| Set the first time the enemy was seen. |
|
||||
| *float* TimeLastReacquired()| Get the last time the enemy was reaquired. |
|
||||
| *void* SetTimeLastReacquired(float *time*)| Set the last time the enemy was reaquired. |
|
||||
| *float* TimeLastReceivedDamageFrom()| Get the last time damage was received from this enemy. |
|
||||
| *void* SetTimeLastReceivedDamageFrom(float *time*)| Set the last time damage was received from this enemy. |
|
||||
| *float* TimeAtFirstHand()| Get the time at which the enemy was seen firsthand. |
|
||||
| *void* SetTimeAtFirstHand(float *time*)| Set the time at which the enemy was seen firsthand. |
|
||||
| *bool* DangerMemory()| Get the memory of danger position w/o enemy pointer. |
|
||||
| *void* SetDangerMemory(bool *value*)| Set the memory of danger position w/o enemy pointer. |
|
||||
| *bool* EludedMe()| Get whether the enemy is not at the last known location. |
|
||||
| *void* SetEludedMe(bool *value*)| Set whether the enemy is not at the last known location. |
|
||||
| *bool* Unforgettable()| Get whether the enemy is unforgettable. |
|
||||
| *void* SetUnforgettable(bool *value*)| Set whether the enemy is unforgettable. |
|
||||
| *bool* MobbedMe()| Get whether the enemy was part of a mob at some point. |
|
||||
| *void* SetMobbedMe(bool *value*)| Set whether the enemy was part of a mob at some point. |
|
||||
|
||||
***
|
||||
|
||||
### 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.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *void* SetThrottle(*float* value)| Sets the throttle. |
|
||||
| *void* SetMaxThrottle(*float* value)| Sets the max throttle. |
|
||||
| *void* SetMaxReverseThrottle(*float* value)| Sets the max reverse throttle. |
|
||||
| *void* SetSteering(*float* value)| Sets the steering. |
|
||||
| *void* SetSteeringDegrees(*float* value)| Sets the degrees of steering. |
|
||||
| *void* SetAction(*float* value)| Sets the action. |
|
||||
| *void* SetHandbrake(*bool* value)| Sets the handbrake. |
|
||||
| *void* SetBoost(*float* value)| Sets the boost. |
|
||||
| *void* SetHasBrakePedal(*bool* value)| Sets whether a handbrake pedal exists. |
|
||||
| *void* SetDisableEngine(*bool* value)| Sets whether the engine is disabled. |
|
||||
| *bool* IsEngineDisabled()| Checks whether the engine is disabled. |
|
||||
| *void* EnableMotion()| Enables vehicle motion. |
|
||||
| *void* DisableMotion()| Disables vehicle motion. |
|
||||
| *float* GetSpeed()| Gets the speed. |
|
||||
| *float* GetMaxSpeed()| Gets the max speed. |
|
||||
| *float* GetRPM()| Gets the RPM. |
|
||||
| *float* GetThrottle()| Gets the throttle. |
|
||||
| *bool* HasBoost()| Checks if the vehicle has the ability to boost. |
|
||||
| *float* BoostTimeLeft()| Gets how much time is left in any current boost. |
|
||||
| *bool* IsBoosting()| Checks if the vehicle is boosting. |
|
||||
| *float* GetHLSpeed()| Gets HL speed. |
|
||||
| *float* GetSteering()| Gets the steeering. |
|
||||
| *float* GetSteeringDegrees()| Gets the degrees of steeering. |
|
||||
|
||||
***
|
||||
|
||||
### CUserCmd
|
||||
Handle for accessing CUserCmd info. Typically used in the `PlayerRunCommand` hook.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *int* GetCommandNumber()| For matching server and client commands for debugging. |
|
||||
| *int* GetTickCount()| The tick the client created this command. |
|
||||
| *Vector* GetViewAngles()| Player instantaneous view angles. |
|
||||
| *void* SetViewAngles(*Vector* angles)| Player instantaneous view angles. |
|
||||
| *float* GetForwardMove()| Forward velocity. |
|
||||
| *void* SetForwardMove(*float* value)| Sets forward velocity. |
|
||||
| *float* GetSideMove()| Side velocity. |
|
||||
| *void* SetSideMove(*float* value)| Sets side velocity. |
|
||||
| *float* GetUpMove()| Up velocity. |
|
||||
| *void* SetUpMove(*float* value)| Sets up velocity. |
|
||||
| *int* GetButtons()| Attack button states. |
|
||||
| *void* SetButtons(*int* value)| Sets attack button states. |
|
||||
| *int* GetImpulse()| Impulse command issued. |
|
||||
| *void* SetImpulse(*int* value)| Sets impulse command issued. |
|
||||
| *int* GetWeaponSelect()| Current weapon id. |
|
||||
| *void* SetWeaponSelect(*int* value)| Sets current weapon id. |
|
||||
| *int* GetWeaponSubtype()| Current weapon subtype id. |
|
||||
| *void* SetWeaponSubtype(*int* value)| Sets current weapon subtype id. |
|
||||
| *int* GetRandomSeed()| For shared random functions. |
|
||||
| *int* GetMouseX()| Mouse accum in x from create move. |
|
||||
| *void* SetMouseX(*int* move)| Sets mouse accum in x from create move. |
|
||||
| *int* GetMouseY()| Mouse accum in y from create move. |
|
||||
| *void* SetMouseY(*int* move)| Sets mouse accum in y from create move. |
|
||||
|
||||
***
|
||||
|
||||
## Data Types
|
||||
These are specific types of data.
|
||||
|
||||
***
|
||||
|
||||
### matrix3x4_t
|
||||
A 3x4 matrix transform.
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *string* Init(*Vector* xAxis, *Vector* yAxis, *Vector* zAxis, *Vector* vecOrigin)| Creates a matrix where the X axis = forward, the Y axis = left, and the Z axis = up. |
|
||||
|
||||
***
|
||||
|
||||
#### matrix3x4_t Global Functions
|
||||
|
||||
| Signature | Description |
|
||||
|:------------- | :-----|
|
||||
| *void* ConcatTransforms(*matrix3x4_t* matrix1, *matrix3x4_t* matrix2, *matrix3x4_t* out)| Concatenates two transformation matrices into another matrix. |
|
||||
| *void* MatrixCopy(*matrix3x4_t* in, *matrix3x4_t* out)| Copies a matrix to another matrix. |
|
||||
| *void* MatrixInvert(*matrix3x4_t* in, *matrix3x4_t* out)| Inverts a matrix and copies the result to another matrix. |
|
||||
| *void* MatricesAreEqual(*matrix3x4_t* in, *matrix3x4_t* out)| Checks if two matrices are equal. |
|
||||
| *Vector* MatrixGetColumn(*matrix3x4_t* matrix, *int* column)| Gets the column of a matrix. |
|
||||
| *void* MatrixSetColumn(*Vector* in, *int* column, *matrix3x4_t* matrix)| Sets the column of a matrix. |
|
||||
| *void* MatrixAngles(*matrix3x4_t* matrix, *Vector* angles, *Vector* position)| Gets the angles and position of a matrix. |
|
||||
| *void* AngleMatrix(*Vector* angles, *Vector* position, *matrix3x4_t* matrix)| Sets the angles and position of a matrix. |
|
||||
| *void* AngleIMatrix(*Vector* angles, *Vector* position, *matrix3x4_t* matrix)| Sets the inverted angles and position of a matrix. |
|
||||
| *void* SetIdentityMatrix(*matrix3x4_t* matrix)| Turns a matrix into an identity matrix. |
|
||||
| *void* SetScaleMatrix(*float* x, *float* y, *float* z, *matrix3x4_t* matrix)| Scales a matrix. |
|
Loading…
x
Reference in New Issue
Block a user