Skip to main content

World Item

note

This page describes world items in-depth. See the guide for a simple set-up.

World items are actor representations of single item stacks.

Properties

  • World items always have a single slot (slots cannot be added or removed)
  • Slot can have item requirements
  • Slot has gameplay tags
  • Slot has configurable capacity
  • When the slot becomes empty1, the world item will be destroyed automatically.

Usage

Dropping

World items can be dropped using the Drop World Item (from an item stack on the server) and Drop World Item From Slot (from an inventory).

Alternatively, you may place world items in an editor world by dragging a BLItemDef asset into the world.

Picking Up

World items automatically destroy themselves if all of their items are withdrawn. This is called Picking Up the world item.

Prediction

World items can be predictively spawned and destroyed on clients, if that client is the one requesting drop/pick up. To enable this, the requesting player must have an BLPredictiveActorControllerComponent. See the extensions below for updating items based on prediction status:

Extensions

  • PostDrop: Called after a world item is first dropped into the world. Will not be called on world items when copying editor worlds.
  • PrePickUp: Called before a world item has any items withdrawn.
  • PostItemStackUpdated: Called after the world item's stack is updated for any reason:
    • During the construction script (within the editor or at runtime)
    • After being dropped
    • After items are deposited or withdrawn.
    • Consequently, this is a good place to update the world item's visuals based on the item(s) it contains (e.g., mesh, particles, etc.)

From BLPredictiveActor:

  • PreGameplayDestroy: Called before the world item is destroyed, predictively or authoritatively, on clients and servers. This is a good place to spawn on-destroy effects like particles, etc.
  • PostPredictiveSpawnSynced: Called on clients after the actor's predictive spawn is synced with its authoritative version. Can be used to sync data like the actor's position, velocity, etc.
  • PostPredictiveDestroy: Called on clients after the actor is predictively destroyed2.
    • Can be used to hide the actor so it doesn't affect gameplay while waiting for the server to approve or deny the request. Do not call the engine's Destroy on the actor!
    • By default, Bolt will:
      - Hide the actor
      - Disable the actor's collision
      - Disable the actor's tick
      You can turn this off using the bUseDefaultPredictiveDestroy flag.
  • PostPredictiveDestroyReverted: Called on clients after a predictive destroy is reverted3.
    • Can be used to revert an actor back to a playable state. In general, you should usually set data back to what it was before PostPredictiveDestroy.
    • By default, Bolt will set actor's visibility, collision, and tick to the same values as before the actor was destroyed. You can turn this off using the bUseDefaultPredictiveDestroy flag.

  1. Becomes empty after a prediction window finishes.
  2. In case PredictiveDestroy is called multiple times before the response is received, PostPredictiveDestroy is only called the first time.
  3. In case PredictiveDestroy is called multiple times before the response is received, PostPredictiveDestroyReverted is only called once after receiving a response for the most recent request.