Skip to content
Carenalga edited this page Feb 6, 2023 · 8 revisions

Description

Each prop you create will have its own script file (based on PropTemplate.gd). This is created with the name you give the prop in the Create prop popup prefixed by Prop: E.g. PropWhiskyBottle.gd, PropNotebook.gd.

Methods

  • on_interact() void

Called when "popochiu-interact" (set to Left Mouse Button in the project's Input Map) is used on the prop. E.g. You can use it to make the PC do something with the prop when players interact with it.

By default this calls to .on_interact(). In case you don't overwrite this, it will use the default PopochiuClickable.gd on_interact() call, which shows a game message.

func on_interact() -> void:
  yield(E.run([
    C.walk_to_clicked(), # The PC walks to the clicked prop's walk_to_point property
    "Player: I'll take this deck of cards with me",
    I.add_item('CardDeck'),
    disable() # Makes the prop disappear
  ]), 'completed')
  • on_look() void

Called when "popochiu-look" (set to Right Mouse Button in the project's Input Map) is used on the prop. E.g. You can use it to make the character say something about it.

By default this calls to .on_look(). In case you don't overwrite this, it will use the default PopochiuClickable.gd on_look() call, which shows a game message.

func on_look() -> void:
  E.run([
    C.face_clicked(),
    'Player: My deck of cards.',
    'Player: It was a gift from the company.',
    '..', # Wait 0.5 seconds
    'Player: Tacaños.'
  ])
  • on_item_used( PopochiuInventoryItem item ) void

Called when an inventory item is used on the prop. Use the script_name property of item to see which was used.

By default this calls to .on_item_used(item). In case you don't overwrite this, it will use the default PopochiuClickable.gd on_item_used(item: PopochiuInventoryItem) call, which shows a game message.

func on_item_used(item: PopochiuInventoryItem) -> void:
  E.run([
    "Player: No. I don't want to spoil it."
    'Player: It is a cheap gift, but a gift after all.'
  ])
  • on_linked_item_removed() void

Called when the PopochiuInventoryItem linked to this prop is removed (once the item_removed signal from singleton I is emitted) from the inventory. This may happen when the inventory item dissapears forever from the game.

func on_linked_item_removed() -> void:
  E.run([
    'Popsy: I already knew that giving you that would not result in anything good.',
    'Player: Sometimes you have to make sacrifices'
  ])
  • on_linked_item_discarded() void

Called when the PopochiuInventoryItem linked to this prop is discarded (once the item_discarded signal from singleton I is emitted) from the inventory. This may happen when the inventory item is thrown away, but it still can be grabbed and put in the inventory again.

func on_linked_item_removed() -> void:
  E.run([
    A.play('sfx_book_put'),
    "Player: I'll leave it here.",
    'Player: Might be useful later'
  ])
Clone this wiki locally