TreasureChest

┗> Event > Object > Class


A Treasure Chest that can contain either an Item or some money.
TreasureChest is an Event - naming an object chest on an objects layer in a map creates this object.
See this object's Fields for the configurable properties on this object.


Constructor


TreasureChest(x: number, y: number, properties: number)

Arguments:

x: number
y: number
properties: number




Methods




TreasureChest:onAdd(parent: Event|World)

Handles making the chest remain appearing open when re-entering the room

Arguments:

parent: Event|World

The World Object manages everything relating to the overworld in Kristal.
A globally available instance of World is stored in Game.world.



TreasureChest:onInteract(player: Player, dir: string)

Handles opening the chest and giving the player their items

Arguments:

player: Player

The character controlled by the player when in the Overworld.

dir: string

Returns:

1: boolean



Fields


TreasureChest.item: string

[Property item] The name of the item contianed in this treasure chest - cannot be used in conjunction with money


TreasureChest.money: number

[Property money] The amount of money contained in this treasure chest - cannot be used in conjunction with item


TreasureChest.set_flag: string

[Property setflag] An optional flag to set when the treasure chest is opened


TreasureChest.set_value: any

[Property setvalue] The value to set on the flag specified by setflag (Defaults to true)