Skip to content

activity

Black Ram edited this page Jul 1, 2024 · 3 revisions

Activity

The activities are the actions that the player can do in the room. For example, sleep, study, eat, etc...

For create a new activity you can use the newActivity() function. This function has 3 parameters:

  • id: a unique identifier for the activity. It is used to reference the activity in the game (must be unique).
  • onRun: the function that will be executed when the player runs the activity.
  • props: the activity properties. The properties are:
    • name: the activity name.
    • fromHour: the hour when the activity starts. If the activity is not started yet, it will be hidden. If you set 3, the activity will be hidden into hours 1 and 2, and will be shown from hour 3.
    • toHour: the hour when the activity ends. If the activity is ended yet, it will be hidden. If you set 3, the activity will be shown into hours 1 and 2 and will be hidden from hour 3.
    • fromDay: the day when the activity starts. If the activity is not started yet, it will be hidden. If you set 3, the activity will be hidden into days 1 and 2, and will be shown from day 3.
    • toDay: the day when the activity ends. If the activity is ended yet, it will be deleted or hidden. If you set 3, the activity will be shown into days 1 and 2 and will be deleted or hidden from day 3.
    • disabled: whether is disabled. You can also pass a Pixi'VN flag name.
    • hidden: whether is hidden. You can also pass a Pixi'VN flag name.
    • renderIcon: the activity icon. It can be a string, an JSX.Element, GraphicItemInterface or a Pixi'VN Canvas Item. Or a function to manage multiple icon types. For example to have a icon based on time.

The result of the newActivity() is a instance that you can't edit in runtime.

This instance must be added to rooms to be used. Read more about Room activities.

Clone this wiki locally