A complete, guarded combination script
Create a GDScript record named Lubricate the gear with ID oil_gear. Apply this complete source:
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
if not HasInventory("oil"):
return false
if not HasInventory("brass_gear"):
return false
await RemoveInventory({"itemId": "oil", "count": 1})
await RemoveInventory({"itemId": "brass_gear", "count": 1})
await AddInventory({"itemId": "lubricated_gear", "count": 1})
await SetVariable({
"name": "inventory_feedback",
"value": "The gear is now lubricated."
})
return trueThe checks prevent a free reward if the recipe is called without its ingredients. The removals consume one oil and the old gear. The add gives the replacement item. A second call fails once the old gear has gone.
The result must already have a valid inventory definition, and the active player must be allowed to carry it. If the result is stackable, allow enough capacity for it before consuming ingredients in a more complicated recipe.
Use explicit Remove Inventory actions on the successful path. Although Consume On Use is exposed in the item settings, do not rely on it as automatic recipe consumption in 0.86.3.4.
