Skip to reading
The Dialogue Designer

B3. Grant the key once

Edition 0.86.3.4

Build branching conversations with choices, conditions, actions, timed responses, voices, portraits and custom windows.

Download PDFView PDF page

Expose grant_key as Give Archive Key Once, with no parameters. Call it from the reward branch instead of also keeping the old unconditional Add Inventory Action.

Code example
extends PCAScriptBase
Code example
func grant_key() -> void:
    if bool(Runtime.variables.get("archive_key_given", false)):
        return
    if not HasInventory("archive_key"):
        await AddInventory({"itemId":"archive_key", "count":1})
    await SetVariable({"name":"archive_key_given", "value":true})

Use your actual dialogue, node, Choice, item and variable IDs. Save the authored script before testing it.

Page 70 of 77Permalink
Go to page