Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Check if a droid component is available... |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
componentAvailable(type, name) |
Parameters
Parameter | Type | Mandatory | Notes | Game version | ||
---|---|---|---|---|---|---|
type | Constant | The type of component.
| 3.1 Beta 1 | |||
name | String | The component name. Example: | 3.1 Beta 1 |
Return value
Value | Type | Notes | Game version |
---|---|---|---|
true | Boolean | The component is available for use. | 3.1 Beta 1 |
false | Boolean | The component is not currently available. | 3.1 Beta 1 |
<error> | Error | Invalid 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:
Constant | Value | Notes |
---|---|---|
COMP_UNKNOWN | 0 | Not currently used as far as I can tell |
COMP_BODY | 1 | A droid bodyBodies |
COMP_BRAIN | 2A | droid command turretCommand turrets |
COMP_PROPULSION | 3 | A droid propulsionPropulsions |
COMP_REPAIRUNIT | 4A | droid repair turretRepair turrets |
COMP_ECM | 5 | A droid ECM turretturrets |
COMP_SENSOR | 6A droid sensor turret | Sensor / Radar turrets |
COMP_CONSTRUCT | 7A | droid construction turretConstruction turrets |
COMP_WEAPON | 8A | droid weapon turretWeapon turrets |
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
const COMP_PROPULSION = 3; if (componentAvailable(COMP_PROPULSION, "hover01")) { // we can build hovercraft! } |
Div | ||
---|---|---|
| ||
Thanks to NoQ for explaining this function and finding the constants. |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|