MATTIE.itemAPI.RunTimeItem(type)

new RunTimeItem(type)

a class that represents a single runtime item

Parameters:
Name Type Description
type ITEM_TYPES

the type of the item, default item

Members

_data :rm.types.Armor

the actual data item of this class

isSpawned

whether this item is spawned or not

type :ITEM_TYPES

Methods

addRecipe(itemIds, unlockItemId,)

add a recipe to the current item

Parameters:
Name Type Description
itemIds Array.<id>

array of items needed for this recipe

unlockItemId, id

the item that will unlock the recipe for this item

buildDefaultParams()

create the default data item

Returns:
-

the default dataItem obj

gainThisItem(x, display)

have the party gain this item and display the pickup message

Parameters:
Name Type Default Description
x int 1

quantity to gain

display boolean true

whether to display the pickup message or not

loseThisItem(x)

have the party lose this item

Parameters:
Name Type Default Description
x int 1

quantity to lose

setCallback()

set a callback to be called when this item is used

setConsumable(bool)

set whether this item is consumable or not

Parameters:
Name Type Description
bool bool

true if consumable false if not

setCraftingCallback(cb)

set a callback to occur when this item is crafted

Parameters:
Name Type Description
cb function

the callback to be called

setDescription(desc)

set the desc of this item

Parameters:
Name Type Description
desc String

the new desc

setEquipCallback(cb)

set a callback to be called when this item is equipped

Parameters:
Name Type Description
cb function

a callback taking the Game_Actor object that has equipped this item

setEquipType(atype)

set the category of the armor
3: accessory
4: torso
5: shield
6: head

Parameters:
Name Type Description
atype rm.types.Armor

setItemType()

1: normal, 2: book/key item

setName(name)

set the name of this item

Parameters:
Name Type Description
name String

the new name

setType(type)

set the type of this item, refer to enum above for types

Parameters:
Name Type Description
type ITEM_TYPES

setUnequipCallback()

set a callback to be called when this item is equipped