getName
getName: (NPCComposition) -> stringThe type's name ("null" for one with none, as the cache stores it).
client:getNpcDefinition(…)
bank:nearestBanker():getComposition()
bank:nearestBanker():getTransformedComposition()| Method | Returns | Description |
|---|---|---|
getName() | string | The type's name ("null" for one with none, as the cache stores it). |
getId() | number | The type's id. |
getActions() | { n: number, [number]: string? } | The type's five right-click actions, nil where one is empty. Holes are nil and the array carries n, its length: walk it `for i = 1, a… |
getConfigs() | {number}? | The type's transform table (ids by varbit value), nil for a type with none. |
transform() | NPCComposition? | The type this one shows as now: the configs entry its varbit (or varp) value picks, the last one when the value is out of range; nil when… |
getSize() | number | The type's size in tiles. |
getCombatLevel() | number | The type's combat level. |
isFollower() | boolean | Whether the type is a follower (a pet). |
isInteractible() | boolean | Whether the type can be interacted with. |
isMinimapVisible() | boolean | Whether the type shows on the minimap. |
getStats() | {number} | The type's six levels, in STAT_* order: attack, defence, strength, hitpoints, ranged, magic (1 each where the cache sets none). Raises on… |
getCombatStats() | NpcCombatStats | Bento-only: the type's levels and bonuses by name (an NpcCombatStats). The bonuses are the params the game cache sets on the type; the ga… |
getAttackSpeedTicks() | number | Bento-only: game ticks between the type's attacks, as the game cache sets it (param 14, 4 where it sets none). A boss whose script paces it… |
getAttackType() | string? | Bento-only: the kind of hit the type's attack is, as the game cache sets it (param 26): "stab", "slash", "crush" (where it sets none)… |
getSlayerTaskId() | number? | Bento-only: the slayer task the type counts for, as the id the SLAYER_TARGET var holds for that task (42 abyssal demons; Vorkath's is 25,… |
getDeathItem() | number? | Bento-only: the item id the type leaves on death, its bones or ashes (param 46: Bones, 526, where the cache sets none), nil for an NPC th… |
isDragon() | boolean | Bento-only: whether the cache marks the type a dragon (the dragonbane weapons). |
isKalphite() | boolean | Bento-only: whether the cache marks the type a kalphite (the keris), scarabs included. |
isGolem() | boolean | Bento-only: whether the cache marks the type a golem (the barronite mace), gargoyles included. |
isXerician() | boolean | Bento-only: whether the cache marks the type xerician (a Chambers of Xeric monster). |
equals(any) | boolean | Whether other equals this NPCComposition, as == answers it (false for a value of another class). |
| Field | Type | Description |
|---|---|---|
STAT_ATTACK | number | getStats()'s attack level index (0; Luau's array is 1-based, so getStats()[NPCComposition.STAT_ATTACK + 1]). |
STAT_DEFENCE | number | getStats()'s defence level index (1). |
STAT_STRENGTH | number | getStats()'s strength level index (2). |
STAT_HITPOINTS | number | getStats()'s hitpoints level index (3). |
STAT_RANGED | number | getStats()'s ranged level index (4). |
STAT_MAGIC | number | getStats()'s magic level index (5). |
| Method | Returns | Description |
|---|---|---|
Client.getNpcDefinition | NPCComposition? | NPC type id's definition (without the varbit transform), loaded on demand; nil when the client has none to give. |
NPC.getComposition | NPCComposition? | The NPC's composition as the server set it (untransformed); nil once it has despawned. |
NPC.getTransformedComposition | NPCComposition? | The composition the NPC shows as: its composition transformed by its varbit (or varp) when it has configs, else the composition itself; `ni… |
NpcChanged.getOld | NPCComposition? | The composition the NPC had before the change. |
ServerNpcLoot.getComposition | NPCComposition? | The NPC's definition: client.getNpcDefinition(id) of the id the loot script named when it ran, loaded through the client's own loader whe… |
getNamegetName: (NPCComposition) -> stringThe type's name ("null" for one with none, as the cache stores it).
getIdgetId: (NPCComposition) -> numberThe type's id.
getActionsgetActions: (NPCComposition) -> { n: number, [number]: string? }The type's five right-click actions, nil where one is empty. Holes are nil and the array carries n, its length: walk it for i = 1, actions.n. table.find stops at the first hole, so search it with your own contains(actions, x) that walks to n.
getConfigsgetConfigs: (NPCComposition) -> {number}?The type's transform table (ids by varbit value), nil for a type with none.
transformtransform: (NPCComposition) -> NPCComposition?The type this one shows as now: the configs entry its varbit (or varp) value picks, the last one when the value is out of range; nil when that entry is -1, or the type has no configs.
getSizegetSize: (NPCComposition) -> numberThe type's size in tiles.
getCombatLevelgetCombatLevel: (NPCComposition) -> numberThe type's combat level.
isFollowerisFollower: (NPCComposition) -> booleanWhether the type is a follower (a pet).
isInteractibleisInteractible: (NPCComposition) -> booleanWhether the type can be interacted with.
isMinimapVisibleisMinimapVisible: (NPCComposition) -> booleanWhether the type shows on the minimap.
getStatsgetStats: (NPCComposition) -> {number}The type's six levels, in STAT_* order: attack, defence, strength, hitpoints, ranged, magic (1 each where the cache sets none). Raises on a client build whose offset table does not place them. getCombatStats() has them by name, with the type's bonuses.
getCombatStatsgetCombatStats: (NPCComposition) -> NpcCombatStatsBento-only: the type's levels and bonuses by name (an NpcCombatStats). The bonuses are the params the game cache sets on the type; the game server keeps its own copy, which a script can override. Raises where getStats() does, and when the client no longer holds the type.
getAttackSpeedTicksgetAttackSpeedTicks: (NPCComposition) -> numberBento-only: game ticks between the type's attacks, as the game cache sets it (param 14, 4 where it sets none). A boss whose script paces its attacks itself can differ: TzTok-Jad's reads 4 although he attacks every 8 ticks.
getAttackTypegetAttackType: (NPCComposition) -> string?Bento-only: the kind of hit the type's attack is, as the game cache sets it (param 26): "stab", "slash", "crush" (where it sets none), "ranged" or "magic", nil for a value that is not known. A monster with several attacks has one here.
getSlayerTaskIdgetSlayerTaskId: (NPCComposition) -> number?Bento-only: the slayer task the type counts for, as the id the SLAYER_TARGET var holds for that task (42 abyssal demons; Vorkath's is 25, blue dragons), nil for none (param 50).
getDeathItemgetDeathItem: (NPCComposition) -> number?Bento-only: the item id the type leaves on death, its bones or ashes (param 46: Bones, 526, where the cache sets none), nil for an NPC that leaves nothing.
isDragonisDragon: (NPCComposition) -> booleanBento-only: whether the cache marks the type a dragon (the dragonbane weapons).
isKalphiteisKalphite: (NPCComposition) -> booleanBento-only: whether the cache marks the type a kalphite (the keris), scarabs included.
isGolemisGolem: (NPCComposition) -> booleanBento-only: whether the cache marks the type a golem (the barronite mace), gargoyles included.
isXericianisXerician: (NPCComposition) -> booleanBento-only: whether the cache marks the type xerician (a Chambers of Xeric monster).
equalsequals: (NPCComposition, any) -> booleanWhether other equals this NPCComposition, as == answers it (false for a value of another class).