$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Check if a droid component is available...

 

Syntax

componentAvailable(type, name)

Parameters

ParameterTypeMandatoryNotesGame version
typeConstant(tick)

The type of component.

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 body
COMP_BRAIN2A droid command turret
COMP_PROPULSION3A droid propulsion
COMP_REPAIRUNIT4A droid repair turret
COMP_ECM5A droid ECM turret
COMP_SENSOR6A droid sensor turret
COMP_CONSTRUCT7A droid construction turret
COMP_WEAPON8A droid weapon turret

Example

const COMP_PROPULSION = 3; 

if (componentAvailable(COMP_PROPULSION, "hover01")) {
	// we can build hovercraft!
}
Thanks to NoQ for explaining this function and finding the constants.
Availability 3.1 B1+

Requires:

  • Warzone 3.1 Beta 1 or above
Contents

Jump to:

 

  • No labels