LogoLogo
API Status
  • 👋Welcome
  • 🌐What is Morpheus Platform?
    • Interoperability
  • â„šī¸Help
    • 📗Glossary
    • 🆘Support
    • Firewall problems
    • EULA
  • CREATION
    • 🎮Unreal Development
      • ⚡Get Started
        • âš’ī¸Download the Editor
        • âĢUpload Content
        • 🌎Creating your own map
        • 📝Morpheus Base Project
        • ❓Differences from Unreal
          • 🧍Character Configuration
        • 📡Morpheus Networking
          • Introduction to Morpheus Networking
          • Network Levels
          • Replicated Properties
          • RPCs
          • Morpheus Render Targets
          • Morpheus Array
          • Networking FAQ
          • Replicating Sublevels
      • 📚Features & Guides
        • 📒Example Plugin
          • Nameplates
          • In-game roles
        • 🏊Actor Pooling
        • 🔊Audio
        • 🎭Avatars
          • Creating an Avatar
          • Attachments
            • MML Attachments
          • Custom Animation Variables
          • Importing an NFT collection
          • Capsules and Mesh Transforms
        • 🤖Bots
        • đŸŽ™ī¸Chat
          • Unreal Text Chat
        • đŸŽ›ī¸Control Panels
          • Control Panel Configuration
          • DJ booth mission control
          • Observer Controls
        • 🔉Crowd Audio
        • đŸ¤ŧCrowd Rendering
          • Legacy Animated Crowd
            • Animated Crowd Console Commands
            • Attaching static meshes to crowd members
          • Crowd Materials
          • Performance Parameters
          • Live Config Settings
          • Crowd Animation
            • Crowd Anim Blueprint
              • User Guide - Crowd Anim Blueprint
              • Reference Guide - ABP Nodes
                • Animation Playback
                • States and State Machines
                • Variables
                • Transitions
                • Special
                • Blends
                • Additional Notes
        • 🍱Helpers & Extras
          • "Instanced Objects" in Blueprints
          • Objects with "world context"
          • Making DataAsset classes
          • Duplicate Objects
          • The Bootflow Subsystem
          • The "Wait For Condition" System
          • Advanced Graphics settings
          • Listening to inputs on UObjects
          • Morpheus UserID
          • World Services
          • M2Extras: Skins System
        • đŸ–Ĩī¸Loading Screen
        • ⚡Live Config
          • Editing for a World
          • Editing Locally
          • Default Settings
          • Accessing via Blueprint
          • Adding New Settings
          • Overriding Defaults
          • Using Arrays
        • 🧊MML
        • đŸ•ēMotion Capture
        • 📡Networking
        • đŸ“ĸNotifications
        • Raycastable Crowd
        • 🌐Singletons
        • 📱Streaming & Multiplatform
          • GFN on mobile
        • đŸ–Ĩī¸UI
          • "UI Mode"
        • đŸ—ƒī¸User Collections
          • Creating a New Object Definition
          • Accessing from Unreal
            • Creating Objects Definitions
            • Transfer Objects
            • User Collection Views
            • Receiving Updates
        • đŸ“ēVideo Players
          • Embedded Video Player
          • Millicast video streaming
            • How to Setup an In-Game Video Stream
            • Picture-in-Picture mode
          • Streaming Video Player
            • How to Setup a URL Video Player
            • Picture-in-Picture mode
        • 🐞Visual Debugging
          • Inspector
        • đŸĒŸWeb UI
        • 💠Web Requests
          • Http Requests
            • Legacy HTTP Nodes
          • JSON Handling
          • WebSockets
          • Identity Validation
          • Allowed External URLs
          • Walkthrough Example
            • Example Counter Service
        • âœˆī¸World Travel
          • World Travel in the editor
        • Avatar Physics Assets
        • Action Gameplay Helper Components
      • 🔑Workflows
        • â†—ī¸Upgrade the Editor
          • đŸ–Ĩī¸Version History
        • âš™ī¸Editing Project Settings
        • 📈Profiling
        • đŸ§ēMarketplace Importing
        • đŸ› ī¸Extra Workflows
          • Setup Play-in-Editor
          • Setup Local Asset Validation
          • Adding Gameplay Tags
          • Validating Game Assets
          • Custom Connection Modes
          • Connect Editor to a World
          • Common Issues
      • 📚Useful Reading
        • ⭐Best Practices
    • 🌎Worlds
      • 📩Invite Players
        • Setting Role Groups
      • Persistent Worlds
      • Always on Worlds
    • 📅Running events
      • ✅Large scale events - Checklist
      • 👾Anti-Cheat (EAC)
      • 🎮Player Entry
        • 📱React Native
        • Steam
        • đŸ’ģHardware Reqs
      • đŸŽĨBroadcast
        • 📹OBS Integration
      • Failover
      • 🏁Capacity And Queue Management
  • ADMINS
    • đŸ‘ĒAccess Control
      • Adding metaverse contributors
      • Creating a new project
    • 💲Pricing
      • Development Support
      • Included Usage & Overages
      • Cloud Streaming
      • Access Modes
      • War Room Support
      • Platform SLA
    • âš™ī¸Settings
      • đŸ—ƒī¸Projects
  • APIs and Tooling
    • 👩‍đŸ’ģIntroduction
    • đŸ–Ĩī¸API Reference
      • Accounts
      • Datasources
      • Events
      • Key/Value Store
      • Organizations
      • Realtime
      • Sessions
      • User Profile
      • World Builder
      • Worlds
    • đŸ“ĻFrontend SDKs
      • 📄Version History
      • Pixel Streaming
    • 🚀Launcher
  • Integrations
    • 📊Analytics
      • Sending events from web
      • 🎮Sending Events from Unreal
    • đŸ’ŦChat
      • 🎮Integrating Pubnub with your Unreal Project
      • Adding Moderation to Chat
Powered by GitBook
On this page
  • How to make an auto-use item
  • Using non-ability items
  • Using ability items
  • Parallel auto-use items
  • Debugging if auto-use items stop responding

Was this helpful?

  1. CREATION
  2. Unreal Development
  3. Features & Guides
  4. Inventory
  5. How to Make Devices

Auto-Use Items

Last updated 1 year ago

Was this helpful?

Auto-use items, such as potions or the loudspeaker, are those that don't need to be selected/equipped to use. Just press their button/shortcut and their effects are activated.

How to make an auto-use item

The flow for making an auto-use item is very similar to other gadgets, except for the following steps:

  • In its Use Item Details in its PDA's Custom Item Details, set AutoUse to true.

  • In its Item Executor, instead of listening to the initialize, use Event Auto Use to define your "on use" behavior.

Using non-ability items

If you want your item to work without having an ability, e.g. you just want to trigger an emote or modify some local state, you can do this. You won't need to provide an ability asset. However, you will need to manually inform the system when you're finished performing your action (normally we use the ability's activation to trigger the action being "completed"). This can be done with the Mark Local Item Executed event.

Using ability items

Typically for auto-use items that have abilities, you don't need to mark them as executed. Once the ability triggers, the item is considered finished. To trigger the ability, use TriggerAutoUseAbility

NOTE: Don't use ExecuteAbility directly, since TriggerAutoUseAbility also handles if the ability fails to execute (if the ability fails, we still need to mark the use-item as done). If we don't handle this, failing to run the ability could result in the item never getting cleaned up, and so blocking using other items.

If you want to not automatically end when the ability ends

You can also configure ability items to require manual teardown instead of immediately tearing down the auto use item when the ability activates. Consider e.g. potions, where we'd want the visuals to remain present for the whole drink animation, rather than disappearing when the potion's effect has triggered part-way through the animation. In that case, we can override the TearDownAutoUseItemOnAbilityActivated event, and instead manually call MarkLocalItemExecuted similarly to non-ability items.

Parallel auto-use items

To prevent make sure that you can't cancel one auto-use item with another, or with itself, we have some checks that prevent this. This includes checks that the item isn't already active, or its ability is on cooldown.

However, some items it may make sense to run in parallel, e.g. non-ability items that don't trigger animations or the like and just modify state. In these cases, we can loosen the restrictions by setting the AutoUseInParallel flag in the item PDA's UseItemDetails. If the flag is false, the item is considered "blocking", so other auto-use items can't be run whilst it is active.

NOTE: Auto-use items that trigger abilities can't be set to AutoUseInParallel. This is because the ability system only allows one ability running at a time.

Debugging if auto-use items stop responding

Since we enforce that you can't use an auto-use item if it's currently running, and that you can't use a "blocking" one if a different blocking item is in use, or if the required ability is in cooldown, we can end up in a situation where auto-use items don't trigger, if the system thinks an item is still running.

The following are some useful steps to debug why the subsequent auto-use items are being rejected:

  • Check for the ZombieUseItemCheck in your logs: We have a check that runs when you trigger the item. If one has been running for longer than expected, it'll give a warning, along the lines of the following: LogJunoInventory: Warning: UJ_ItemExecutorBase::ZombieUseItemCheck: Auto-use item executor BP_ItemExecutor_Grow_C_0 (running ability: BP_GrowAbility_C_0) has been running for a long time (OnClient: 0). Did you forget to call MarkLocalItemExecuted?

  • Enter the command Log LogJunoInventory Verbose

    • This will enable verbose logs, including rejection reasons for auto-use items, e.g. LogJunoInventory: Verbose: UJM_EquipmentComponent::CanAutoUseItem: Rejecting PDA_Item_Grow because Item BP_ItemExecutor_Grow_C_1 is already in use

🎮
📚
🎒
The executor for the loudspeaker. All we're doing is toggling some local state, so no ability is needed. Therefore, when we're done, we call MarkLocalItemExecuted
If TearDownAutoUseItemOnAbilityActivated is false (it defaults to true), then activating the ability won't tear down the item, and will instead wait for MarkLocalItemExecuted
This is the logic on Execute AutoUse for potions. We trigger the ability at a certain point, but ultimately the step that controls when the auto-use item is finished (and so we should stop displaying a potion in the character's hand) is when the animation/emote has finished
The loudspeaker button is a simple toggle. Therefore it can be set to run in parallel with other use items (you can turn loudspeaker on/off while drinking a potion, but you can't drink a different potion whilst currently drinking a potion)