Difference between revisions of "Gametype Scripting"

From Warfork
Jump to: navigation, search
(Add entity type enum)
(Start filling out entity properties)
Line 93: Line 93:
 
! Enum Value !! Description
 
! Enum Value !! Description
 
|-
 
|-
| CVAR_ARCHIVE || Save to vars.rc
+
| CVAR_ARCHIVE || Saved to config
 
|-
 
|-
 
| CVAR_USERINFO || Added to userinfo when changed
 
| CVAR_USERINFO || Added to userinfo when changed
Line 115: Line 115:
 
=== Entity ===
 
=== Entity ===
 
Not constructable. New instances can be spawned, see @G_SpawnEntity.
 
Not constructable. New instances can be spawned, see @G_SpawnEntity.
 +
{| class="wikitable"
 +
|-
 +
! Property !! Description !! R/W
 +
|-
 +
| Client @client || The associated client (nullable) || RW?
 +
|-
 +
| Item @item || ?????? (for bonus items) || RW?
 +
|-
 +
| Entity @groundEntity || ?????? || RW?
 +
|-
 +
| Entity @owner || ?????? || RW?
 +
|-
 +
| Entity @enemy || ?????? || RW?
 +
|-
 +
| Entity @activator || ?????? || RW?
 +
|-
 +
| int type || Entity type enum (see below) || RW?
 +
|-
 +
| int modelindex || ?????? || RW?
 +
|-
 +
| int modelindex2 || ?????? || RW?
 +
|-
 +
| int frame || ?????? || RW?
 +
|-
 +
| int ownerNum || ?????? || RW?
 +
|-
 +
| int counterNum || ?????? || RW?
 +
|-
 +
| int skinNum || ?????? || RW?
 +
|-
 +
| int colorRGBA || ?????? || RW?
 +
|-
 +
| int weapon || ?????? || RW?
 +
|-
 +
| bool teleported || ?????? || RW?
 +
|-
 +
| uint effects || ?????? || RW?
 +
|-
 +
| int sound || ?????? || RW?
 +
|-
 +
| int team || ?????? || RW?
 +
|-
 +
| int light || ?????? || RW?
 +
|-
 +
| bool inuse || ?????? || R
 +
|-
 +
| uint svflags || ?????? || RW?
 +
|-
 +
| int solid || ?????? || RW?
 +
|-
 +
| int clipMask || ?????? || RW?
 +
|-
 +
| int spawnFlags || ?????? || RW?
 +
|-
 +
| int style || ?????? || RW?
 +
|-
 +
| int moveType || ?????? || RW?
 +
|-
 +
| uint nextThink || ?????? || RW?
 +
|-
 +
| float health || ?????? || RW?
 +
|-
 +
| int maxHealth || ?????? || RW?
 +
|-
 +
| int viewHeight || ?????? || RW?
 +
|-
 +
| int takeDamage || ?????? || RW?
 +
|-
 +
| int damage || ?????? || RW?
 +
|-
 +
| int projectileMaxDamage || ?????? || RW?
 +
|-
 +
| int projectileMinDamage || ?????? || RW?
 +
|-
 +
| int projectileMaxKnockback || ?????? || RW?
 +
|-
 +
| int projectileMinKnockback || ?????? || RW?
 +
|-
 +
| float projectileSplashRadius || ?????? || RW?
 +
|-
 +
| int count || ?????? || RW?
 +
|-
 +
| float wait || ?????? || RW?
 +
|-
 +
| float delay || ?????? || RW?
 +
|-
 +
| float random || ?????? || RW?
 +
|-
 +
| int waterLevel || ?????? || RW?
 +
|-
 +
| float attenuation || ?????? || RW?
 +
|-
 +
| int mass || ?????? || RW?
 +
|-
 +
| uint timeStamp || ?????? || RW?
 +
|-
 +
| entThink @think || Think callback || RW?
 +
|-
 +
| entTouch @touch || Touch callback || RW?
 +
|-
 +
| entUse @use || Use callback || RW?
 +
|-
 +
| entPain @pain || Pain callback || RW?
 +
|-
 +
| entDie @die || Die callback || RW?
 +
|-
 +
| entStop @stop || Stop callback || RW?
 +
|}
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 125: Line 233:
 
| ET_CORPSE || Corpse entity
 
| ET_CORPSE || Corpse entity
 
|-
 
|-
| ET_BEAM || Beam entity??? Likely deprecated
+
| ET_BEAM || Map beams
 
|-
 
|-
 
| ET_PORTALSURFACE || Portal surface, used for misc_portal_surface
 
| ET_PORTALSURFACE || Portal surface, used for misc_portal_surface
Line 135: Line 243:
 
| ET_BLASTER || Gunblade projectile?
 
| ET_BLASTER || Gunblade projectile?
 
|-
 
|-
| ET_ELECTRO_WEAK || EB weak mode? currently unclear
+
| ET_ELECTRO_WEAK || EB projectile
 
|-
 
|-
 
| ET_ROCKET || Rocket projectile
 
| ET_ROCKET || Rocket projectile
Line 149: Line 257:
 
| ET_LASERBEAM || Continuous laser beam(???)
 
| ET_LASERBEAM || Continuous laser beam(???)
 
|-
 
|-
| ET_CURVELASERBEAM || Curved laser beam(???)
+
| ET_CURVELASERBEAM || Weak laser beam, unused
 
|-
 
|-
 
| ET_FLAG_BASE || ??? used for the flag base in CTF
 
| ET_FLAG_BASE || ??? used for the flag base in CTF
 
|-
 
|-
| ET_MINIMAP_ICON || ???
+
| ET_MINIMAP_ICON || HUD Minimap
 
|-
 
|-
| ET_DECAL || ???
+
| ET_DECAL || Decal sprites
 
|-
 
|-
 
| ET_ITEM_TIMER || ??? (for specs only)
 
| ET_ITEM_TIMER || ??? (for specs only)
 
|-
 
|-
| ET_PARTICLES || ???
+
| ET_PARTICLES || misc_particles
 
|-
 
|-
 
| ET_SPAWN_INDICATOR || Shows spawn locations
 
| ET_SPAWN_INDICATOR || Shows spawn locations
 
|-
 
|-
| ET_VIDEO_SPEAKER || ???
+
| ET_VIDEO_SPEAKER || misc_video_speaker
 
|-
 
|-
 
| ET_RADAR || ET_SPRITE minus the depth test
 
| ET_RADAR || ET_SPRITE minus the depth test
 
|-
 
|-
| ET_EVENT [96] || ???
+
| ET_EVENT [96] || Used for effects, last 1 frame
 
|-
 
|-
| ET_SOUNDEVENT [97] || ???
+
| ET_SOUNDEVENT [97] || Used for effects, last 1 frame
 
|}
 
|}

Revision as of 22:54, 29 March 2020

Page in progress.

Types

Vec3

Constructor Description
Vec3() Initializes x,y,z to zero.
Vec3(float v) Initializes x,y,z to v.
Vec3(float x, float y, float z) Initializes x,y,z with the given values for each.
Vec3(Vec3 &in) Copy constructor. Initializes x,y,z to the values on the supplied Vec3.
Property Description R/W
float x The x component of the vector. RW
float y The y component of the vector. RW
float z The z component of the vector. RW
Method Description
void set(float x, float y, float z) Sets the x,y,z components on the vector to the supplied values.
float length() Returns the magnitude of the vector.
float normalize() Normalizes the vector and returns the magnitude pre-normalization.
float distance(Vec3 &other) Returns the distance between the tips of this vector and the supplied vector.
void angleVectors(Vec3 &f, Vec3 &r, Vec3 &u) Sets the provided vectors as rotations about the forward, right, and up axes (?)
Vec3 toAngles() Returns a vector representing the current vector as a rotation.
Vec3 perpendicular() Returns the vector perpendicular to this vector.
void makeNormalVectors(Vec3 &r, Vec3 &u) Returns the normal and binormal vector of the current vector (assumed to be the tangent/forward).

The mathematical operators are overloaded for vectors and perform the equivalent vector operation.

Cvar

Constructor Description
Cvar(String &name, String &value, uint flags) Creates the cvar "name" if it does not exist, with the given value and flags. If the cvar exists, the value is unused, and the supplied flags are set if they are not already set on the cvar.
Cvar(Cvar &other) Copy constructor.
Property Description R/W
bool modified Example RW
bool boolean The value of the cvar as a bool R
int integer The value of the cvar as an int R
float value The value of the cvar as a float R
String@ name The name of cvar R
String@ string The value of the cvar as a string R
String@ defaultString The default value of the cvar R
String@ latchedString If the cvar has CVAR_LATCH or a variant, the value after a map/video restart R
Method Description
void reset() Resets the value of the cvar to its default value.
void set(String &value) Sets the value of the cvar to the supplied string.
void set(float value) Sets the value of the cvar to the supplied float.
void set(int value) Sets the value of the cvar to the supplied integer. Note: cast to float internally
void set(double value) Sets the value of the cvar to the supplied double. Note: cast to float internally
Enum Value Description
CVAR_ARCHIVE Saved to config
CVAR_USERINFO Added to userinfo when changed
CVAR_SERVERINFO Added to serverinfo when changed
CVAR_NOSET Only settable from command line
CVAR_LATCH Save changes until a map restart
CVAR_LATCH_VIDEO Save changes until a video restart
CVAR_LATCH_AUDIO Save changes until a sound restart
CVAR_CHEAT Reset to default unless cheats are enabled
CVAR_READONLY not user-changeable
[Not present in angelscript] CVAR_DEVELOPER only visible/changeable in dev builds

Entity

Not constructable. New instances can be spawned, see @G_SpawnEntity.

Property Description R/W
Client @client The associated client (nullable) RW?
Item @item ?????? (for bonus items) RW?
Entity @groundEntity ?????? RW?
Entity @owner ?????? RW?
Entity @enemy ?????? RW?
Entity @activator ?????? RW?
int type Entity type enum (see below) RW?
int modelindex ?????? RW?
int modelindex2 ?????? RW?
int frame ?????? RW?
int ownerNum ?????? RW?
int counterNum ?????? RW?
int skinNum ?????? RW?
int colorRGBA ?????? RW?
int weapon ?????? RW?
bool teleported ?????? RW?
uint effects ?????? RW?
int sound ?????? RW?
int team ?????? RW?
int light ?????? RW?
bool inuse ?????? R
uint svflags ?????? RW?
int solid ?????? RW?
int clipMask ?????? RW?
int spawnFlags ?????? RW?
int style ?????? RW?
int moveType ?????? RW?
uint nextThink ?????? RW?
float health ?????? RW?
int maxHealth ?????? RW?
int viewHeight ?????? RW?
int takeDamage ?????? RW?
int damage ?????? RW?
int projectileMaxDamage ?????? RW?
int projectileMinDamage ?????? RW?
int projectileMaxKnockback ?????? RW?
int projectileMinKnockback ?????? RW?
float projectileSplashRadius ?????? RW?
int count ?????? RW?
float wait ?????? RW?
float delay ?????? RW?
float random ?????? RW?
int waterLevel ?????? RW?
float attenuation ?????? RW?
int mass ?????? RW?
uint timeStamp ?????? RW?
entThink @think Think callback RW?
entTouch @touch Touch callback RW?
entUse @use Use callback RW?
entPain @pain Pain callback RW?
entDie @die Die callback RW?
entStop @stop Stop callback RW?
Entity types enum Description
ET_GENERIC Generic entity?
ET_PLAYER Player entity
ET_CORPSE Corpse entity
ET_BEAM Map beams
ET_PORTALSURFACE Portal surface, used for misc_portal_surface
ET_PUSH_TRIGGER Push trigger entity, another weird map thing
ET_GIB Gib entity that leaves a trail
ET_BLASTER Gunblade projectile?
ET_ELECTRO_WEAK EB projectile
ET_ROCKET Rocket projectile
ET_GRENADE Grenade projectile
ET_PLASMA Plasma gun projectile
ET_SPRITE 2d Sprite entity
ET_ITEM Item entity, like those created by SpawnItem
ET_LASERBEAM Continuous laser beam(???)
ET_CURVELASERBEAM Weak laser beam, unused
ET_FLAG_BASE ??? used for the flag base in CTF
ET_MINIMAP_ICON HUD Minimap
ET_DECAL Decal sprites
ET_ITEM_TIMER ??? (for specs only)
ET_PARTICLES misc_particles
ET_SPAWN_INDICATOR Shows spawn locations
ET_VIDEO_SPEAKER misc_video_speaker
ET_RADAR ET_SPRITE minus the depth test
ET_EVENT [96] Used for effects, last 1 frame
ET_SOUNDEVENT [97] Used for effects, last 1 frame