how do you get it so your thirdpersoncharacter can only use a torch while holding a torch
Quick answer
You restrict torch use to “only when holding a torch” by gating the torch’s light/interaction logic behind an “is equipped / is in hand” check that lives on your character or inventory system, then exposing that check to the torch (or to your input handler) so the torch can only activate when that boolean is true.
In practice (Unreal-style third‑person setups, which your wording suggests), you:
- Track “is holding torch” on the Character or PlayerController/Inventory.
- Expose that as a variable / function the Torch BP (or your input logic) can read.
- Only allow the torch’s “turn on / emit light” action when that variable is true.
Below is a concrete, step‑by‑step pattern you can adapt.
Core idea: separate “owning the item” from “being allowed to use it”
Think in three layers:
- Inventory / Equip layer – knows what the player has and what’s currently equipped/in hand.
- Character layer – knows animations, sockets, and “am I currently holding this specific item?”
- Item (Torch) layer – knows how to emit light, but defers to the character/inventory to decide if it’s allowed.
You want the torch’s “use” action to be conditional on layer 1/2 saying “yes, this torch is currently equipped in the hand”.
Typical Unreal Blueprint pattern
This matches the kind of setup discussed in Unreal forums where people want a torch to only turn on if it’s in the player’s hand.
1. Add an “IsHoldingTorch” variable on the Character
On your ThirdPersonCharacter BP:
- Create a Boolean variable:
bIsHoldingTorch(orbHasTorchEquipped). - When the player picks up / equips the torch:
- Set
bIsHoldingTorch = true.
- Set
- When they drop / unequip / swap away from the torch:
- Set
bIsHoldingTorch = false.
- Set
You can drive this from:
- An inventory system (“current equipped item == Torch”).
- A simple “pick up / put away” function on the character.
2. Expose that variable to the Torch BP
You don’t want the torch to hard‑code references to a specific character class if you can avoid it, but for a simple setup: On the Torch BP :
- On Event BeginPlay (or when attached), do:
Get Owner→ Cast to yourThirdPersonCharacter.- Store that reference in a variable like
CharacterRef.
- Create a function on the Character called something like:
IsHoldingThisTorch(Torch Actor)or simplyIsHoldingTorch()if you only have one torch type.
- In the Torch BP, when the player tries to “use” the torch:
- Call
CharacterRef.IsHoldingTorch()(or equivalent). - Only if it returns
true, proceed to turn on the light / particle / flame.
- Call
This directly mirrors the forum question where someone wanted the torch’s “is holding?” boolean to match the character’s.
3. Gate the “turn on” logic
Inside the Torch BP (or your input handler):
-
Input: “Use Torch” (e.g., pressing E / RMB / a key).
-
Logic:
text if (CharacterRef.IsValid() AND CharacterRef.IsHoldingTorch()) -> Enable light / particle / flame else -> Do nothing (or show a hint: “You need to hold the torch to use it”)
You can also do the inverse: the Character handles input, checks its own
bIsHoldingTorch, and only then calls a “Activate” function on the torch.
Alternative: let the Character handle all “use” input
If you control input on the Character:
- Bind “Use Torch” action on the Character (not the torch).
- In that handler:
- Check
bIsHoldingTorch. - If
true:- Call
CurrentHeldTorch.Activate().
- Call
- If
false:- Ignore or show feedback.
- Check
This keeps the torch passive and avoids cross‑BP complexity; the character is the single source of truth about what’s equipped.
Animation / socket considerations (optional but common)
For a believable third‑person feel, you usually also:
- Create a socket on the hand bone (e.g.
Hand_R_TorchSocket). - When equipping the torch:
- Attach the torch mesh to that socket.
- Set
bIsHoldingTorch = true.
- When unequipping:
- Detach / hide the torch.
- Set
bIsHoldingTorch = false.
This is the same pattern used for flashlights and weapons in the third‑person template discussions.
If you want different animations when holding the torch (arm raised, etc.), you:
- Add a float/bool in the AnimBP (e.g.
HoldTorch). - Drive it from the Character’s
bIsHoldingTorch. - Blend to a “holding torch” pose when true.
Minimal pseudo‑code example
Character (simplified):
pseudo
bool bIsHoldingTorch = false
Actor CurrentHeldTorch
function EquipTorch(TorchActor):
CurrentHeldTorch = TorchActor
bIsHoldingTorch = true
Attach Torch to hand socket
function UnequipTorch():
Detach CurrentHeldTorch
CurrentHeldTorch = null
bIsHoldingTorch = false
function OnUseTorchInput():
if bIsHoldingTorch and CurrentHeldTorch:
CurrentHeldTorch.Activate()
Torch (simplified):
pseudo
function Activate():
// Optional: double-check with owner
if OwnerCharacter and OwnerCharacter.IsHoldingTorch():
EnableLight()
EnableFlameFX()
The key is: only one place decides “is the torch in hand?”, and everything else asks that place.
If you’re modding a game (e.g., Skyrim, Baldur’s Gate 3, etc.)
The principle is the same, but implementation differs:
- Skyrim mods : you’d use scripts / conditions in behaviors or inventory checks so the torch light / animation only applies when the torch is equipped in the correct hand slot.
- Baldur’s Gate 3 : torch usage is tied to equipping the torch in the “light source” or off‑hand slot; if it’s not equipped, you can’t effectively use it in combat.
But the design pattern doesn’t change: equip state → gates usage.
TL;DR
- Track “is holding torch” on your character/inventory.
- Expose that state to the torch or input handler.
- Only allow the torch’s light/activation when that state is true.
- Optionally tie it to sockets and animation variables for a clean third‑person feel.
Information gathered from public forums or data available on the internet and portrayed here.