Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Check if a droid component is available...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
componentAvailable(type, name)

Parameters

ParameterTypeMandatoryNotesGame version
typeConstant(tick)

The type of component.

Note

These constants are not exposed to JS API (#3898) – see "Notes" section below for details.

3.1 Beta 1
nameString(tick)

The component name.

Example: "Spade1Mk1"

3.1 Beta 1

Return value

ValueTypeNotesGame version
trueBooleanThe component is available for use.3.1 Beta 1
falseBooleanThe component is not currently available.3.1 Beta 1
<error>ErrorInvalid parameters.3.1 Beta 1

Notes

Currently, the component type constants aren't exposed to JS API (as of WZ 3.1.0 release). As such, you need to define them manually:

ConstantValueNotes
COMP_UNKNOWN0Not currently used as far as I can tell
COMP_BODY1A droid bodyBodies
COMP_BRAIN2A droid command turretCommand turrets
COMP_PROPULSION3A droid propulsionPropulsions
COMP_REPAIRUNIT4A droid repair turretRepair turrets
COMP_ECM5A droid ECM turretturrets
COMP_SENSOR6A droid sensor turretSensor / Radar turrets
COMP_CONSTRUCT7A droid construction turretConstruction turrets
COMP_WEAPON8A droid weapon turretWeapon turrets

Example

Code Block
themeRDark
languagejavascript
linenumberstrue
const COMP_PROPULSION = 3; 

if (componentAvailable(COMP_PROPULSION, "hover01")) {
	// we can build hovercraft!
}
Div
classsuggest box

Thanks to NoQ for explaining this function and finding the constants.

Div
classbox
Availability
Status
colourGreen
title3.1 b1+

Requires:

  • Warzone 3.1 Beta 1 or above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5