dot big bang

Developer API
Menu
All
  • Public
  • Public/Protected
  • All

You can spend coins you have collected on weapons on one of the islands in this example. The Purchasable Object script manages these purchases for you by trading a Collectable for a Weapon. Since Weapon Data scripts in the "Cosmetic and Weapon Database" object have "Cost" and "Cost Collectable Data Id" properties they work with the purchasing system.

As long as the player has the dbb_player_state script any purchases will be automatically saved.

I'll cover the properties on the Purchasable Object script below:

  • Purchasable Data Id

    • This must match the "Data Id" on a "Weapon Data" or other compatible data script in a Database.
  • Spawn Template On Purchase

    • If set, this template will be spawned when a purchase occurs. This can be useful for things like spawning a door to a new area, or a new vehicle.
  • Destroy On Purchase

    • If set, this object will be removed from the game when purchased. Useful for allowing access to a new area.
  • Purchase Amount

    • The number of purchasables that should be given to the buyer.
  • Cost Label

    • The text to display on a Text Component on this object if it is available to purchase. Some special strings will let you display values based on the player save data and purchase data. For example: "{cost} {costDisplayName}s" will show up as "5 Coins" or something similar based on the actual data. These special strings are:
      • {displayName}
      • {description}
      • {cost}
      • {maxOwnable}
      • {costDisplayName}
      • {costDescription}
  • Purchased Label

    • The text to display on a Text Component on this object if it is already purchased. The same special strings that "Cost Label" can use are valid here.
  • Purchase Screen Id

    • If set, will attempt to open this screen via a "Screen Manager" object. Read more about that here: Screen Manager
  • Purchase Fx

    • If set, this template will be spawned when a purchase happens. Make sure the template removes itself from the game when it is done by using a "dbb_destroy_after_delay" script.
  • Purchase Sound

    • If set, this sound will play when a purchase happens.
  • Cannot Purchase Sound

    • If set, this sound will play when a purchase attempt fails.
  • Interaction Arrow Offset

    • Can be used to move the location of the interaction icon.
  • Interaction Arrow Voxel Object

    • Can be used to change the interaction icon to a custom one.