
Extended Shop & Currency System in Unreal Engine
1. Coin Collection → Currency
BP_Coin still handles its own overlap. When the player touches a coin, it:
Plays the collection sound and increments a Currency variable on the player character.
Hides or destroys itself.
Your player now carries a running total of coins gathered from the world.
2. Shop Interaction & Purchase
BP_ShopKeeper still uses its own box collision and “Press E” prompt.
When the player presses Interact and confirms a purchase:
Check Balance: Compare the player’s Currency against the item’s Cost.
Subtract Cost: If sufficient funds, deduct the Cost from Currency.
Spawn Item: Spawn the purchased item actor (or pickup) at a predefined SpawnPoint (e.g., a Scene Component or arrow socket) on the shopkeeper’s mesh.
3. Grounded Item Pickups
The spawned actor can be any collectible or usable item blueprint (health pack, ammo, weapon).
If you want the player to pick it up again (for dropped purchases or refunds), equip that actor with the same overlap logic as your coins—on overlap it:
Adds its own value back into Currency (or adds inventory).
Removes itself from the world.
4. Workflow Summary
Collect Coins → Player’s Currency increases.
Approach Shop → “Press E” prompt appears.
Open Shop UI, select item, and hit “Buy.”
Shopkeeper:
Verifies Currency ≥ Cost
Deducts Cost from player
Spawns the item on the ground at SpawnPoint
New Pickup (if desired): Acts like a coin—player overlaps to collect or re-collect.
5. Advantages & Scalability
Modular: Coins, shopkeepers, and spawned items each own their own logic—no centralized spaghetti.
Flexible: You can swap out item classes, change costs, or add spawn animations without touching global managers.
Performant: Overlaps and single actor spawns are cheap; dozens of coins and vendors still run smoothly at 60 fps.
With this setup, your world’s floating coins feed directly into your shop economy, and purchases drop real items into the scene for the player to interact with—all driven by clean, per-actor Blueprints.