Skip to content

Throw Back Grenade

Hey Sky edited this page Nov 12, 2026 · 2 revisions

Throw Back Grenade (TBG)

🇬🇧 English · 🇩🇪 Deutsche Version

Source: …/ArmaReforgerWorkbench/addons/Throw Back Grenade · prefix TBG_ · Enfusion / Enforce Script. Verified against Scripts/Game/TBG_*.c, Configs/System/*.conf, Prefabs/Weapons/Grenades/*.et.

1. What it is

Throw Back Grenade lets a player pick up a live, already‑thrown grenade and immediately throw it back (or somewhere else) before it goes off. It works for frag grenades and smoke grenades.

  • A "Pick Up and Throw Grenade" world action appears on a live grenade lying on the ground.
  • On pickup the grenade is put into the character's hand, a dummy inventory copy is spawned into the throwable slot and auto‑equipped, and the player throws it with the normal throw input.
  • The carried grenade follows the dummy's throw arc via a hidden "flight proxy" so the real (still‑ticking) grenade lands where you aimed, then detonates / smokes on its own timer.
  • If the grenade expires while still in your hand (smoke runs out, it explodes), the dummy is removed from your inventory automatically.

Supported grenades (prefabs shipped with the mod)

Prefab Type
Grenade_M67.et Frag (US)
Grenade_RGD5.et Frag (USSR)
Smoke_ANM8HC.et Smoke (HC white)
Smoke_RDG2.et Smoke (USSR)
Smoke_M18_Base.et Smoke (M18, colored)

Any grenade prefab gets support by adding two components (see §5).

2. How to use it (player)

  1. An enemy (or friendly) grenade lands near you and is still live.
  2. Look at it — the "Pick Up and Throw Grenade" action shows (only if a normal "Pick Up" action is not available for that item and the grenade is not already attached to a character).
  3. Perform the action. The grenade goes into your hand and is auto‑selected in the throwable slot.
  4. Throw it with your normal grenade throw input, or with Ctrl+X (TBG_Throw, default). Aim first — the live grenade follows where the throw lands.
  5. If you instead switch to another quick‑slot weapon while holding it, the grenade is dropped at your feet (it does not vanish).

⚠️ The grenade keeps counting down the whole time. Picking one up is a gamble.

3. Keybinds

Category TBG in Settings → Keybindings.

Action Default Context Note
TBG_Throw ("Throw Granade") Ctrl + X (KC_LCONTROL + KC_X) TBG_Action (priority 100) Throw the currently carried grenade. The normal grenade‑throw input also works.

The pickup itself is a world action ("Pick Up and Throw Grenade"), not a keybind — use your normal interact key.

4. Settings

Client settings

None. There is no in‑game settings menu for TBG.

Server settings

No dedicated config file. Configs/Editor/TBG_DebugMode.conf (TBG_DebugConfig) only gates debug logging (TBG_DebugConfig.Log(...)). Tunable constants live in the scripts:

Constant File Default Meaning
DETACH_MAX_RETRIES TBG_CarryingComponent.c 3 Retries to find the carried grenade child on remote clients before giving up
DETACH_RETRY_DELAY_MS TBG_CarryingComponent.c 200 Delay between those retries
RETRY_MAX / RETRY_DELAY_MS TBG_PickUpGrenadeAction.c 10 / 50 ms Wait for the dummy grenade to replicate after spawn
TBG_EQUIP_MAX_RETRIES / TBG_EQUIP_RETRY_DELAY_MS TBG_PlayerController.c 10 / 100 ms Wait for the grenade to replicate before equip/throw on the owner client
landing delta check TBG_CarryingComponent.c 500 ms after throw, delta < 0.05 Detects that the thrown grenade has come to rest

The only server‑side requirement is that the grenade prefabs carry the TBG components (see §5) and that TBG_CarryingComponent is on the character prefab (Prefabs/Characters/Core/Character_Base.et in this repo).

5. Modding — adding TBG to a grenade

On the grenade prefab:

  1. Add TBG_ThrowBackComponent (holds the ETBGGrenadeState state machine).
  2. On its ActionsManagerComponent → Additional Actions, add TBG_PickUpGrenadeAction with ParentContextList = { "default" }. Configure its UIInfo name so the action appears.

On the character prefab: add TBG_CarryingComponent.

The modded SCR_PlayerController (TBG_PlayerController.c) and SCR_WeaponSwitchingBaseUI (TBG_WeaponSwitchingUI.c) are applied automatically by the mod.

6. Architecture (short)

Character Entity
└── TBG_CarryingComponent    — tracks carried grenade, dummy-follow loop, all RPCs

Grenade Entity (prefab)
├── TBG_ThrowBackComponent   — ETBGGrenadeState: IDLE, THROWN, CARRIED, ACTIVATED
└── TBG_PickUpGrenadeAction  — pickup action + dummy spawn callback

SCR_PlayerController (modded) — TBG_EquipAndThrow on the owner client
SCR_WeaponSwitchingBaseUI (modded) — detects slot switch → drop

Network model

Owner Client → RpcServer_TBG_* → Server → RpcBroadcast_TBG_* → Remote Clients

The server is a pure relay — it never sets member variables, only forwards RPCs. All gameplay logic runs on the owning client (_Client methods). Remote clients mirror state from broadcast RPCs. PerformAction runs on every machine (so remote clients get CARRIED state + the grenade in the character hierarchy for tracking); inventory operations (slot clear, dummy spawn) are server‑only.

Dummy‑follow mechanic (5 phases, owning client)

  1. Wait until the dummy grenade leaves the character hierarchy (= thrown).
  2. First frame after throw → create a flight proxy, attach the carried grenade to it.
  3. Every tick: proxy position = dummy position (follows the throw arc).
  4. 500 ms after throw detection → arm the delta check.
  5. Delta < 0.05 → grenade landed → pin it to the landing position, delete the dummy. The flight proxy is kept as a landing anchor (RemoveChild(false) does not preserve world position, and the inventory system would otherwise snap the grenade back to the character).

Key invariants

  • The flight proxy must stay alive after landing — never delete or RemoveChild it.
  • ConfirmLandingPos fires 500 ms after the swap on remote clients to re‑pin the position (something overwrites it after the first set).
  • SetDummyGrenade runs on the server (from TBG_PickupSpawnCallback.OnComplete) so the inventory parent change is visible server‑side.
  • TBG_EquipAndThrow routes via RPC to the owning client — SelectWeapon / SetThrow must run on the owner, not the server.

Key files

File Purpose
Scripts/Game/TBG_ThrowBackComponent.c State enum + state component on the grenade
Scripts/Game/TBG_CarryingComponent.c Main logic: carrying, dummy‑follow, RPCs (~32 KB)
Scripts/Game/TBG_PickUpGrenadeAction.c Pickup action + spawn callback
Scripts/Game/TBG_PlayerController.c Modded PlayerController: equip & throw, slot‑switch drop
Scripts/Game/TBG_WeaponSwitchingUI.c Modded switching UI: slot‑change detection
Scripts/Game/TBG_DebugConfig.c Debug logging gate

Naming conventions

TBG_ classes/files · ETBG_ enums · members: m_p pointer/entity, m_b bool, m_v vector, m_i int · _Client = owning‑client logic · _Server = server relay · RpcServer_TBG_ = owner→server · RpcBroadcast_TBG_ = server→all.

7. Known behaviour / limitations

  • Pickup is blocked while a normal engine "Pick Up" action is available for the item, and while the grenade is already parented to a character.
  • Switching quick‑slots while carrying always drops the grenade (by design — you can't stow a live grenade).
  • Multiplayer edge cases are handled with retry loops (replication lag) rather than hard guarantees; see the retry constants in §4.

Clone this wiki locally