API:TomeGetBestiarySubTypeData
From RoR Wiki
UI Lua API · Tome functions
Version: WAR 1.4.8
Returns the bestiary page of a creature subtype, with its species.
subTypeData = TomeGetBestiarySubTypeData(subTypeId)
Arguments
- subTypeId
number– Subtype id, as in thesubtypeslists of TomeGetBestiaryTOC.
Returns
- subTypeData
table– The subtype's data, or nothing if the id is invalid or the subtype is still locked.
| Key | Type | Meaning |
|---|---|---|
id |
number |
Subtype id. |
name |
wstring |
Subtype name. |
killCount |
number |
The player's kill count for the subtype. |
desc |
wstring |
Description text. |
species |
table |
Array of the subtype's species (see below). |
Each species table in species:
| Key | Type | Meaning |
|---|---|---|
id |
number |
Species id for TomeGetBestiarySpeciesData. 0 for a locked species.
|
name |
wstring |
Species name. A placeholder text for a locked species. |
isUnlocked |
boolean |
Whether the species is unlocked. |
killCount |
number |
The player's kill count for the species. |
Details
- The subtype counts as unlocked once at least one of its species is unlocked; check with TomeIsBestiarySubTypeUnlocked first, as the stock UI does.
- Locked species are still listed, but without their id and real name.
Errors
These are written to the UI log, and the function returns nothing.
Error in function call 'TomeGetBestiarySubTypeData': %d is not a valid bestiary subtype id.Error in function call 'TomeGetBestiarySubTypeData': You have not yet unlocked any species of subtype %d.
Example
From ea_tomeofknowledge/source/tomewindow_bestiary.lua:
if( TomeIsBestiarySubTypeUnlocked(id) ~= true ) then
return
end
...
TomeWindow.Bestiary.CurSubTypeData = TomeGetBestiarySubTypeData( id )
table.sort( TomeWindow.Bestiary.CurSubTypeData.species, DataUtils.AlphabetizeByNames )
local subTypeData = TomeWindow.Bestiary.CurSubTypeData
LabelSetText("BestiarySubTypeInfoText", subTypeData.desc )
