Enumerations
Important!
In your DriftScript code, DO NOT assume the numeric values of the enums will remain the same.
Always use the enums and not hardcoded numeric values.
Also DO NOT assumeInvalidwill always be equal to0or-1.
BoundsCheck
enum BoundsCheck
{
Invalid,
Center, // Unit's center position is in location
Touching, // Unit is fully inside or touching location
Inside // Unit fully inside a location
}
- The
BoundsCheckenum is used in unit search queries within locations. - Primarily used in gx_get_units-gx_get_units_count
SpecialPlayer
- The above are the
PlayerIDsfor the special playersNeutral,Hostile, andRescue - The players
Neutral,Hostile, andRescueare automatically assigned to theNeutralForce - These 3 special players exist in every game and game-mode.
Note:Normal PlayerIDs are positive, with values:[1-16]
SpecialForce
- The Force
Neutral(id = -1) is special and exists in every game. - The players
Neutral,Hostile, andRescueare automatically assigned to theNeutralForce Note:Normal ForceIDs are positive integers
VictoryStatus
- A
VictoryStatus::Pendingindicates the player is not yet assigned Victory/Defeat, usually meaning the player is still playing. DraworTieis not yet supported.
ShapeType
TerrainType
// Primary Terrain Types
enum TerrainType
{
Invalid,
Normal, // See SecondaryTerrainTypeNormal
// for valid secondary types
Water, // valid secondary types are 0 and 2
Lava, // valid secondary types are 0 and 2
Diamond, // valid secondary types is just 0
Glow, // valid secondary types are [0 - 31]
PlayerColor, // valid secondary types are player_id, i.e. [1-16]
Unpassable, // !! Not a dynamic terrain type!
// Cannot dynamically change or be set to!
Space, // valid secondary type is just 0
CliffClosed, // !! Not a dynamic terrain type!
// Cannot dynamically change or be set to!
CliffBorder // !! Not a dynamic terrain type!
// Cannot dynamically change or be set to!
}
- Primarily used in gx_set_terrain_type and gx_get_terrain_type
SecondaryTerrainTypeNormal
enum SecondaryTerrainTypeNormal
{
Invalid,
Normal, // Units are normal on this type (no effects)
Speed, // Units move faster on this type
AttackRate, // Units have faster attack rate on this type
Heal, // Units heal faster on this type
Forbidden, // Units insta-die on this type
Sniper, // Units have increased range on this type
MeleeOnly, // Units have decreased range on this type
Pacifist // Units are unable to attack on this type
}
- Primarily used in gx_set_terrain_type and gx_get_terrain_type
- Should only be used in conjunction with
TerrainType.Normal
MapProp
enum MapProp
{
// Access Type
Invalid,
ThemeColor, // Read-Write (Vec4<float>)
GlowColor // Read-Write (Vec4<float>)
}
ForceProp
enum ForceProp
{
// Access Type
Invalid,
Score, // Read-Write (int)
Name // Read-Write (string)
VictoryStatus // Read-Write (VictoryStatus)
}
- Primarily used in property-getterssetters
PlayerProp
enum PlayerProp
{
// Access Type
Invalid,
Fungus, // Read-Write (float)
Gemstone, // Read-Write (float)
Supply, // Read (int)
MaxSupply, // Read (int)
NumKills, // Read (int)
NumDeaths, // Read (int)
PlayerName, // Read-Write (string)
// Is Write-Enabled only for computer players
FullMapVision, // Read-Write (bool)
// When set to true, player
// is given vision of entire map
NumUnitsProduced, // Read (int)
TagID, // Read (int)
ChoseRandom, // Read (bool)
Race, // Read (int)
WeaponsLevel, // Read-Write (int)
ArmorLevel, // Read-Write (int)
SpeedLevel, // Read-Write (int)
// (not implemented atm)
StartLocationPosition, // Read (Vec2)
Score, // Read-Write (int)
IsNormalPlayer, // Read (bool)
IsHumanPlayer, // Read (bool)
IsComputerPlayer, // Read (bool)
IsHostilePlayer, // Read (bool)
IsNeutralPlayer, // Read (bool)
IsRescueablePlayer, // Read (bool)
IsInGame, // Read (bool)
VictoryStatus, // Read-Write (VictoryStatus),
AlliedVictory, // Read-Write (bool)
Color, // Read-Write (Vec3)
ForceID // Read (int)
PlayerNameColorDesc // Read-Write (int) (i.e. ColorDesc)
// Is Write-Enabled only for computer players
ColoredPlayerName // Read (string)
// Equivalent to:
// gx_get_player_prop(PlayerProp.PlayerNameColorDesc, playerID)
// + PlayerName
ColoredPlayerName2 // Read (string)
// Equivalent to:
// gx_str_encode_color_id(ColorID.PushColor)
// + gx_get_player_prop(PlayerProp.ColoredPlayerName, playerID)
// + PlayerName
// + gx_str_encode_color_id(ColorID.PopColor)
}
- Primarily used in property-getterssetters
UnitProp
enum UnitProp
{
// Access Type
Invalid,
MaxHealth, // Read (int)
Health, // Read-Write (float)
MaxSpeed, // Read (float)
Size, // Read (float)
UnitType, // Read (string)
IsOnFire, // Read (bool)
GetParentJeep, // Read (int)
GetParentDropship, // Read (int)
GetParentStarShip, // Read (int)
GetParentSpinnerShip, // Read (int)
GetParentBunker, // Read (int)
GunShipState, // Read-Write (GunShipState)
Level, // Read-Write (int)
Tag, // Read-Write (string)
PlayerID, // Read-Write (int)
ForceGhostMode, // Read-Write (bool)
// Ghost mode allows units to walk through
// other units (similar to workers harvesting
// resources)
FriendlyName, // Read-Write (string)
// Allows you to override unit friendly name
// on a per-unit basis.
ForceInvulnerable, // Read-Write (bool)
LookAtDirection, // Read-Write (Float2)
DriftMode, // Read-Write (bool)
IsCritter, // Read (bool)
CritterFlag, // Read-Write (bool)
IsSpeechBubbleActive, // Read (bool)
Position // Read-Write (Float2)
}
- Primarily used in property-getterssetters
- Setting
Healthto<= 0will cause unit to be set tokilledstate.
DecalProp
enum DecalProp
{
// Access Type
Invalid,
Position, // Read/Write Vec2<float>
Rotation, // Read/Write float
Size, // Read/Write Vec2<float>
Tag, // Read/Write string
InterpolateTransforms, // Read/Write bool
RestrictToSpace // Read/Write bool
}
LocationProp
enum LocationProp
{
// Access Type
Invalid,
TopLeft, // Read (Vec2)
TopRight, // Read (Vec2)
BottomLeft, // Read (Vec2)
BottomRight, // Read (Vec2)
Center, // Read (Vec2)
Size // Read (Vec2)
AABR, // Read (AABR)
}
- Primarily used in property-getterssetters
GunShipState
enum GunShipState
{
Invalid,
Normal,
StarShot,
BigGunLevel1,
BigGunLevel2,
ChainGunLevel1,
ChainGunLevel2
}
- Primarily used for setting/getting unit property
GunShipStatein property-getterssetters
Example:
- the above would give a gunship two chainguns
ColorType
enum ColorType { Invalid, Normal, Rainbow, Water, Lava }
Unicode
enum Unicode
{
Special_PushColor,
Special_PopColor,
Special_PushInvisible,
Special_PopInvisible,
Special_DefaultColor,
Color_Effect_Water,
Color_Effect_Lava,
Color_Effect_Rainbow,
Color_Black, # 0x000000
Color_White, # 0xFFFFFF
Color_Red, # 0xFF0000
Color_Orange, # 0xFF7F00
Color_Yellow, # 0xFFFF00
Color_Chartreuse, # 0x7FFF00
Color_Green, # 0x00FF00
Color_SpringGreen, # 0x00FF7F
Color_Aqua, # 0x00FFFF
Color_BabyBlue, # 0x007FFF
Color_Blue, # 0x0000FF
Color_Purple, # 0x7F00FF
Color_Pink # 0xFF00FF
}
- Useful unicode characters available in the game.
Special_PushColorandSpecial_PopColorare sort of special, and is used for text.Special_PushColorpushes the current color onto a color stackSpecial_PopColorpops a color off, and sets current text color to it- Allows you to save the current arbitrary color, and then re-use it later.
Special_PushInvisibleandSpecial_PopInvisibleare also special- All characters after
Special_PushInvisiblewill be invisible unless highlighted until a correspondingSpecial_PopInvisibleis reached.
- All characters after
- The
Color_*unicode characters control text colors for all characters after
CommandType
enum CommandType
{
Invalid,
Attack, // valid params: [m_unitID, m_location, m_pos]
Move, // valid params: [m_unitID, m_location, m_pos]
Hold, // valid params: []
Stop, // valid params: []
RightClick, // valid params: [m_unitID, m_location, m_pos]
Patrol // valid params: [m_location, m_pos]
}
- Primarily used in gx_queue_command
stringidentifiers forSpellscan be used as well.- more to be added later
EffectType
EventType
enum EventType
{
Invalid, // Invalid Event
PlayerNameChanged, // Populates m_playerID, m_playerName, m_oldPlayerName,
// m_playerName2, m_oldPlayerName2,
// m_playerNameColor, and m_oldPlayerNameColor
// of the Event structure
PlayerNameColorChanged, // Populates m_playerID, m_playerName, m_oldPlayerName,
// m_playerName2, m_oldPlayerName2,
// m_playerNameColor, and m_oldPlayerNameColor
// of the Event structure
PlayerLeftGame, // Populates m_playerID, m_playerName, and m_playerName2,
// of the Event structure
TextCommand // Populates m_playerID, m_playerName, m_playerName2,
// and m_cmd of Event structure
UnitEnteredLocation, // Populates m_unitID and m_location
UnitExitedLocation, // Populates m_unitID and m_location
Sound2dDestroyed, // Populates m_soundID
Sound3dDestroyed // Populates m_soundID
SwitchEvent, // todo
UnitPlayerChanged, // todo
ButtonPushed, // todo
Explosion // todo
}